SF.net SVN: morphix: [2585] trunk/morphixlivekiosk/scripts/mbuild

[email protected] Fri, 02 Nov 2007 15:59:52 -0700
Newsgroups gmane.linux.morphix.cvs
Message-ID <[email protected]>
Revision: 2585
          http://morphix.svn.sourceforge.net/morphix/?rev=2585&view=rev
Author:   gandalfar
Date:     2007-11-02 15:59:50 -0700 (Fri, 02 Nov 2007)

Log Message:
-----------
added the images part

Modified Paths:
--------------
    trunk/morphixlivekiosk/scripts/mbuild/templates/index.html
    trunk/morphixlivekiosk/scripts/mbuild/web/views.py

Modified: trunk/morphixlivekiosk/scripts/mbuild/templates/index.html
===================================================================
--- trunk/morphixlivekiosk/scripts/mbuild/templates/index.html	2007-11-02 22:38:32 UTC (rev 2584)
+++ trunk/morphixlivekiosk/scripts/mbuild/templates/index.html	2007-11-02 22:59:50 UTC (rev 2585)
@@ -1,6 +1,6 @@
 <h1>Custom Built Kiosk LiveCD</h1>
 
-<form action="." method="post" accept-charset="utf-8">
+<form enctype="multipart/form-data" method="post" action=".">
   {{ form.as_p }}
 
   <p><input type="submit" value="Continue &rarr;"></p>

Modified: trunk/morphixlivekiosk/scripts/mbuild/web/views.py
===================================================================
--- trunk/morphixlivekiosk/scripts/mbuild/web/views.py	2007-11-02 22:38:32 UTC (rev 2584)
+++ trunk/morphixlivekiosk/scripts/mbuild/web/views.py	2007-11-02 22:59:50 UTC (rev 2585)
@@ -9,9 +9,9 @@
 
 def index(request):
   class BuildForm(forms.Form):
-    brand_name = forms.CharField(max_length=150, required=True)
-    graphics = forms.ImageField(required=False)
-    homepage = forms.CharField(max_length=150, required=True)
+    brand_name = forms.CharField(max_length=150, required=True, label="What Brand would you like to use?")
+    graphics = forms.ImageField(required=False, label="Graphics file (1024x768, 32pps, any format works best)")
+    homepage = forms.CharField(max_length=150, required=True, label="Desired homepage")
     nav_bar = forms.BooleanField(widget=forms.RadioSelect(choices=[(True, 'Yes'), (False, 'No')]),
             initial=True, label="Should the Navigation Bar be visable?")
     dhcp = forms.BooleanField(widget=forms.RadioSelect(choices=[(True, 'Yes'), (False, 'No')]),
@@ -22,12 +22,19 @@
             label="Include Java?", initial=False)
 
   if request.POST:
-    form = BuildForm(request.POST.copy())
+    form = BuildForm(request.POST, request.FILES)
     if form.is_valid():
       dt = datetime.datetime.now()
       uniq = time.mktime(dt.timetuple()) + dt.microsecond/1e6
       cd = form.cleaned_data
       
+      #save the image file
+      if cd.get('graphics'):
+        f = file('incoming/%s' % cd['graphics'].filename, 'wb')
+        f.write(cd['graphics'].content)
+        f.close()
+        cd['graphics'] = cd['graphics'].filename
+      
       root = ET.Element("LIVECD")
       for v in cd:
         sub = ET.SubElement(root, v)


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/