Example #1
0
	def htmlElements(self, addList = None):
		if not self._htmlElements:
			h = HTML("<h1>Run data</h1>", StyleName='font-s07em')
			p = HTML('<p>Enter <em>weighed</em> data to get information, through the neural network...</p>')
			b=Button('addField', self, StyleName='link')
			b.setID(ADD_FIELD_BUTTON)

			f = FormPanel()
			_f = self.fieldPanel([self.getWidgetObj(),0,0])
			f.add(_f)
			"""
			t = TextArea(StyleName='page-textarea')
			s=Button('submit', self, StyleName='link')
			s.setID('submitButton')
			"""
			self._htmlElements = [['h', h], ['p', p], ['b', b], ['f', f]]
			for i in range(len(self._htmlElements)):
 				RootPanel().add(self._htmlElements[i][1])

		if addList:
			self._htmlElements+=addList
			for i in range(len(self._htmlElements)):
 				RootPanel().add(addList[i][1])

		return self._htmlElements
Example #2
0
class AccessionByName(Composite):
	def __init__(self):
		self.form = FormPanel()
		self.form.setAction("/Accession/searchByName/")
		
		# Because we're going to add a FileUpload widget, we'll need to set the
		# form to use the POST method, and multipart MIME encoding.
		self.form.setEncoding(FormPanel.ENCODING_MULTIPART)
		self.form.setMethod(FormPanel.METHOD_POST)
		
		# Create a panel to hold all of the form widgets.
		vpanel = VerticalPanel()
		self.form.setWidget(vpanel)
		
		self.colour_input = AutoCompleteByURLTextBox('/Accession/autoComplete')
		
		hpanel = HorizontalPanel()
		hpanel.add(HTML("Enter an ecotype name: "))
		hpanel.add(self.colour_input)

		hpanel.setSpacing(8)
		# Add a 'submit' button.
		hpanel.add(Button("Submit", self))

		vpanel.add(hpanel)
		
		# Add an event handler to the form.
		self.form.addFormHandler(self)
		
		self.setWidget(self.form)
		

	def onShow(self):
		#self.colour_input.setFocus(True)
		return
Example #3
0
class FormPanelDemo(SimplePanel):
    def __init__(self):
        SimplePanel.__init__(self)

        self.form = FormPanel(Action="http://google.com/search",
                              Target="results")

        vPanel = VerticalPanel(Spacing=5)
        hPanel = HorizontalPanel(Spacing=5)

        hPanel.add(Label("Search for:"))
        hPanel.add(TextBox(Name="q"))
        hPanel.add(Button("Submit", self))

        vPanel.add(hPanel)

        results = NamedFrame("results",
                             Width="100%",
                             Height="200px")
        vPanel.add(results)

        self.form.add(vPanel)
        self.add(self.form)


    def onClick(self, event):
        self.form.submit()
Example #4
0
    def __init__(self):
        SimplePanel.__init__(self)

        self.form = FormPanel()
        self.form.setEncoding(FormPanel.ENCODING_MULTIPART)
        self.form.setMethod(FormPanel.METHOD_POST)
        self.url =  "http://localhost/pyjamas_upload_demo"
        self.form.setAction(self.url)
        self.form.setTarget("results")

        vPanel = VerticalPanel()

        hPanel = HorizontalPanel()
        hPanel.setSpacing(5)
        hPanel.add(Label("Upload file:"))

        self.field = FileUpload()
        self.field.setName("file")
        hPanel.add(self.field)

        hPanel.add(Button("Submit", getattr(self, "onBtnClick")))
        vPanel.add(hPanel)
        
        self.simple = CheckBox("Simple mode?  ")
        #self.simple.setChecked(True)
        vPanel.add(self.simple)
        self.progress = Label('0%')

        results = NamedFrame("results")
        vPanel.add(results)
        vPanel.add(self.progress)

        self.form.add(vPanel)
        self.add(self.form)
Example #5
0
    def __init__(self):
        SimplePanel.__init__(self)

        self.form = FormPanel()
        self.form.setEncoding(FormPanel.ENCODING_MULTIPART)
        self.form.setMethod(FormPanel.METHOD_POST)
        self.form.setAction("http://nonexistent.com")
        self.form.setTarget("results")

        vPanel = VerticalPanel()

        hPanel = HorizontalPanel()
        hPanel.setSpacing(5)
        hPanel.add(Label("Upload file:"))

        self.field = FileUpload()
        self.field.setName("file")
        hPanel.add(self.field)

        hPanel.add(Button("Submit", getattr(self, "onBtnClick")))

        vPanel.add(hPanel)

        results = NamedFrame("results")
        vPanel.add(results)

        self.form.add(vPanel)
        self.add(self.form)
