本文整理汇总了Python中exe.webui.common.docType函数的典型用法代码示例。如果您正苦于以下问题:Python docType函数的具体用法?Python docType怎么用?Python docType使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了docType函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __renderHeader
def __renderHeader(self):
#TinyMCE lang (user preference)
myPreferencesPage = preferencespage.PreferencesPage(self)
"""Generates the header for AuthoringPage"""
html = common.docType()
#################################################################################
#################################################################################
html += u'<html xmlns="http://www.w3.org/1999/xhtml" lang="'+myPreferencesPage.getSelectedLanguage()+'">\n'
html += u'<head>\n'
html += u'<style type="text/css">\n'
html += u'@import url(/css/exe.css);\n'
html += u'@import url(/style/base.css);\n'
html += u'@import url(/style/%s/content.css);\n' % self.package.style
html += u'</style>\n'
if G.application.config.assumeMediaPlugins:
html += u"<script type=\"text/javascript\">var exe_assume_media_plugins = true;</script>\n"
html += u'<script type="text/javascript" src="/scripts/common.js">'
html += u'</script>\n'
html += u'<script type="text/javascript" '
html += u'src="/scripts/tinymce/jscripts/tiny_mce/tiny_mce.js">'
html += u'</script>\n'
html += u'<script type="text/javascript" src="/scripts/tiny_mce_settings.js">'
html += u'</script>\n'
html += u'<script type="text/javascript" src="/scripts/libot_drag.js">'
html += u'</script>\n'
html += u'<title>"+_("eXe : elearning XHTML editor")+"</title>\n'
html += u'<meta http-equiv="content-type" content="text/html; '
html += u' charset=UTF-8" />\n'
html += u'</head>\n'
return html
示例2: render_POST
def render_POST(self, request):
"""
function replaced by nevow_clientToServerEvent to avoid POST message
"""
log.debug("render_POST " + repr(request.args))
# invoked if enter is pressed in text field
path = ""
if "path" in request.args:
path = request.args["path"][0]
if "pages" in request.args:
pages = request.args["pages"][0]
html = common.docType()
html += u'<html xmlns="http://www.w3.org/1999/xhtml">\n'
html += u"<head>\n"
html += u"""<script language="javascript" type="text/javascript">
function doImportPDF(path, pages) {
opener.nevow_clientToServerEvent('importPDF', this, '', path);
window.close();
}
</script>"""
html += u"</head>"
html += u"<body onload=\"doImportPDF('%s', '%s')\";\n" % (path, pages)
html += u"</body>\n"
html += u"</html>\n"
return html.encode("utf8")
示例3: __renderHeader
def __renderHeader(self):
#TinyMCE lang (user preference)
myPreferencesPage = self.webServer.preferences
"""Generates the header for AuthoringPage"""
html = common.docType()
#################################################################################
#################################################################################
html += u'<html xmlns="http://www.w3.org/1999/xhtml" lang="'+myPreferencesPage.getSelectedLanguage()+'">\n'
html += u'<head>\n'
html += u"<link rel=\"stylesheet\" type=\"text/css\" href=\"/css/exe.css\" />"
html += u"<link rel=\"stylesheet\" type=\"text/css\" href=\"/style/base.css\" />"
html += u"<link rel=\"stylesheet\" type=\"text/css\" href=\"/style/%s/content.css\" />" % self.package.style
if G.application.config.assumeMediaPlugins:
html += u"<script type=\"text/javascript\">var exe_assume_media_plugins = true;</script>\n"
#JR: anado una variable con el estilo
estilo = u'/style/%s/content.css' % self.package.style
html += u"<script type=\"text/javascript\">var exe_style = '%s';</script>\n" % estilo
html += u"<script type=\"text/javascript\">var exe_package_name='"+self.package.name+"';</script>\n"
html += u'<script type="text/javascript" src="/scripts/authoring.js"></script>\n'
html += u'<script type="text/javascript" src="/scripts/exe_lightbox.js"></script>\n'
html += u'<script type="text/javascript" src="/scripts/common.js">'
html += u'</script>\n'
html += '<script type="text/javascript">document.write(unescape("%3Cscript src=\'" + eXeLearning_settings.wysiwyg_path + "\' type=\'text/javascript\'%3E%3C/script%3E"));</script>';
html += '<script type="text/javascript">document.write(unescape("%3Cscript src=\'" + eXeLearning_settings.wysiwyg_settings_path + "\' type=\'text/javascript\'%3E%3C/script%3E"));</script>';
html += u'<script type="text/javascript" src="/scripts/libot_drag.js">'
html += u'</script>\n'
html += u'<title>"+_("eXe : elearning XHTML editor")+"</title>\n'
html += u'<meta http-equiv="content-type" content="text/html; '
html += u' charset=UTF-8" />\n'
html += u'</head>\n'
return html
示例4: render_GET
def render_GET(self, request):
"""Render the preferences"""
log.debug("render_GET")
# Rendering
html = common.docType()
html += u'<html xmlns="http://www.w3.org/1999/xhtml">\n'
html += u"<head>\n"
html += u'<style type="text/css">\n'
html += u"@import url(/css/exe.css);\n"
html += u"@import url(/style/base.css);\n"
html += u"@import url(/style/standardwhite/content.css);</style>\n"
html += u"""<script language="javascript" type="text/javascript">
function doImportPDF(path, pages) {
opener.nevow_clientToServerEvent('importPDF', this, '', path,
pages);
window.close();
}
</script>"""
html += '<script src="scripts/common.js" language="JavaScript">'
html += "</script>\n"
html += u"<title>" + _("Import PDF") + "</title>\n"
html += u'<meta http-equiv="content-type" content="text/html; '
html += u' charset=UTF-8"></meta>\n'
html += u"</head>\n"
html += u"<body>\n"
html += u'<div id="main"> \n'
html += u'<form method="post" action="" '
html += u'id="contentForm" >'
# package not needed for the preferences, only for rich-text fields:
this_package = None
html += common.formField(
"textInput", this_package, _("Path to PDF"), "path", instruction=_("Enter path to pdf you want to import")
)
html += u'<input type="button" onclick="addPdf(\'\')"'
html += u'value="%s"/>\n' % _(u"Add file")
html += common.formField(
"textInput",
this_package,
_("Pages to import"),
"pages",
instruction=_("Comma-separated list of pages to import"),
)
html += u'<div id="editorButtons"> \n'
html += u"<br/>"
html += common.button(
"ok",
_("OK"),
enabled=True,
_class="button",
onClick="doImportPDF(document.forms.contentForm.path.value," + "document.forms.contentForm.pages.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")
示例5: render
def render(self):
"""
Returns an XHTML string rendering this page.
"""
html = common.docType()
html += u"<html xmlns=\"http://www.w3.org/1999/xhtml\">\n"
html += u"<head>\n"
html += u"<title>"+_("eXe")+"</title>\n"
html += u"<meta http-equiv=\"Content-Type\" content=\"text/html; "
html += u" charset=utf-8\" />\n";
html += u"<!-- Created using eXe: http://exelearning.org -->\n"
html += u"<style type=\"text/css\">\n"
html += u"@import url(base.css);\n"
html += u"@import url(content.css);\n"
html += u"</style>\n"
html += u'<script type="text/javascript" src="common.js"></script>\n'
html += u"</head>\n"
if self.scormType == 'commoncartridge':
html += u"<body>"
else:
html += u"<script type=\"text/javascript\" "
html += u"src=\"APIWrapper.js\"></script>\n"
html += u"<script type=\"text/javascript\" "
html += u"src=\"SCOFunctions.js\"></script>\n"
html += u'<body onload="loadPage()" '
html += u'onunload="unloadPage()">'
html += u"<div id=\"outer\">\n"
html += u"<div id=\"main\">\n"
html += u"<div id=\"nodeDecoration\">\n"
html += u"<p id=\"nodeTitle\">\n"
html += escape(self.node.titleLong)
html += u'</p></div>\n'
for idevice in self.node.idevices:
html += u'<div class="%s" id="id%s">\n' % (idevice.klass,
idevice.id)
block = g_blockFactory.createBlock(None, idevice)
if not block:
log.critical("Unable to render iDevice.")
raise Error("Unable to render iDevice.")
if hasattr(idevice, "isQuiz"):
html += block.renderJavascriptForScorm()
html += self.processInternalLinks(
block.renderView(self.node.package.style))
html += u'</div>\n' # iDevice div
html += u"</div>\n"
html += u"</div>\n"
if self.node.package.scolinks:
html += u'<div class="previousnext">'
html += u'<a class="previouslink" '
html += u'href="javascript: goBack();">%s</a> | <a class="nextlink" ' % _('Previous')
html += u'href="javascript: goForward();">%s</a>' % _('Next')
html += u'</div>'
html += self.renderLicense()
html += self.renderFooter()
html += u"</body></html>\n"
html = html.encode('utf8')
return html
示例6: render_GET
def render_GET(self, request):
"""Render the preferences"""
log.debug("render_GET")
# Rendering
html = common.docType()
html += u"<html xmlns=\"http://www.w3.org/1999/xhtml\">\n"
html += u"<head>\n"
html += u"<style type=\"text/css\">\n"
html += u"@import url(/css/exe.css);\n"
html += u'@import url(/style/base.css);\n'
html += u"@import url(/style/standardwhite/content.css);</style>\n"
html += u'''<script language="javascript" type="text/javascript">
function setLocaleAndAnchors(l,anchors) {
parent.nevow_clientToServerEvent('setLocale', this, '', l)
parent.nevow_clientToServerEvent('setInternalAnchors', this, '', anchors)
parent.Ext.getCmp('preferenceswin').close()
}
</script>'''
html += u"<title>"+_("eXe : elearning XHTML editor")+"</title>\n"
html += u"<meta http-equiv=\"content-type\" content=\"text/html; "
html += u" charset=UTF-8\"></meta>\n";
html += u"</head>\n"
html += u"<body>\n"
html += u"<div id=\"main\"> \n"
html += u"<form method=\"post\" action=\"\" "
html += u"id=\"contentForm\" >"
# package not needed for the preferences, only for rich-text fields:
this_package = None
html += common.formField('select', this_package, _(u"Select Language"),
'locale',
options = self.localeNames,
selection = self.config.locale)
internal_anchor_options = [(_(u"Enable All Internal Linking"), "enable_all"),
(_(u"Disable Auto-Top Internal Linking"), "disable_autotop"),
(_(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="parent.Ext.getCmp('preferenceswin').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')
示例7: render
def render(self):
"""
Returns an XHTML string rendering this page.
"""
html = common.docType()
#html += u"<html xmlns=\"http://www.w3.org/1999/xhtml\">\n"
lenguaje = G.application.config.locale
html += u"<html lang=\"" + lenguaje + "\" xml:lang=\"" + lenguaje + "\" xmlns=\"http://www.w3.org/1999/xhtml\">\n"
html += u"<head>\n"
html += u"<meta http-equiv=\"Content-type\" content=\"text/html; "
html += u" charset=utf-8\" />\n";
html += u"<title>"+_("eXe")+"</title>\n"
html += u"<style type=\"text/css\">\n"
html += u"@import url(base.css);\n"
html += u"@import url(content.css);\n"
html += u"</style>\n"
html += u'<script type="text/javascript" src="common.js"></script>\n'
html += u"</head>\n"
html += u"<body>\n"
html += u"<div id=\"outer\">\n"
html += u"<div id=\"main\">\n"
html += u"<div id=\"nodeDecoration\">\n"
html += u'<h1 id=\"nodeTitle\">\n'
html += escape(self.node.titleLong)
html += u'</h1>\n'
html += u"</div>\n"
for idevice in self.node.idevices:
html += u'<div class="%s" id="id%s">\n' % (idevice.klass,
idevice.id)
block = g_blockFactory.createBlock(None, idevice)
if not block:
log.critical("Unable to render iDevice.")
raise Error("Unable to render iDevice.")
if hasattr(idevice, "isQuiz"):
html += block.renderJavascriptForWeb()
if idevice.title != "Forum Discussion":
html += self.processInternalLinks(
block.renderView(self.node.package.style))
html += u'</div>\n' # iDevice div
html += u"</div>\n"
html += self.renderLicense()
html += self.renderFooter()
html += u"</div>\n"
html += u"</body></html>\n"
html = html.encode('utf8')
# JR: Eliminamos los atributos de las ecuaciones
aux = re.compile("exe_math_latex=\"[^\"]*\"")
html = aux.sub("", html)
aux = re.compile("exe_math_size=\"[^\"]*\"")
html = aux.sub("", html)
#JR: Cambio el & en los enlaces del glosario
html = html.replace("&concept", "&concept")
#JR: Cambiamos las anclas por enlaces a archivos
html = html.replace('href="#', 'href="')
return html
示例8: render_GET
def render_GET(self, request):
"""Render the preferences"""
log.debug("render_GET")
# Rendering
html = common.docType()
html += u"<html xmlns=\"http://www.w3.org/1999/xhtml\">\n"
html += u"<head>\n"
html += u"<style type=\"text/css\">\n"
html += u"@import url(/css/exe.css);\n"
html += u'@import url(/style/base.css);\n'
html += u"@import url(/style/standardwhite/content.css);</style>\n"
html += u'<script type="text/javascript" src="/scripts/common.js">'
html += u'</script>\n'
html += u'''<script language="javascript" type="text/javascript">
function importXliff(from_source) {
parent.nevow_clientToServerEvent('mergeXliffPackage', this, '', '%s', from_source);
parent.Ext.getCmp("xliffimportwin").close();
}
</script>''' % quote(request.args['path'][0])
html += u"<title>"+_("eXe : elearning XHTML editor")+"</title>\n"
html += u"<meta http-equiv=\"content-type\" content=\"text/html; "
html += u" charset=UTF-8\"></meta>\n";
html += u"</head>\n"
html += u"<body>\n"
html += u"<div id=\"main\"> \n"
html += u"<p> </p>\n"
html += u"<form method=\"post\" action=\"\" "
html += u"id=\"contentForm\" >"
# package not needed for the preferences, only for rich-text fields:
this_package = None
html += common.formField('checkbox', this_package, _(u"Import from source language"),
'from_source',
name = 'from_source',
checked = False,
title = None,
instruction = _(u"If you choose this option, \
the import process will take the texts from source language instead of target \
language."))
html += u"<div id=\"editorButtons\"> \n"
html += u"<br/>"
html += common.button("ok", _("OK"), enabled=True,
_class="button",
onClick="importXliff(document.forms.contentForm.from_source.checked \
)")
html += common.button("cancel", _("Cancel"), enabled=True,
_class="button", onClick="parent.Ext.getCmp('xliffimportwin').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')
示例9: render
def render(self):
"""
Returns an XHTML string rendering this page.
"""
html = common.docType()
html += u"<html xmlns=\"http://www.w3.org/1999/xhtml\">\n"
html += u"<head>\n"
html += u"<meta http-equiv=\"Content-type\" content=\"text/html; "
html += u" charset=utf-8\" />\n";
html += u"<title>"+_("eXe")+"</title>\n"
html += u"<style type=\"text/css\">\n"
html += u"@import url(base.css);\n"
html += u"@import url(content.css);\n"
html += u"</style>\n"
html += u'<script type="text/javascript" src="common.js"></script>\n'
#modification by lernmodule.net
html += u'<script type="text/javascript" src="lernmodule_net.js"></script>\n'
#end modification
html += u"</head>\n"
html += u"<body>\n"
html += u"<div id=\"outer\">\n"
html += u"<div id=\"main\">\n"
html += u"<div id=\"nodeDecoration\">\n"
html += u'<p id=\"nodeTitle\">\n'
html += escape(self.node.titleLong)
html += u'</p>\n'
html += u"</div>\n"
for idevice in self.node.idevices:
html += u'<div class="%s" id="id%s">\n' % (idevice.klass,
idevice.id)
block = g_blockFactory.createBlock(None, idevice)
if not block:
log.critical("Unable to render iDevice.")
raise Error("Unable to render iDevice.")
if hasattr(idevice, "isQuiz"):
html += block.renderJavascriptForWeb()
if idevice.title != "Forum Discussion":
html += self.processInternalLinks(
block.renderView(self.node.package.style))
html += u'</div>\n' # iDevice div
html += u"</div>\n"
html += self.renderLicense()
html += self.renderFooter()
#modification by lernmodule.net
html += u"<script type=\"text/javascript\" language=\"javascript\">doStart();</script></body></html>\n"
#end modification
html += u"</div>\n"
html += u"</body></html>\n"
html = html.encode('utf8')
return html
示例10: render_POST
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()
html += u"<html xmlns=\"http://www.w3.org/1999/xhtml\">\n"
html += u"<head></head>\n"
html += u"<body onload=\"opener.location.reload(); "
html += u"self.close();\"></body>\n"
html += u"</html>\n"
return html.encode('utf8')
示例11: render
def render(self):
"""
Returns an XHTML string rendering this page.
"""
dT = common.getExportDocType()
lb = "\n" #Line breaks
sectionTag = "div"
articleTag = "div"
headerTag = "div"
if dT == "HTML5":
sectionTag = "section"
articleTag = "article"
headerTag = "header"
html = common.docType()
lenguaje = G.application.config.locale
style = G.application.config.styleStore.getStyle(self.node.package.style)
if self.node.package.dublinCore.language!="":
lenguaje = self.node.package.dublinCore.language
html += u"<html lang=\"" + lenguaje + "\" xml:lang=\"" + lenguaje + "\" xmlns=\"http://www.w3.org/1999/xhtml\">"+lb
html += u"<head>"+lb
html += u"<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\" />"+lb
html += u"<title>"
if self.node.id=='0':
if self.node.package.title!='':
html += escape(self.node.package.title)
else:
html += escape(self.node.titleLong)
else:
if self.node.package.title!='':
html += escape(self.node.titleLong)+" | "+escape(self.node.package.title)
else:
html += escape(self.node.titleLong)
html += u" </title>"+lb
if dT != "HTML5" and self.node.package.dublinCore.language!="":
html += '<meta http-equiv="content-language" content="'+lenguaje+'" />'+lb
if self.node.package.author!="":
html += '<meta name="author" content="'+self.node.package.author+'" />'+lb
html += '<meta name="generator" content="eXeLearning '+release+' - exelearning.net" />'+lb
if self.node.id=='0':
if self.node.package.description!="":
html += '<meta name="description" content="'+self.node.package.description+'" />'+lb
html += u"<link rel=\"stylesheet\" type=\"text/css\" href=\"base.css\" />"+lb
if common.hasWikipediaIdevice(self.node):
html += u"<link rel=\"stylesheet\" type=\"text/css\" href=\"exe_wikipedia.css\" />"+lb
if common.hasGalleryIdevice(self.node):
html += u"<link rel=\"stylesheet\" type=\"text/css\" href=\"exe_lightbox.css\" />"+lb
html += u"<link rel=\"stylesheet\" type=\"text/css\" href=\"content.css\" />"+lb
if dT == "HTML5" or common.nodeHasMediaelement(self.node):
html += u'<!--[if lt IE 9]><script type="text/javascript" src="exe_html5.js"></script><![endif]-->'+lb
# jQuery
if style.hasValidConfig:
if style.get_jquery() == True:
html += u'<script type="text/javascript" src="exe_jquery.js"></script>'+lb
else:
html += u'<script type="text/javascript" src="'+style.get_jquery()+'"></script>'+lb
else:
html += u'<script type="text/javascript" src="exe_jquery.js"></script>'+lb
if common.hasGalleryIdevice(self.node):
html += u'<script type="text/javascript" src="exe_lightbox.js"></script>'+lb
html += common.getJavaScriptStrings()+lb
html += u'<script type="text/javascript" src="common.js"></script>'+lb
if common.hasMagnifier(self.node):
html += u'<script type="text/javascript" src="mojomagnify.js"></script>'+lb
if self.scormType == 'commoncartridge':
if style.hasValidConfig:
html += style.get_extra_head()
html += u"</head>"+lb
html += u"<body class=\"exe-scorm\">"
else:
html += u"<script type=\"text/javascript\" src=\"SCORM_API_wrapper.js\"></script>"+lb
html += u"<script type=\"text/javascript\" src=\"SCOFunctions.js\"></script>"+lb
if style.hasValidConfig:
html += style.get_extra_head()
html += u"</head>"+lb
html += u'<body class=\"exe-scorm\" onload="loadPage()" '
html += u'onunload="unloadPage()">'
html += u'<script type="text/javascript">document.body.className+=" js"</script>'+lb
html += u"<div id=\"outer\">"+lb
html += u"<"+sectionTag+" id=\"main\">"+lb
html += u"<"+headerTag+" id=\"nodeDecoration\">"
html += u"<h1 id=\"nodeTitle\">"
html += escape(self.node.titleLong)
html += u'</h1></'+headerTag+'>'+lb
for idevice in self.node.idevices:
if idevice.klass != 'NotaIdevice':
e=" em_iDevice"
if unicode(idevice.emphasis)=='0':
e=""
html += u'<'+articleTag+' class="iDevice_wrapper %s%s" id="id%s">%s' % (idevice.klass, e, idevice.id, lb)
block = g_blockFactory.createBlock(None, idevice)
if not block:
log.critical("Unable to render iDevice.")
raise Error("Unable to render iDevice.")
if hasattr(idevice, "isQuiz"):
html += block.renderJavascriptForScorm()
html += self.processInternalLinks(
block.renderView(self.node.package.style))
#.........这里部分代码省略.........
示例12: render
def render(self, pages):
"""
Returns an XHTML string rendering this page.
"""
old_dT = common.getExportDocType()
common.setExportDocType('HTML5')
dT = common.getExportDocType()
lb = "\n" # Line breaks
sectionTag = "div"
articleTag = "div"
headerTag = "div"
if dT == "HTML5":
sectionTag = "section"
articleTag = "article"
headerTag = "header"
html = common.docType()
lenguaje = G.application.config.locale
if self.node.package.lang != "":
lenguaje = self.node.package.lang
html += u"<html lang=\"" + lenguaje + "\" xml:lang=\"" + lenguaje + "\" xmlns=\"http://www.w3.org/1999/xhtml\">" + lb
html += u"<head>" + lb
html += u"<title>"
if self.node.id == '0':
if self.node.package.title != '':
html += escape(self.node.package.title)
else:
html += escape(self.node.titleLong)
else:
if self.node.package.title != '':
html += escape(self.node.titleLong) + " | " + escape(self.node.package.title)
else:
html += escape(self.node.titleLong)
html += u" </title>" + lb
html += u'<meta charset="utf-8" />' + lb
if dT != "HTML5" and self.node.package.lang != "":
html += '<meta http-equiv="content-language" content="' + lenguaje + '" />' + lb
if self.node.package.author != "":
html += '<meta name="author" content="' + escape(self.node.package.author, True) + '" />' + lb
html += common.getLicenseMetadata(self.node.package.license)
html += '<meta name="generator" content="eXeLearning ' + release + ' - exelearning.net" />' + lb
if self.node.id == '0':
if self.node.package.description != "":
html += '<meta name="description" content="' + escape(self.node.package.description, True) + '" />' + lb
html += u"<link rel=\"stylesheet\" type=\"text/css\" href=\"base.css\" />" + lb
if common.hasWikipediaIdevice(self.node):
html += u"<link rel=\"stylesheet\" type=\"text/css\" href=\"exe_wikipedia.css\" />" + lb
if common.hasGalleryIdevice(self.node):
html += u"<link rel=\"stylesheet\" type=\"text/css\" href=\"exe_lightbox.css\" />" + lb
if common.hasFX(self.node):
html += u"<link rel=\"stylesheet\" type=\"text/css\" href=\"exe_effects.css\" />" + lb
if common.hasSH(self.node):
html += u"<link rel=\"stylesheet\" type=\"text/css\" href=\"exe_highlighter.css\" />" + lb
if common.hasGames(self.node):
html += u"<link rel=\"stylesheet\" type=\"text/css\" href=\"exe_games.css\" />" + lb
if common.hasABCMusic(self.node):
html += u"<link rel=\"stylesheet\" type=\"text/css\" href=\"exe_abcmusic.css\" />" + lb
html += u"<link rel=\"stylesheet\" type=\"text/css\" href=\"content.css\" />" + lb
if dT == "HTML5" or common.nodeHasMediaelement(self.node):
html += u'<!--[if lt IE 9]><script type="text/javascript" src="exe_html5.js"></script><![endif]-->' + lb
style = G.application.config.styleStore.getStyle(self.node.package.style)
# jQuery
if style.hasValidConfig:
if style.get_jquery() == True:
html += u'<script type="text/javascript" src="exe_jquery.js"></script>' + lb
else:
html += u'<script type="text/javascript" src="' + style.get_jquery() + '"></script>' + lb
else:
html += u'<script type="text/javascript" src="exe_jquery.js"></script>' + lb
if common.hasGalleryIdevice(self.node):
html += u'<script type="text/javascript" src="exe_lightbox.js"></script>' + lb
if common.hasFX(self.node):
html += u'<script type="text/javascript" src="exe_effects.js"></script>' + lb
if common.hasSH(self.node):
html += u'<script type="text/javascript" src="exe_highlighter.js"></script>' + lb
html += u'<script type="text/javascript" src="common_i18n.js"></script>' + lb
if common.hasGames(self.node):
html += u'<script type="text/javascript" src="exe_games.js"></script>' + lb
if common.hasABCMusic(self.node):
html += u'<script type="text/javascript" src="exe_abcmusic.js"></script>' + lb
html += u'<script type="text/javascript" src="common.js"></script>' + lb
html += common.printJavaScriptIdevicesScripts('export', self)
if common.hasMagnifier(self.node):
html += u'<script type="text/javascript" src="mojomagnify.js"></script>' + lb
# Some styles might have their own JavaScript files (see their config.xml file)
if style.hasValidConfig:
html += style.get_extra_head()
html += common.getExtraHeadContent(self.node.package)
html += u"</head>" + lb
html += u'<body class="exe-epub3" id="exe-node-'+self.node.id+'">' + lb
html += u"<div id=\"outer\">" + lb
html += u"<" + sectionTag + " id=\"main\">" + lb
html += u"<" + headerTag + " id=\"nodeDecoration\">"
html += u"<div id=\"headerContent\">"
html += u'<h1 id=\"nodeTitle\">'
html += escape(self.node.titleLong)
html += u'</h1>'
#.........这里部分代码省略.........
示例13: __renderHeader
def __renderHeader(self):
#TinyMCE lang (user preference)
myPreferencesPage = self.webServer.preferences
"""Generates the header for AuthoringPage"""
html = common.docType()
#################################################################################
#################################################################################
html += u'<html xmlns="http://www.w3.org/1999/xhtml" lang="'+myPreferencesPage.getSelectedLanguage()+'">\n'
html += u'<head>\n'
html += u"<link rel=\"stylesheet\" type=\"text/css\" href=\"/css/exe.css\" />"
# Use the Style's base.css file if it exists
themePath = Path(G.application.config.stylesDir/self.package.style)
themeBaseCSS = themePath.joinpath("base.css")
if themeBaseCSS.exists():
html += u"<link rel=\"stylesheet\" type=\"text/css\" href=\"/style/%s/base.css\" />" % self.package.style
else:
html += u"<link rel=\"stylesheet\" type=\"text/css\" href=\"/style/base.css\" />"
html += u"<link rel=\"stylesheet\" type=\"text/css\" href=\"/css/exe_wikipedia.css\" />"
html += u"<link rel=\"stylesheet\" type=\"text/css\" href=\"/css/imgAreaSelect/imgareaselect-default.css\" />"
html += u"<link rel=\"stylesheet\" type=\"text/css\" href=\"/style/%s/content.css\" />" % self.package.style
html += u"<link rel=\"stylesheet\" type=\"text/css\" href=\"/css/jquery-ui-1.10.4.custom/ui-lightness/jquery-ui-1.10.4.custom.min.css\" />"
if G.application.config.tinyMCEVersion != "4":
html += u"<link rel='stylesheet' type='text/css' href='/scripts/tinymce_3.5.7/jscripts/tiny_mce/themes/advanced/skins/default/ui.css' />"
if G.application.config.assumeMediaPlugins:
html += u"<script type=\"text/javascript\">var exe_assume_media_plugins = true;</script>\n"
#JR: anado una variable con el estilo
estilo = u'/style/%s/content.css' % self.package.style
html += common.getJavaScriptStrings()
html += u"<script type=\"text/javascript\">"
html += u"var exe_style = '%s';" % estilo
html += u"var exe_package_name='"+self.package.name+"';"
html += 'var exe_export_format="'+common.getExportDocType()+'".toLowerCase();'
html += 'var exe_editor_mode="'+myPreferencesPage.getEditorMode()+'";'
#MD Set the correct tinymce version to use
tinymce_src = None
if G.application.config.tinyMCEVersion == "3":
tinymce_src = {"wysiwyg_path" :
"/scripts/tinymce_3.5.7/jscripts/tiny_mce/tiny_mce.js",
"wysiwyg_settings_path" :
"/scripts/tinymce_3.5.7_settings.js"}
else:
tinymce_src = {"wysiwyg_path" :
"/scripts/tinymce/tinymce.full.min.js",
"wysiwyg_settings_path" :
"/scripts/tinymce_settings.js"}
html += 'var eXeLearning_settings = '
html += json.dumps(tinymce_src) + ";\n"
html += '</script>\n'
html += u'<script type="text/javascript" src="../jsui/native.history.js"></script>\n'
html += u'<script type="text/javascript" src="/scripts/authoring.js"></script>\n'
html += u'<script type="text/javascript" src="/scripts/exe_jquery.js"></script>\n'
html += u'<script type="text/javascript" src="/scripts/jquery-ui-1.10.4.custom.min.js"></script>\n'
html += u'<script type="text/javascript" src="/scripts/exe_lightbox.js"></script>\n'
html += u'<script type="text/javascript" src="/scripts/common.js"></script>\n'
html += u'<script type="text/javascript" src="/scripts/jquery.imgareaselect.js"></script>\n'
html += u'<script type="text/javascript" src="/scripts/exe_imgmaparea.js"></script>\n'
html += u'<script type="text/javascript" src="/scripts/authoring_defaultprompts.js"></script>\n'
html += u'<script type="text/javascript" src="/scripts/authoring_feedback_checkboxes.js"></script>\n'
html += '<script type="text/javascript">document.write(unescape("%3Cscript src=\'" + eXeLearning_settings.wysiwyg_path + "\' type=\'text/javascript\'%3E%3C/script%3E"));</script>';
html += '<script type="text/javascript">document.write(unescape("%3Cscript src=\'" + eXeLearning_settings.wysiwyg_settings_path + "\' type=\'text/javascript\'%3E%3C/script%3E"));</script>';
html += u'<title>"+_("eXe : elearning XHTML editor")+"</title>\n'
html += u'<meta http-equiv="content-type" content="text/html; '
html += u' charset=UTF-8" />\n'
html += u'</head>\n'
return html
示例14: __renderHeader
def __renderHeader(self):
"""Generates the header for AuthoringPage"""
html = common.docType()
html += u'<html xmlns="http://www.w3.org/1999/xhtml">\n'
html += u'<head>\n'
html += u'<style type="text/css">\n'
html += u'@import url(/css/exe.css);\n'
html += u'@import url(/style/base.css);\n'
html += u'@import url(/style/%s/content.css);\n' % self.package.style
html += u'</style>\n'
html += u'<script type="text/javascript" src="/scripts/common.js">'
html += u'</script>\n'
html += u'<script type="text/javascript" '
html += u'src="/scripts/tinymce/jscripts/tiny_mce/tiny_mce.js">'
html += u'</script>\n'
html += u'<script type="text/javascript">\n'
html += u'<!--\n'
html += u"tinyMCE.init({ "
html += u"content_css : \"/css/extra.css\", \n"
html += u"valid_elements : \"*[*]\",\n"
html += u"verify_html : false, \n"
html += u"apply_source_formatting : true, \n"
###########
# testing TinyMCE's escaping/quoting of HTML:
html += u"cleanup_on_startup : false, \n"
#html += u"cleanup : false, \n"
html += u"entity_encoding : \"raw\", \n"
#############
html += u"gecko_spellcheck : true, \n"
html += u" mode : \"textareas\",\n"
html += u" editor_selector : \"mceEditor\",\n"
html += u" plugins : \"table,save,advhr,advimage,advlink,emotions,media,"
html += u" contextmenu,paste,directionality,exemath\",\n"
html += u" theme : \"advanced\",\n"
html += u" theme_advanced_layout_manager : \"SimpleLayout\",\n"
html += u"theme_advanced_toolbar_location : \"top\",\n"
html += u" theme_advanced_buttons1 : \"newdocument,separator,"
html += u"bold,italic,underline,fontsizeselect,forecolor,"
html += u"backcolor,separator,sub,sup,separator,"
html += u"justifyleft,justifycenter,justifyright,justifyfull,"
html += u"separator,bullist,numlist,outdent,indent,separator,"
html += u"anchor,separator,cut,copy,paste,pastetext,pasteword,help\",\n"
html += u" theme_advanced_buttons2 : \"image,media,exemath,advhr,"
html += u"fontselect,tablecontrols,separator,link,unlink,separator,"
html += u" undo,redo,separator,charmap,code,removeformat\",\n"
html += u" theme_advanced_buttons3 : \"\",\n"
# the image-handling callback function for tinyMCE's image button:
html += u"advimage_image_browser_callback : \"chooseImage_viaTinyMCE\",\n"
# and manually entered filenames as well, via image2insert w/o file browser:
html += u"advimage_image2insert_browser_callback : \"chooseImage_viaTinyMCE\",\n"
# the media-handling callback function for tinyMCE's media button:
html += u"media_media_browser_callback : \"chooseImage_viaTinyMCE\",\n"
# and manually entered filenames as well, via media2insert w/o file browser:
html += u"media_media2insert_browser_callback : \"chooseImage_viaTinyMCE\",\n"
# the link-handling callback function for tinyMCE's media button:
html += u"advlink_file_browser_callback : \"chooseImage_viaTinyMCE\",\n"
# and manually entered filenames as well, via media2insert w/o file browser:
html += u"advlink_file2insert_browser_callback : \"chooseImage_viaTinyMCE\",\n"
# and the callback to generate exemath's LaTeX images via mimetex:
html += u"exemath_image_browser_callback : \"makeMathImage_viaTinyMCE\",\n"
# to override any browser plugin checks, and allow media to be added:
if G.application.config.assumeMediaPlugins:
html += u"exe_assume_media_plugins : true,\n"
html += u"theme_advanced_statusbar_location : \"bottom\",\n"
html += u" theme_advanced_resize_horizontal : false,\n"
html += u" theme_advanced_resizing : true\n"
html += u" });\n"
html += u"//-->\n"
html += u"</script>\n"
html += u'<script type="text/javascript" src="/scripts/libot_drag.js">'
html += u'</script>\n'
html += u'<title>"+_("eXe : elearning XHTML editor")+"</title>\n'
html += u'<meta http-equiv="content-type" content="text/html; '
html += u' charset=UTF-8" />\n'
html += u'</head>\n'
return html
示例15: render
def render(self):
"""
Returns an XHTML string rendering this page.
"""
html = common.docType()
#html += u"<html xmlns=\"http://www.w3.org/1999/xhtml\">\n"
lenguaje = G.application.config.locale
html += u"<html lang=\"" + lenguaje + "\" xml:lang=\"" + lenguaje + "\" xmlns=\"http://www.w3.org/1999/xhtml\">\n"
html += u"<head>\n"
html += u"<title>"+_("eXe")+"</title>\n"
html += u"<meta http-equiv=\"Content-Type\" content=\"text/html; "
html += u" charset=utf-8\" />\n";
html += u"<!-- Created using eXe: http://exelearning.org -->\n"
html += u"<style type=\"text/css\">\n"
html += u"@import url(base.css);\n"
html += u"@import url(content.css);\n"
html += u"</style>\n"
html += u'<script type="text/javascript" src="common.js"></script>\n'
#html += u"</head>\n"
if self.scormType == 'commoncartridge':
html += u"</head>\n"
html += u"<body>"
else:
html += u"<script type=\"text/javascript\" "
html += u"src=\"APIWrapper.js\"></script>\n"
html += u"<script type=\"text/javascript\" "
html += u"src=\"SCOFunctions.js\"></script>\n"
html += u"</head>\n"
html += u'<body onload="loadPage()" '
html += u'onunload="unloadPage()">'
html += u"<div id=\"outer\">\n"
html += u"<div id=\"main\">\n"
html += u"<div id=\"nodeDecoration\">\n"
html += u"<h1 id=\"nodeTitle\">\n"
html += escape(self.node.titleLong)
html += u'</h1></div>\n'
for idevice in self.node.idevices:
html += u'<div class="%s" id="id%s">\n' % (idevice.klass,
idevice.id)
block = g_blockFactory.createBlock(None, idevice)
if not block:
log.critical("Unable to render iDevice.")
raise Error("Unable to render iDevice.")
if hasattr(idevice, "isQuiz"):
html += block.renderJavascriptForScorm()
html += self.processInternalLinks(
block.renderView(self.node.package.style))
html += u'</div>\n' # iDevice div
html += u"</div>\n"
html += u"</div>\n"
if self.node.package.scolinks:
html += u'<div class="previousnext">'
html += u'<a class="previouslink" '
html += u'href="javascript: goBack();">%s</a> | <a class="nextlink" ' % _('Previous')
html += u'href="javascript: goForward();">%s</a>' % _('Next')
html += u'</div>'
html += self.renderLicense()
html += self.renderFooter()
html += u"</body></html>\n"
html = html.encode('utf8')
# JR: Eliminamos los atributos de las ecuaciones
aux = re.compile("exe_math_latex=\"[^\"]*\"")
html = aux.sub("", html)
aux = re.compile("exe_math_size=\"[^\"]*\"")
html = aux.sub("", html)
#JR: Cambio el & en los enlaces del glosario
html = html.replace("&concept", "&concept")
#JR: Cambiamos las anclas por enlaces a archivos
html = html.replace('href="#', 'href="')
return html