public ActionResult Modules(string moduleName) //install a module
        {
            var success = false;

            CreateOrUpdateReport <Module> moduleInstallOrUpdateReport = null;

            try
            {
                moduleInstallOrUpdateReport = _reflectionContentManager.GetNewOrUpdatedModule(moduleName);
                _reflectionContentManager.Store(moduleInstallOrUpdateReport.Item);
                _reflectionContentManager.SaveChanges();
                success = true;
            }
            catch (Exception exception)
            {
                //TODO: Log
            }

            //TODO: Trouver une solution au UrlRewriting pour que les ActionLink et RedirectToAction etc fonctionne vers les url réécrites

            var viewModel = new ModulesViewModel
            {
                ModuleInfos = _reflectionContentManager.GetModuleInfos(),
                Message     = success
                                                  ? String.Format("Module {0} has been {1}.",
                                                                  moduleName,
                                                                  (moduleInstallOrUpdateReport.Action ==
                                                                   CreateOrUpdateActions.Updated
                                                                       ? "updated"
                                                                       : "installed"))
                                                  : "An error occured."
            };

            return(View(viewModel));
        }
Example #2
0
        private RedirectResult SaveContentTypeProperty(ContentType.ContentTypeProperty contentTypeProperty)
        {
            _reflectionContentManager.Store(contentTypeProperty.ContentType.Module);
            _reflectionContentManager.SaveChanges();

            return(Redirect("/admin/contenttype?contenttypefullname=" + contentTypeProperty.ContentType.FullName));
        }
        public void AddPropertyEditor(IPropertyEditor propertyEditor, Publication publication = null)
        {
            var contentReport = _reflectionContentManager.GetNewOrUpdatedContent(propertyEditor as PropertyEditor);

            if (publication != null)
                contentReport.Item.CreateTranslationVersions(publication);

            _reflectionContentManager.Store(contentReport.Item);
        }
        public void AddRoute(IRoute route, Publication publication = null)
        {
            var contentReport = _reflectionContentManager.GetNewOrUpdatedContent(route as Route);

            if (publication != null)
            {
                contentReport.Item.CreateTranslationVersions(publication);
            }

            _reflectionContentManager.Store(contentReport.Item);
        }
Example #5
0
        public void InstallOrUpdateModules(IList <Assembly> moduleAssemblies)
        {
            var reports = _reflectionContentManager.GetNewOrUpdatedModules(moduleAssemblies);

            foreach (var report in reports.Where(r => r.Action != CreateOrUpdateActions.Unchanged))
            {
                _reflectionContentManager.Store(report.Item);
            }

            _reflectionContentManager.SaveChanges();
        }
Example #6
0
        public ActionResult Content(Content.ContentTranslation contentTranslation)
        {
            _reflectionContentManager.Store(contentTranslation.Content);
            _reflectionContentManager.SaveChanges();

            //var viewModel = new ContentViewModel
            //                    {
            //                        Content = contentTranslation
            //                    };

            return(Redirect(new StringBuilder("/admin/contents")
                            .AddQueryParam("contenttypefullname", contentTranslation.ContentType.FullName)
                            .AddQueryParamIfAlreadyThere("culture").ToString()));
        }
Example #7
0
        public ActionResult Edit(EditContentTypeViewModel viewModel)
        {
            //TODO: Validation, etc.
            //TODO: BaseContentType

            var module = _reflectionContentManager.LoadModule(viewModel.ModuleName);

            module.AddContentType(viewModel.Name);

            _reflectionContentManager.Store(module);
            _reflectionContentManager.SaveChanges();

            return(Redirect("/admin/module?modulename=" + viewModel.ModuleName));
        }
Example #8
0
        public ActionResult Delete(string propertyFullName)
        {
            var contentTypeFullName = _reflectionContentManager.GetContentTypeFullNameFromPropertyFullName(propertyFullName);
            var contentType         = _reflectionContentManager.LoadContentType(contentTypeFullName);

            if (contentType != null)
            {
                if (contentType.RemoveProperty(propertyFullName))
                {
                    _reflectionContentManager.Store(contentType.Module);
                    _reflectionContentManager.SaveChanges();
                }

                return(Redirect(new StringBuilder("/admin/contenttype")
                                .AddQueryParam("contenttypefullname", contentTypeFullName).ToString()));
            }

            return(Redirect("/admin/modules"));
        }