""".replace('\n', '<br/>\n').format(ID=self.ID, element=element) @expose_to_web def html(self): if self.child_ID is None: return u""" <h2>Страница, которую вы ищете, отсутствует. Можно создать:<h2> <a href="/_/html_page:{ID}/create/div_raw">Create new div_raw</a> <a href="/_/html_page:{ID}/create/vbox">Create new vbox</a> <a href="/_/html_page:{ID}/create/hbox">Create new hbox</a> """.replace('\n', '<br/>\n').format(ID=self.ID) return PLUG(self.child_ID, 'full_page') @expose_to_web def editor(self): return 'Here will be editor' @expose_to_web def save(self, title=None, script=None, style=None, child_ID=None): TODO('html5: alert client to update css if required, via web_socket') say.warning('implement security checks here') TODO('implement security checks here') _ = lambda arg, slf : slf if arg is None else arg db.save(self.ID, title=_(title, self.title), script=_(script, self.script), style=_(style, self.style), child_ID=_(child_ID, self.child_ID)) self.reload_from_db() return self.html() register_new_PLUG(html_page, 'html_page')
# def editor(self): # res = u'''<h3>Enter new content of <em>gallery:{self.ID}</em> here:<br/> #<textarea rows="15" style="width:80%" # id="content:gallery:{self.ID}" name="content:gallery:{self.ID}"> #{self.content} #</textarea><br/> #<span onclick='satory.update_tile("content_div_{self.ID}", # "gallery:{self.ID}", "save", # {{"params":{{"content": $("content:gallery:{self.ID}").val()}}, # "method":"POST"}})'> # [Save] #</span> #<span onclick='satory.update_tile("content_div_{self.ID}", "gallery:{self.ID}", "html")'> # [Cancel] #</span> #''' # return res.format(self=self) # @expose_to_web # def save(self, content=None): # say.warning('>>> doing saving here: ' + unicode(content)) # TODO('html5: alert client to update css if required, via web_socket') # say.warning('implement security checks here') # TODO('implement security checks here') # content = self.content if content is None else content # db.save(key=self.ID, content=content) # self.reload_from_db() # return self.html() register_new_PLUG(gallery, 'gallery')
def html(self): res = [] for number, child in enumerate(self.children, 1): if child is None: res.append(u"""<h2>Элемент <b>vbox:{self.ID}.{number}</b> отсутствует. Можно создать:<h2> <a href="/_/vbox:{self.ID}/create/{number}/div_raw">Create new div_raw here</a> <a href="/_/vbox:{self.ID}/create/{number}/vbox">Create new vbox</a> <a href="/_/vbox:{self.ID}/create/hbox">Create new hbox</a> Child-ID: <input type="text" id="vbox-{self.ID}-{number}" /> <span onclick='window.location="/_/vbox:{self.ID}/create/{number}/child_ID/" + $("vbox-{self.ID}-{number}").val()'>[SUBMIT]</span> """.replace('\n', '<br/>\n').format(self=self, number=number)) else: res.append(PLUG(child, 'full_page')) return '\n'.join('<div style="border: 1px solid black">%s</div>' % x for x in res) @expose_to_web def editor(self): return 'Here will be editor' @expose_to_web def save(self, size=None, children=None): TODO('html5: alert client to update css if required, via web_socket') say.warning('implement security checks here') TODO('implement security checks here') db.save(self.ID, size=size or self.size, children=children or self.children) self.reload_from_db() return self.html() register_new_PLUG(vbox, 'vbox')
def editor(self): res = u'''<h3>Enter new content of <em>div_raw:{self.ID}</em> here:<br/> <textarea rows="15" style="width:80%" id="content:div_raw:{self.ID}" name="content:div_raw:{self.ID}"> {self.content} </textarea><br/> <span onclick='satory.update_tile("content_div_{self.ID}", "div_raw:{self.ID}", "save", {{"params":{{"content": $("content:div_raw:{self.ID}").val()}}, "method":"POST"}})'> [Save] </span> <span onclick='satory.update_tile("content_div_{self.ID}", "div_raw:{self.ID}", "html")'> [Cancel] </span> ''' return res.format(self=self) @expose_to_web def save(self, content=None): say.warning('>>> doing saving here: ' + unicode(content)) TODO('html5: alert client to update css if required, via web_socket') say.warning('implement security checks here') TODO('implement security checks here') content = self.content if content is None else content db.save(key=self.ID, content=content) self.reload_from_db() return self.html() register_new_PLUG(div_raw, 'div_raw')