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
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")
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
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")
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
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
开发者ID:erral,项目名称:iteexe,代码行数:57,代码来源:imsexport.py
示例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')
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
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')
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))
#.........这里部分代码省略.........
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
请发表评论