Example #1
0
        /// <summary> </summary>
        public String render(posting post, Hashtable param)
        {
            String mode = param.ContainsKey("mode") ? param["mode"].ToString() : "published";

            posting pub_post = post.get_published();
            String  tmp_str  = pub_post.load_content(mode);

            if (!PropertyBag.ContainsKey("post_content") && post.post_type.root &&
                !post.post_type.use_layout_templates && !post.post_type.use_posting_templates)
            {
                PropertyBag["post_content"] = tmp_str;
            }

            posting temp = post.get_template_obj(post.post_type.alias + "_template");

            if (temp != null)
            {
                tmp_str = renderposting(temp.load_content(mode), post, objectService.marge_params(PropertyBag, param));
            }

            //param.Add("Controller", base.MemberwiseClone());
            tmp_str = renderposting(tmp_str, post, objectService.marge_params(PropertyBag, param));



            String name = pub_post.name;//for testing only

            if (post.post_type.is_frontend_editable && post.is_frontend_editable && Controllers.BaseController.editing)
            {
                tmp_str = editingService.make_editable(tmp_str, post, areacount++);
            }

            if (!PropertyBag.ContainsKey("post_content") && post.post_type.root)
            {
                PropertyBag["post_content"] = tmp_str;
            }

            Hashtable post_params = objectService.marge_params(PropertyBag, param);


            /* now process the content template RETHINK THIS */
            if (post.post_type.use_posting_templates)
            {
                posting posting_template = post.get_template_obj("posting_template");
                if (posting_template != null)
                {
                    tmp_str = renderposting(posting_template.load_content(mode), post, post_params);
                }
                if (!PropertyBag.ContainsKey("childContent") && post.post_type.root)
                {
                    PropertyBag["childContent"] = tmp_str;
                }
            }
            else
            {
                if (!PropertyBag.ContainsKey("childContent") && post.post_type.root)
                {
                    PropertyBag["childContent"] = tmp_str;
                }
            }

            //NOTE THIS SHOULD HAVE FIELDS TEMPLATES SHOULD BE THAT ABLE
            /* now process the layout */
            if (post.post_type.use_layout_templates)
            {
                posting layout_template = post.get_template_obj("layout_template");
                if (layout_template != null)
                {
                    tmp_str = renderposting(layout_template.load_content(mode), post, objectService.marge_params(PropertyBag, param));
                }
            }

            Controllers.BaseController.vardump(post_params, "Post:" + post.name, "<code><pre>${1}</pre></code>");
            return(tmp_str);
        }