Example #6
0
    def __init__(self,sandbox,assignmentId,hitId,workerId):
       

        self.mturk_form = FormPanel()
        # change this to sandbox url once ready for testing                           
        self.write_data = write_data

        if sandbox:
            self.mturk_form.setAction("https://workersandbox.mturk.com/mturk/externalSubmit")                                                                                   
        else:
            self.mturk_form.setAction("http://www.mturk.com/mturk/externalSubmit")
        

        self.mturk_form.setMethod(FormPanel.METHOD_POST)
        self.assignmentId = Hidden("assignmentId")
        self.hitId = Hidden("hitId")
        self.workerId = Hidden("workerId")
        self.assignmentId.setValue(assignmentId)
        self.hitId.setValue(hitId)
        self.workerId.setValue(workerId)
        self.vp = VerticalPanel()
        self.vp.add(self.assignmentId)
        self.vp.add(self.hitId)
        self.vp.add(self.workerId)

        self.mturk_form.add(self.vp)
Example #7
0
    def __init__(self,app):
        self.app=app

        self.form = FormPanel()
        self.form.setEncoding("multipart/form-data")
        self.form.setMethod("post")
        
        self.msg = HTML("<b>Uploading</b>")
        self.table = FlexTable()
        self.table.setText(0,0, "Problem")
        self.table.setText(1,0, "Language")
        self.table.setText(2,0, "Program File")
        self.table.setText(3,0, "Program source")
        self.problem = ListBox()
        self.problem.insertItem("Detect",-1,-1)
        self.problem.setName("problem")
        self.table.setWidget(0,1,self.problem)
        
        self.lang = ListBox()
        self.lang.insertItem("Detect","",-1)
        self.lang.insertItem("C/C++","cc",-1)
        self.lang.insertItem("Java","Java",-1)
        self.lang.insertItem("Python","Python",-1)
        self.lang.setName("lang")
        self.table.setWidget(1,1,self.lang)
        self.cookie = Hidden()
        self.cookie.setName("cookie")
        self.table.setWidget(5,0,self.cookie)

        self.file = FileUpload()
        self.file.setName("file");
        self.table.setWidget(2,1,self.file)
        
        self.source = TextArea()
        self.source.setName("source")
        self.source.setWidth("600");
        self.source.setHeight("400");
        self.source.setText("""//$$problem: 1$$
//$$language: cc$$
#include <unistd.h>
#include <stdio.h>
int main() {
  int a,b;
  scanf("%d %d",&a,&b);
  printf("%d\\n",a+b);
  return 0;
}""")
        self.source.addChangeListener(self.onChange)
        self.table.setWidget(3,1,self.source)

        self.button = Button("Submit",self)
        self.table.setWidget(4,1, self.button)
        self.table.setWidget(5,1, self.msg)
        self.msg.setVisible(False)
        self.form.setWidget(self.table)
        self.form.setAction("../upload.py/submit")

        self.form.addFormHandler(self)
Example #8
0
File: Form.py Project: Afey/pyjs
    def __init__(self, svc, **kwargs):

        self.describe_listeners = []
        if kwargs.has_key('listener'):
            listener = kwargs.pop('listener')
            self.addDescribeListener(listener)

        if kwargs.has_key('data'):
            data = kwargs.pop('data')
        else:
            data = None

        FormPanel.__init__(self, **kwargs)
        self.svc = svc
        self.grid = Grid()
        self.grid.resize(0, 3)
        self.add(self.grid)
        self.describer = FormDescribeGrid(self)
        self.saver = FormSaveGrid(self)
        self.getter = FormGetGrid(self)
        self.formsetup(data)
Example #9
0
    def __init__(self, svc, **kwargs):

        self.describe_listeners = []
        if kwargs.has_key('listener'):
            listener = kwargs.pop('listener')
            self.addDescribeListener(listener)

        if kwargs.has_key('data'):
            data = kwargs.pop('data')
        else:
            data = None
        console.log(repr(data))

        FormPanel.__init__(self, **kwargs)
        self.svc = svc
        self.fieldset = FieldSet(StyleName = "inlineLabels")
        self.add(self.fieldset)
        self.describer = FormDescribePanel(self)
        self.saver = FormSavePanel(self)
        self.getter = FormGetPanel(self)
        self.formsetup(data)
