[xiph-commits] r2954 - cmmlwiki/trunk/cmmlwiki
dcrowdy at svn.annodex.net
dcrowdy at svn.annodex.net
Sat Jun 16 02:23:33 PDT 2007
Author: dcrowdy
Date: 2007-06-16 02:23:33 -0700 (Sat, 16 Jun 2007)
New Revision: 2954
Modified:
cmmlwiki/trunk/cmmlwiki/handler.py
cmmlwiki/trunk/cmmlwiki/htmlpage.py
cmmlwiki/trunk/cmmlwiki/request.py
Log:
Added ability to add content by file upload. Whitespace isn't handled properly in the name field yet.
Modified: cmmlwiki/trunk/cmmlwiki/handler.py
===================================================================
--- cmmlwiki/trunk/cmmlwiki/handler.py 2007-06-16 08:58:54 UTC (rev 2953)
+++ cmmlwiki/trunk/cmmlwiki/handler.py 2007-06-16 09:23:33 UTC (rev 2954)
@@ -132,12 +132,16 @@
<p>To add media to this item, please upload a media file.</p>
<form method="post" action="%s" enctype="multipart/form-data">
<div class="media">
+ Item name: <input type="text" name="itemname" size="60"/><br>
+ </div>
+ <div class="media">
<input type="hidden" name="MAX_FILE_SIZE" value="1638400"/>
File name: <input name="filename" type="file" size="60"/><br>
</div>
<div class="buttons">
<input type="submit" name="formbutton" value="Upload"/>
</div>
+
</form>
"""
repl = (self.iname, WikiURL('Edit:SaveMedia/%s' % self.iname))
@@ -149,6 +153,7 @@
def save_media (self):
fileitem = self.form['filename']
+ nameitem = self.form['itemname'].value
if (not fileitem.file) or (not fileitem.filename):
# If no file is specified, reload the input form
sys.stderr.write("handler::save_media: no file specified, reloading")
@@ -186,7 +191,8 @@
#except:
# os.remove (filename_tmp)
-
+
+ self.iname = nameitem
cmmlwiki.item.add (env, self.iname, filename, autoscan=True)
return WikiURL (self.iname)
@@ -446,3 +452,4 @@
else:
s = cmmlwiki.cortado.Cortado (self.iname, self.offset)
return HTMLPage (s)
+
Modified: cmmlwiki/trunk/cmmlwiki/htmlpage.py
===================================================================
--- cmmlwiki/trunk/cmmlwiki/htmlpage.py 2007-06-16 08:58:54 UTC (rev 2953)
+++ cmmlwiki/trunk/cmmlwiki/htmlpage.py 2007-06-16 09:23:33 UTC (rev 2954)
@@ -155,6 +155,7 @@
#<li><a href="#">site map</a></li>
s += li_menu ('Edit:Story', 'Add story')
+ s += li_menu ('Edit:AddContent', 'Add content')
s += li_menu ('Edit:Channel', 'Channel settings')
s += li_menu ('Edit:UserProfile', 'User profile')
Modified: cmmlwiki/trunk/cmmlwiki/request.py
===================================================================
--- cmmlwiki/trunk/cmmlwiki/request.py 2007-06-16 08:58:54 UTC (rev 2953)
+++ cmmlwiki/trunk/cmmlwiki/request.py 2007-06-16 09:23:33 UTC (rev 2954)
@@ -205,6 +205,8 @@
o = handler.update_field ('a_href')
elif (command == "UserProfile"):
o = HTMLPage(UserProfile(handler))
+ elif (command == "AddContent"):
+ o = handler.create_item()
else:
o = handler.error ('Invalid request %s' % (command))
More information about the commits
mailing list