/// <summary> </summary> public void edit_post(int id, int rev, Boolean skipLayout) { posting post = ActiveRecordBase <posting> .Find(id); PropertyBag["lastversions"] = post.get_latest_revisions(); PropertyBag["full"] = false; /* load a revision other then the working copy? */ if (rev > 0) { posting lastversion = new posting(); lastversion = post.get_revision(rev); if (lastversion != null && lastversion.baseid > 0 && lastversion.baseid != post.baseid) { post = lastversion; } } appuser user = userService.getUserFull(); /* todo abstract this out of here */ List <AbstractCriterion> typeEx = new List <AbstractCriterion>(); typeEx.Add(Expression.Eq("set", post.post_type.baseid)); field_types[] ft = ActiveRecordBase <field_types> .FindAll(typeEx.ToArray()); List <string> fields = new List <string>(); PropertyBag["short_codes"] = fieldsService.get_short_codes(ft); List <string> user_fields = new List <string>(); if (ft != null) { foreach (field_types ft_ in ft) { if ((ft_.users.Count > 0) || (ft_.users.Count > 0)) { if (ft_.users.Contains(user)) { user_fields.Add(fieldsService.get_field(ft_, post)); } else { fields.Add(fieldsService.get_field(ft_, post)); } } else { user_fields.Add(fieldsService.get_field(ft_, post)); } } } /*end*/ PropertyBag["user_fields"] = user_fields; PropertyBag["fields"] = fields; PropertyBag["post"] = post; PropertyBag["taxonomy"] = ActiveRecordBase <taxonomy_type> .FindAll(); PropertyBag["postCustom"] = file_info.DirSearch("/Views/admin/postings/custom_post_blocks/" + post.post_type.alias + "/editor_blocks/", @"/editor_blocks/", ".vm"); PropertyBag["named_type"] = post.post_type.alias; PropertyBag["named_type_dname"] = post.post_type.name; PropertyBag["item"] = post; /* this needs to be rethinked. It should be so hard coded here */ PropertyBag["posting_templates"] = themeService.get_published_templates("posting_template"); PropertyBag["layout_templates"] = themeService.get_published_templates("layout_template"); PropertyBag["menu_templates"] = themeService.get_published_templates("menu_template"); if (post.post_type.alias == "menu") { PropertyBag["menuItems"] = post.menuoptions.OrderBy(x => x.sort); } PropertyBag["categories"] = taxonomyService.get_taxonomies("categories"); /* Set up render */ if (skipLayout) { CancelLayout(); } PropertyBag["skipLayout"] = skipLayout; //what file //this is the setup for the admin to get fully themed /*String actionfile = "/Views/admin/postings/custom_post_blocks/" + post.post_type.alias + "/_editor.vm"; * if (file_info.file_exists(actionfile)) { * * String layoutfile = "/Views/admin/default/layout_template/admin.vm"; * String layout = file_handler.read_from_file(layoutfile); * * PropertyBag["siteroot"] = httpService.getRootUrl().TrimEnd('/'); * PropertyBag["Controller"] = base.MemberwiseClone(); * * * Hashtable content_params = objectService.marge_params(PropertyBag, new Hashtable()); * String output = renderService.proccessText(content_params, file_handler.read_from_file(actionfile)); * * PropertyBag["childContent"] = output; * * content_params = objectService.marge_params(PropertyBag, new Hashtable()); * * output = renderService.proccessText(content_params, layout); * Boolean tmpB = false; * if (tmpB) output = htmlService.stripNonSenseContent(output, false); * RenderText(output); * return; * }*/ String editorpath = "../admin/postings/_editor"; if (file_info.file_exists("/Views/admin/postings/custom_post_blocks/" + post.post_type.alias + "/_editor.vm")) { editorpath = "../admin/postings/custom_post_blocks/" + post.post_type.alias + "/_editor"; } RenderView(editorpath); }