Example #10
0
File: hidden.py Project: Afey/pyjs
    def __init__(self):
        SimplePanel.__init__(self)

        self.form = FormPanel()
        self.form.setAction("http://google.com/search")
        self.form.setTarget("results")

        panel = VerticalPanel()
        panel.add(Hidden("q", "python pyjamas"))
        panel.add(Button("Search", getattr(self, "onBtnClick")))

        results = NamedFrame("results")
        panel.add(results)

        self.form.add(panel)
        self.add(self.form)
    def get_upload_panel(self):
        # Create a FormPanel and point it at a service.
        self.form = FormPanel()
        self.form.setAction("/upload")

        # Add an event handler to the form.
        handler = UploadFormHandler()
        handler.form = self.form
        self.form.addFormHandler(handler)

        # Because we're going to add a FileUpload widget, we'll need to set the
        # form to use the POST method, and multipart MIME encoding.
        self.form.setEncoding(FormPanel.ENCODING_MULTIPART)
        self.form.setMethod(FormPanel.METHOD_POST)

        panel = VerticalPanel()
        panel.setSpacing(8)
        panel.setStyleName("panel") # same name as in OpenPowerSystem.css.
        self.form.setWidget(panel)

        info = HTML(r'Upload CIM RDF/XML instance file.')
        panel.add(info)

        # Create a list box for choice of profile.
        self.profiles = [("UCTE (CIM 14)", "ucte"),
                         ("CPSM (CIM13)", "cpsm"),
                         ("CDPSM (CIM 14)", "cdpsm"),
                         ("Dynamics (CIM 14)", "dynamics")]
        self.profile = ListBox(VisibleItemCount=1)
        self.profile.setName("profileType")
        for n, v in self.profiles:
            self.profile.addItem(n, v)
        panel.add(self.profile)

        # Create a FileUpload widget.
        rdfxml_file = FileUpload()
        rdfxml_file.setName("uploadFormElement")
        panel.add(rdfxml_file)

        # Add a 'submit' button.
        upload = Button("Upload", handler)
        panel.add(upload)

        return self.form
Example #12
0
class MTurkOutput:
    """                                                                               
    This class encapsulated all that is germane to sending the results to MTurk       
    thus enabling the separating of the logic from the gui                            
    """
    def __init__(self,sandbox,assignmentId,hitId,workerId):
       

        self.mturk_form = FormPanel()
        # change this to sandbox url once ready for testing                           
        self.write_data = write_data

        if sandbox:
            self.mturk_form.setAction("https://workersandbox.mturk.com/mturk/externalSubmit")                                                                                   
        else:
            self.mturk_form.setAction("http://www.mturk.com/mturk/externalSubmit")
        

        self.mturk_form.setMethod(FormPanel.METHOD_POST)
        self.assignmentId = Hidden("assignmentId")
        self.hitId = Hidden("hitId")
        self.workerId = Hidden("workerId")
        self.assignmentId.setValue(assignmentId)
        self.hitId.setValue(hitId)
        self.workerId.setValue(workerId)
        self.vp = VerticalPanel()
        self.vp.add(self.assignmentId)
        self.vp.add(self.hitId)
        self.vp.add(self.workerId)

        self.mturk_form.add(self.vp)


    def add_data(self,data):
        """                                                                           
        Adds data -- takes as argument a list of pairs                                
        """
        for k,v in data:
            tmp = Hidden(k)
            tmp.setValue(v)
            self.vp.add(tmp)
