# 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 logging
from twisted.web.resource      import Resource
from exe.webui                 import common
from exe.webui.renderable      import RenderableResource
                                   (_(u"Disable All Internal Linking"), "disable_all")]
        html += common.formField('select', this_package, _(u"Internal Linking (for Web Site Exports only)"),
                                 'internalAnchors', 
                                 '', # TODO: Instructions
                                 options = internal_anchor_options,
                                 selection = self.config.internalAnchors)

        html += u"<div id=\"editorButtons\"> \n"     
        html += u"<br/>" 
        html += common.button("ok", _("OK"), enabled=True,
                _class="button",
                onClick="setLocaleAndAnchors(document.forms.contentForm.locale.value,"
                    "document.forms.contentForm.internalAnchors.value)")
        html += common.button("cancel", _("Cancel"), enabled=True,
                _class="button", onClick="window.close()")
        html += u"</div>\n"
        html += u"</div>\n"
        html += u"<br/></form>\n"
        html += u"</body>\n"
        html += u"</html>\n"
        return html.encode('utf8')


    def render_POST(self, request):
        """
        function replaced by nevow_clientToServerEvent to avoid POST message
        """
        log.debug("render_POST " + repr(request.args))
        
        # should not be invoked, but if it is... refresh

# 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/preferencespage.py
import logging
from twisted.web.resource      import Resource
from exe.webui                 import common
from exe.webui.renderable      import RenderableResource

                                   (_(u"Disable All Internal Linking"), "disable_all")]
        html += common.formField('select', this_package, _(u"Internal Linking (for Web Site Exports only)"),
                                 'internalAnchors', 
                                 '', # TODO: Instructions
                                 options = internal_anchor_options,
                                 selection = self.config.internalAnchors)

        html += u"<div id=\"editorButtons\"> \n"     
        html += u"<br/>" 
        html += common.button("ok", _("OK"), enabled=True,
                _class="button",
                onClick="setLocaleAndAnchors(document.forms.contentForm.locale.value,"
                    "document.forms.contentForm.internalAnchors.value)")
        html += common.button("cancel", _("Cancel"), enabled=True,
                _class="button", onClick="window.close()")
        html += u"</div>\n"
        html += u"</div>\n"
        html += u"<br/></form>\n"
        html += u"</body>\n"
        html += u"</html>\n"
        return html.encode('utf8')


    def render_POST(self, request):
        """
        function replaced by nevow_clientToServerEvent to avoid POST message
        """
        log.debug("render_POST " + repr(request.args))
        
        # should not be invoked, but if it is... refresh

        html  = common.docType()