Пример #1
0
 public DreamMessage PostFormHandler(DreamContext context, DreamMessage message)
 {
     if (this.formHtml == null)
     {
         string formTemplate = Plug.New(Env.RootUri).At("mount", "deki-widgets").At("widget-editor-form.html").Get().Text;
         string form         = Plug.New(Env.RootUri).At("mount", "deki-widgets").At("dekibizcard-form.html").Get().Text;
         this.formHtml = WidgetService.ReplaceVariables(formTemplate, new MyDictionary(
                                                            "%%TITLE%%", "BizCard Editor",
                                                            "%%HEAD%%", "<script type=\"text/javascript\" src=\"/editor/widgets/dekibizcard.js\"></script>\n<style type=\"text/css\" src=\"/editor/widgets/bizcard.css\" ></style>",
                                                            "%%FORM%%", form
                                                            ));
     }
     return(DreamMessage.Ok(MimeType.HTML, this.formHtml));
 }
Пример #2
0
        public DreamMessage GetAddressBookHandler(DreamContext context, DreamMessage message)
        {
            user   user  = Authenticate(context, message, DekiUserLevel.User);
            page   page  = Authorize(context, user, DekiAccessLevel.Read, "pageid");
            string title = page.PrefixedName;

            if (this.addressBookHtmlTemplate == null)
            {
                this.addressBookHtmlTemplate = Plug.New(Env.RootUri).At("mount", "deki-widgets").At("addressbook.html").Get().Text;
            }
            string addressBookHtml = WidgetService.ReplaceVariables(addressBookHtmlTemplate, new MyDictionary("%%TITLE%%", title));

            return(DreamMessage.Ok(MimeType.HTML, addressBookHtml));
        }