Example #13
0
    def onModuleLoad(self):
        # Create a FormPanel and point it at a service.
        self.form = FormPanel()
        self.form.setAction("/chat-service/test/")

        # Because we're going to add a FileUpload widget, we'll need to set the
        # form to use the POST method, and multipart MIME encoding.
        self.form.setEncoding(FormPanel.ENCODING_MULTIPART)
        self.form.setMethod(FormPanel.METHOD_POST)

        # Create a panel to hold all of the form widgets.
        panel = VerticalPanel()
        self.form.setWidget(panel)

        # Create a TextBox, giving it a name so that it will be submitted.
        self.tb = TextBox()
        self.tb.setName("textBoxFormElement")
        panel.add(self.tb)

        # Create a ListBox, giving it a name and some values to be associated with
        # its options.
        lb = ListBox()
        lb.setName("listBoxFormElement")
        lb.addItem("foo", "fooValue")
        lb.addItem("bar", "barValue")
        lb.addItem("baz", "bazValue")
        panel.add(lb)

        # Create a FileUpload widget.
        upload = FileUpload()
        upload.setName("uploadFormElement")
        panel.add(upload)

        # Add a 'submit' button.
        panel.add(Button("Submit", self))

        # Add an event handler to the form.
        self.form.addFormHandler(self)

        RootPanel().add(self.form)
Example #14
0
 def __init__(self,app):
     EntityTab.__init__(self, app)
     self.form = FormPanel()
     self.form.setEncoding("multipart/form-data")
     self.form.setMethod("post")
     self.table = FlexTable()
     self.table.setText(0,0,"Problem archive")
     self.file = FileUpload()
     self.file.setName("file");
     self.table.setWidget(0,1,self.file)
     self.form.setWidget(self.table)
     self.button = Button("Submit",self)
     self.table.setWidget(1,1, self.button)
     self.msg = HTML("<b>Uploading</b>")
     self.msg.setVisible(False)
     self.cookie = Hidden()
     self.cookie.setName("cookie")
     self.table.setWidget(2,0, self.cookie)
     self.table.setWidget(2,1, self.msg)
     self.form.setWidget(self.table)
     self.form.setAction("../upload.py/problem")
     self.add("Upload new problem")
Example #15
0
class FileUploadPanel(SimplePanel):
    def __init__(self):
        SimplePanel.__init__(self)

        self.form = FormPanel()
        self.form.setEncoding(FormPanel.ENCODING_MULTIPART)
        self.form.setMethod(FormPanel.METHOD_POST)
        self.url =  "http://localhost/pyjamas_upload_demo"
        self.form.setAction(self.url)
        self.form.setTarget("results")

        vPanel = VerticalPanel()

        hPanel = HorizontalPanel()
        hPanel.setSpacing(5)
        hPanel.add(Label("Upload file:"))

        self.field = FileUpload()
        self.field.setName("file")
        hPanel.add(self.field)

        hPanel.add(Button("Submit", getattr(self, "onBtnClick")))
        vPanel.add(hPanel)
        
        self.simple = CheckBox("Simple mode?  ")
        #self.simple.setChecked(True)
        vPanel.add(self.simple)
        self.progress = Label('0%')

        results = NamedFrame("results")
        vPanel.add(results)
        vPanel.add(self.progress)

        self.form.add(vPanel)
        self.add(self.form)

    def onBtnClick(self, event):
        self.progress.setText('0%')
        if self.simple.isChecked():
            self.form.submit()
        else:
            if AsyncUpload.is_old_browser():
                Window.alert("Hmmm, your browser doesn't support this.")
            else:
                el = self.field.getElement()
                files = getattr(el, 'files')
                #TODO implement loop for multiple file uploads 
                file = JS("@{{files}}[0]") #otherwise pyjs thinks it's a string?
                AsyncUpload.asyncUpload(self.url, file, self)

    def onload(self, status):
        self.progress.setText('100%')

    def onerror(self, status):
        Window.alert("oh noes we got an " + str(status))

    def onprogress(self, loaded, total):
        if self.progress.getText() == '100%': return
        progress = (loaded / total)
        p = int(progress * 100)
        self.progress.setText(str(p) + '%')
Example #16
0
class UploadProblemTab(EntityTab):
    def __init__(self,app):
        EntityTab.__init__(self, app)
        self.form = FormPanel()
        self.form.setEncoding("multipart/form-data")
        self.form.setMethod("post")
        self.table = FlexTable()
        self.table.setText(0,0,"Problem archive")
        self.file = FileUpload()
        self.file.setName("file");
        self.table.setWidget(0,1,self.file)
        self.form.setWidget(self.table)
        self.button = Button("Submit",self)
        self.table.setWidget(1,1, self.button)
        self.msg = HTML("<b>Uploading</b>")
        self.msg.setVisible(False)
        self.cookie = Hidden()
        self.cookie.setName("cookie")
        self.table.setWidget(2,0, self.cookie)
        self.table.setWidget(2,1, self.msg)
        self.form.setWidget(self.table)
        self.form.setAction("../upload.py/problem")
        self.add("Upload new problem")

    def onSubmitComplete(self,event):
        self.msg.setVisible(False)

    def onSubmit(self,evt):
        self.msg.setVisible(True)
        
    def onClick(self,evt):
        if self.app.cookie == None:
            self.app.login()
        else:
            self.cookie.setValue(self.app.cookie)
            self.form.submit()
        
    def getRoot(self):
        return self.form
