예제 #1
0
	def edit(self,topic,
				content=None,tags=None,originaltopic=None):
				
		user = self.logon.checkauth(
			logonurl=self.logon.path, returntopage=True)
		
		if content is None :
			currentcontent,tags = wiki.gettopic(topic)
			html = '''
			<div id="editarea">
				<form id="edittopic" action="edit" 
					method="GET">
					<label for="topic"></label>
					<input name="originaltopic" 
						type="hidden" value="%s">
					<input name="topic" type="text"
						value="%s">
					<div id="buttonbar">
						<button type="button" id="insertlink">
							External link
						</button>
						<button type="button" id="inserttopic">
							Wiki page
						</button>
						<button type="button" id="insertimage">
							Image
						</button>
					</div>
					<label for="content"></label>
					<textarea name="content"
						cols="72" rows="24" >
						%s
					</textarea>
					<label for="tags"></label>
					<input name="tags" type="text" value="%s">
					<button type="submit">Save</button>
					<button type="button">Cancel</button>
					<button type="button">Preview</button>
				</form>
			</div>
			<div id="previewarea">preview</div>
			<div id="imagedialog">%s</div>
			<script>
				$("#imagedialog").dialog(
					{autoOpen:false,
					 width:600,
					 height:600});
			</script>
			'''%(topic, topic, currentcontent,
					", ".join(tags),
					"".join(self.images()))
			return basepage % html
		else :
			wiki.updatetopic(originaltopic,topic,content,tags)
			raise cherrypy.HTTPRedirect('show?topic='+topic)
예제 #2
0
    def edit(self, topic, content=None, tags=None, originaltopic=None):

        user = self.logon.checkauth(logonurl=self.logon.path,
                                    returntopage=True)

        if content is None:
            currentcontent, tags = wiki.gettopic(topic)
            html = '''
			<div id="editarea">
				<form id="edittopic" action="edit" 
					method="GET">
					<label for="topic"></label>
					<input name="originaltopic" 
						type="hidden" value="%s">
					<input name="topic" type="text"
						value="%s">
					<div id="buttonbar">
						<button type="button" id="insertlink">
							External link
						</button>
						<button type="button" id="inserttopic">
							Wiki page
						</button>
						<button type="button" id="insertimage">
							Image
						</button>
					</div>
					<label for="content"></label>
					<textarea name="content"
						cols="72" rows="24" >
						%s
					</textarea>
					<label for="tags"></label>
					<input name="tags" type="text" value="%s">
					<button type="submit">Save</button>
					<button type="button">Cancel</button>
					<button type="button">Preview</button>
				</form>
			</div>
			<div id="previewarea">preview</div>
			<div id="imagedialog">%s</div>
			<script>
				$("#imagedialog").dialog(
					{autoOpen:false,
					 width:600,
					 height:600});
			</script>
			''' % (topic, topic, currentcontent, ", ".join(tags), "".join(
                self.images()))
            return basepage % html
        else:
            wiki.updatetopic(originaltopic, topic, content, tags)
            raise cherrypy.HTTPRedirect('show?topic=' + topic)
예제 #3
0
	def show(self,topic):
		topic = topic.capitalize()
		currentcontent,tags = wiki.gettopic(topic)
		currentcontent = "".join(wiki.render(currentcontent))
		tags = ['<li><a href="searchtags?tags=%s">%s</a></li>'%(
					t,t) for t in tags]
		content = '''
		<div>
			<h1>%s</h1><a href="edit?topic=%s">Edit</a>
		</div>
		<div id="wikitopic">%s</div>
		<div id="wikitags"><ul>%s</ul></div>
		<div id="revisions">revisions</div>
		''' % ( topic, topic, currentcontent,"\n".join(tags))
		return basepage % content
예제 #4
0
    def show(self, topic):
        topic = topic.capitalize()
        currentcontent, tags = wiki.gettopic(topic)
        currentcontent = "".join(wiki.render(currentcontent))
        tags = [
            '<li><a href="searchtags?tags=%s">%s</a></li>' % (t, t)
            for t in tags
        ]
        content = '''
		<div>
			<h1>%s</h1><a href="edit?topic=%s">Edit</a>
		</div>
		<div id="wikitopic">%s</div>
		<div id="wikitags"><ul>%s</ul></div>
		<div id="revisions">revisions</div>
		''' % (topic, topic, currentcontent, "\n".join(tags))
        return basepage % content