# Path: exe/webui/common.py
# def newId():
# def docType():
# def header(style=u'default'):
# def footer():
# def hiddenField(name, value=u""):
# def textInput(name, value=u"", size=40, disabled=u"", **kwargs):
# def textArea(name, value="", disabled="", cols="80", rows="8"):
# def richTextArea(name, value="", width="100%", height=100, package=None):
# def image(name, value, width="", height="", alt=None):
# def flash(src, width, height, id_=None, params=None, **kwparams):
# def flashMovie(movie, width, height, resourcesDir='', autoplay='false'):
# def submitButton(name, value, enabled=True, **kwargs):
# def button(name, value, enabled=True, **kwargs):
# def feedbackButton(name, value=None, enabled=True, **kwparams):
# def submitImage(action, object_, imageFile, title=u"", isChanged=1):
# def insertSymbol(name, image, title, string, text ='', num=0):
# def confirmThenSubmitImage(message, action, object_, imageFile, 
#                            title=u"", isChanged=1):
# def option(name, checked, value):
# def checkbox(name, checked, value="", title="", instruction=""):
# def elementInstruc(instruc, imageFile="help.gif", label=None):
# def formField(type_, package, caption, action, object_='', instruction='', \
#         *args, **kwargs):
# def select(action, object_='', options=[], selection=None):
# def editModeHeading(text):
# def removeInternalLinks(html, anchor_name=""):
# def removeInternalLinkNodes(html):
# def findLinkedField(package, exe_node_path, anchor_name):
# def findLinkedNode(package, exe_node_path, anchor_name, check_fields=True):
# def getAnchorNameFromLinkName(link_name):
# def renderInternalLinkNodeFilenames(package, html):
# def requestHasCancel(request):


import sys
import logging
from exe.webui import common
from exe.webui.renderable import Renderable
from exe.engine.idevice   import Idevice
            from traceback import format_tb
                html += self.renderEdit(style)
            elif self.mode == Block.View:
                html += self.renderView(style)
            elif self.mode == Block.Preview:
                if self.idevice.lastIdevice:
                    html += u'<a name="currentBlock"></a>\n'
                html += self.renderPreview(style)
        except Exception, e:
            log.error('%s:\n%s' % (str(e), '\n'.join(format_tb(sys.exc_traceback))))
            html += broken % str(e)
            if self.mode == Block.Edit:
                html += self.renderEditButtons()
            if self.mode == Block.Preview:
                html += self.renderViewButtons()
        return html


    def renderEdit(self, style):
        """
        Returns an XHTML string with the form element for editing this block
        """
        log.error(u"renderEdit called directly")
        return u"ERROR Block.renderEdit called directly"


    def renderEditButtons(self, undo=True):
        """
        Returns an XHTML string for the edit buttons
        """
        

# Path: exe/webui/common.py
# def newId():
# def docType():
# def header(style=u'default'):
# def footer():
# def hiddenField(name, value=u""):
# def textInput(name, value=u"", size=40, disabled=u"", **kwargs):
# def textArea(name, value="", disabled="", cols="80", rows="8"):
# def richTextArea(name, value="", width="100%", height=100, package=None):
# def image(name, value, width="", height="", alt=None):
# def flash(src, width, height, id_=None, params=None, **kwparams):
# def flashMovie(movie, width, height, resourcesDir='', autoplay='false'):
# def submitButton(name, value, enabled=True, **kwargs):
# def button(name, value, enabled=True, **kwargs):
# def feedbackButton(name, value=None, enabled=True, **kwparams):
# def submitImage(action, object_, imageFile, title=u"", isChanged=1):
# def insertSymbol(name, image, title, string, text ='', num=0):
# def confirmThenSubmitImage(message, action, object_, imageFile, 
#                            title=u"", isChanged=1):
# def option(name, checked, value):
# def checkbox(name, checked, value="", title="", instruction=""):
# def elementInstruc(instruc, imageFile="help.gif", label=None):
# def formField(type_, package, caption, action, object_='', instruction='', \
#         *args, **kwargs):
# def select(action, object_='', options=[], selection=None):
# def editModeHeading(text):
# def removeInternalLinks(html, anchor_name=""):
# def removeInternalLinkNodes(html):
# def findLinkedField(package, exe_node_path, anchor_name):
# def findLinkedNode(package, exe_node_path, anchor_name, check_fields=True):
# def getAnchorNameFromLinkName(link_name):
# def renderInternalLinkNodeFilenames(package, html):
# def requestHasCancel(request):


# Path: exe/webui/block.py
import sys
import logging
from exe.webui import common
from exe.webui.renderable import Renderable
from exe.engine.idevice   import Idevice
            from traceback import format_tb

                html += self.renderEdit(style)
            elif self.mode == Block.View:
                html += self.renderView(style)
            elif self.mode == Block.Preview:
                if self.idevice.lastIdevice:
                    html += u'<a name="currentBlock"></a>\n'
                html += self.renderPreview(style)
        except Exception, e:
            log.error('%s:\n%s' % (str(e), '\n'.join(format_tb(sys.exc_traceback))))
            html += broken % str(e)
            if self.mode == Block.Edit:
                html += self.renderEditButtons()
            if self.mode == Block.Preview:
                html += self.renderViewButtons()
        return html


    def renderEdit(self, style):
        """
        Returns an XHTML string with the form element for editing this block
        """
        log.error(u"renderEdit called directly")
        return u"ERROR Block.renderEdit called directly"


    def renderEditButtons(self, undo=True):
        """
        Returns an XHTML string for the edit buttons
        """
        

        html  = common.submitImage(u"done", self.id, 