Example #17
0
class FormPanelExample:
    def onModuleLoad(self):
        # Create a FormPanel and point it at a service.
        self.form = FormPanel()
        self.form.setAction("/chat-service/test/")

        # Because we're going to add a FileUpload widget, we'll need to set the
        # form to use the POST method, and multipart MIME encoding.
        self.form.setEncoding(FormPanel.ENCODING_MULTIPART)
        self.form.setMethod(FormPanel.METHOD_POST)

        # Create a panel to hold all of the form widgets.
        panel = VerticalPanel()
        self.form.setWidget(panel)

        # Create a TextBox, giving it a name so that it will be submitted.
        self.tb = TextBox()
        self.tb.setName("textBoxFormElement")
        panel.add(self.tb)

        # Create a ListBox, giving it a name and some values to be associated with
        # its options.
        lb = ListBox()
        lb.setName("listBoxFormElement")
        lb.addItem("foo", "fooValue")
        lb.addItem("bar", "barValue")
        lb.addItem("baz", "bazValue")
        panel.add(lb)

        # Create a FileUpload widget.
        upload = FileUpload()
        upload.setName("uploadFormElement")
        panel.add(upload)

        # Add a 'submit' button.
        panel.add(Button("Submit", self))

        # Add an event handler to the form.
        self.form.addFormHandler(self)

        RootPanel().add(self.form)

    def onClick(self, sender):
        self.form.submit()

    def onSubmitComplete(self, event):
        # When the form submission is successfully completed, this event is
        # fired. Assuming the service returned a response of type text/plain,
        # we can get the result text here (see the FormPanel documentation for
        # further explanation).
        Window.alert(event.getResults())

    def onSubmit(self, event):
        # This event is fired just before the form is submitted. We can take
        # this opportunity to perform validation.
        if self.tb.getText().length == 0:
            Window.alert("The text box must not be empty")
            event.setCancelled(True)
class OpenPowerSystem:
    """ Defines the main panel for OpenPowerSystem.
    """

    def __init__(self):
        """ Constructs a new OpenPowerSystem instance.
        """
        self.TEXT_WAITING = "Waiting for response..."
        self.TEXT_ERROR = "Server Error"

        self.base_panel = HorizontalPanel()

        self.tab_panel = TabPanel()
        self.tab_panel.add(self.get_upload_panel(), "Upload")
#        self.tab_panel.add(self.get_home_panel(), "OpenPowerSystem")
#        self.tab_panel.add(self.get_map_panel(), "Map")
#        self.tab_panel.add(self.get_edit_panel(), "Edit")
        self.tab_panel.selectTab(0)

        self.base_panel.add(self.tab_panel)

        RootPanel().add(self.base_panel)


    def get_home_panel(self):
        panel = VerticalPanel()

        title = HTML("""OpenPowerSystem""")
        panel.add(title)

        subtitle = HTML("""The Open Power System data repository.""")
        panel.add(subtitle)

        return panel


#    def get_map_panel(self):
#        panel = VerticalPanel()
#
#        self.map = OpenMap(Width="900px", Height="900px")
#        panel.add(self.map)
#
#        self.wms = OpenWMSLayer("OpenLayers WMS",
#            "http://labs.metacarta.com/wms/vmap0", layers="basic")
#        self.map.addLayer(self.wms)
#
#        return panel


#    def get_edit_panel(self):
#        edit_page = edit_panel.EditPanel()
#        return edit_page.panel


    def get_upload_panel(self):
        # Create a FormPanel and point it at a service.
        self.form = FormPanel()
        self.form.setAction("/upload")

        # Add an event handler to the form.
        handler = UploadFormHandler()
        handler.form = self.form
        self.form.addFormHandler(handler)

        # Because we're going to add a FileUpload widget, we'll need to set the
        # form to use the POST method, and multipart MIME encoding.
        self.form.setEncoding(FormPanel.ENCODING_MULTIPART)
        self.form.setMethod(FormPanel.METHOD_POST)

        panel = VerticalPanel()
        panel.setSpacing(8)
        panel.setStyleName("panel") # same name as in OpenPowerSystem.css.
        self.form.setWidget(panel)

        info = HTML(r'Upload CIM RDF/XML instance file.')
        panel.add(info)

        # Create a list box for choice of profile.
        self.profiles = [("UCTE (CIM 14)", "ucte"),
                         ("CPSM (CIM13)", "cpsm"),
                         ("CDPSM (CIM 14)", "cdpsm"),
                         ("Dynamics (CIM 14)", "dynamics")]
        self.profile = ListBox(VisibleItemCount=1)
        self.profile.setName("profileType")
        for n, v in self.profiles:
            self.profile.addItem(n, v)
        panel.add(self.profile)

        # Create a FileUpload widget.
        rdfxml_file = FileUpload()
        rdfxml_file.setName("uploadFormElement")
        panel.add(rdfxml_file)

        # Add a 'submit' button.
        upload = Button("Upload", handler)
        panel.add(upload)

        return self.form
Example #19
0
class OpenPowerSystem:
    """ Defines the main panel for OpenPowerSystem.
    """
    def __init__(self):
        """ Constructs a new OpenPowerSystem instance.
        """
        self.TEXT_WAITING = "Waiting for response..."
        self.TEXT_ERROR = "Server Error"

        self.base_panel = HorizontalPanel()

        self.tab_panel = TabPanel()
        self.tab_panel.add(self.get_upload_panel(), "Upload")
        #        self.tab_panel.add(self.get_home_panel(), "OpenPowerSystem")
        #        self.tab_panel.add(self.get_map_panel(), "Map")
        #        self.tab_panel.add(self.get_edit_panel(), "Edit")
        self.tab_panel.selectTab(0)

        self.base_panel.add(self.tab_panel)

        RootPanel().add(self.base_panel)

    def get_home_panel(self):
        panel = VerticalPanel()

        title = HTML("""OpenPowerSystem""")
        panel.add(title)

        subtitle = HTML("""The Open Power System data repository.""")
        panel.add(subtitle)

        return panel

#    def get_map_panel(self):
#        panel = VerticalPanel()
#
#        self.map = OpenMap(Width="900px", Height="900px")
#        panel.add(self.map)
#
#        self.wms = OpenWMSLayer("OpenLayers WMS",
#            "http://labs.metacarta.com/wms/vmap0", layers="basic")
#        self.map.addLayer(self.wms)
#
#        return panel

#    def get_edit_panel(self):
#        edit_page = edit_panel.EditPanel()
#        return edit_page.panel

    def get_upload_panel(self):
        # Create a FormPanel and point it at a service.
        self.form = FormPanel()
        self.form.setAction("/upload")

        # Add an event handler to the form.
        handler = UploadFormHandler()
        handler.form = self.form
        self.form.addFormHandler(handler)

        # Because we're going to add a FileUpload widget, we'll need to set the
        # form to use the POST method, and multipart MIME encoding.
        self.form.setEncoding(FormPanel.ENCODING_MULTIPART)
        self.form.setMethod(FormPanel.METHOD_POST)

        panel = VerticalPanel()
        panel.setSpacing(8)
        panel.setStyleName("panel")  # same name as in OpenPowerSystem.css.
        self.form.setWidget(panel)

        info = HTML(r'Upload CIM RDF/XML instance file.')
        panel.add(info)

        # Create a list box for choice of profile.
        self.profiles = [("UCTE (CIM 14)", "ucte"), ("CPSM (CIM13)", "cpsm"),
                         ("CDPSM (CIM 14)", "cdpsm"),
                         ("Dynamics (CIM 14)", "dynamics")]
        self.profile = ListBox(VisibleItemCount=1)
        self.profile.setName("profileType")
        for n, v in self.profiles:
            self.profile.addItem(n, v)
        panel.add(self.profile)

        # Create a FileUpload widget.
        rdfxml_file = FileUpload()
        rdfxml_file.setName("uploadFormElement")
        panel.add(rdfxml_file)

        # Add a 'submit' button.
        upload = Button("Upload", handler)
        panel.add(upload)

        return self.form