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 __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=\"/scripts/exe_effects/exe_effects.css\" />" html += u"<link rel=\"stylesheet\" type=\"text/css\" href=\"/scripts/exe_highlighter/exe_highlighter.css\" />" html += u"<link rel=\"stylesheet\" type=\"text/css\" href=\"/scripts/exe_games/exe_games.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 += common.getJavaScriptStrings() # The games require additional strings html += common.getGamesJavaScriptStrings() html += u"<script type=\"text/javascript\">" html += u"var exe_style = '%s';top.exe_style = exe_style;" % estilo # editorpane.py uses exe_style_dirname to auto-select the current style (just a provisional solution) html += u"var exe_style_dirname = '%s'; top.exe_style_dirname = exe_style_dirname;" % self.package.style html += u"var exe_package_name='"+self.package.name+"';" html += 'var exe_export_format="'+common.getExportDocType()+'".toLowerCase();' html += 'var exe_editor_mode="'+myPreferencesPage.getEditorMode()+'";' html += 'var exe_editor_version="'+myPreferencesPage.getEditorVersion()+'";' 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/exe_lightbox/exe_lightbox.js"></script>\n' html += u'<script type="text/javascript" src="/scripts/exe_effects/exe_effects.js"></script>\n' html += u'<script type="text/javascript" src="/scripts/exe_highlighter/exe_highlighter.js"></script>\n' html += u'<script type="text/javascript" src="/scripts/exe_games/exe_games.js"></script>\n' html += u'<script type="text/javascript" src="/scripts/common.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' style = G.application.config.styleStore.getStyle(self.package.style) if style.hasValidConfig: html += style.get_edition_extra_head() html += u'</head>\n' return html
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 __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\">var exe_package_name='" + self.package.name + "';</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(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_GET(self, request): """Render the preferences""" log.debug("render_GET") 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"<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\" >" html += common.formField('select', _(u"Select Language"), 'locale', options = self.localeNames, selection = self.config.locale) html += u"<div id=\"editorButtons\"> \n" html += u"<br/>" html += common.submitButton("ok", _("OK")) html += common.submitButton("cancel", _("Cancel")) 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_GET(self, request): """Called for all requests to this object""" log.debug("render_GET") self.process(request) html = common.docType() html += '<html xmlns="http://www.w3.org/1999/xhtml">\n' html += "<head>\n" html += '<style type="text/css">\n' html += "@import url(/css/exe.css);\n" html += "@import url(/style/base.css);\n" html += "@import url(/style/standardwhite/content.css);</style>\n" html += '<script type="text/javascript" src="/scripts/libot_drag.js">' html += "</script>\n" html += '<script type="text/javascript" src="/scripts/common.js">' html += "</script>\n" html += '<script type="text/javascript" src="/scripts/editor.js">' html += "</script>\n" html += "<title>" + _("eXe : elearning XHTML editor") + "</title>\n" html += '<meta http-equiv="content-type" content="text/html; ' html += ' charset=UTF-8"></meta>\n' html += "</head>\n" html += "<body>\n" html += '<div id="main"> \n' html += '<form method="post" action="' + self.url + '" ' html += 'id="contentForm" >' html += common.hiddenField("action") html += common.hiddenField("object") html += common.hiddenField("isChanged", "1") html += '<font color="red"><b>' + self.message + "</b></font>" html += '<div id="editorButtons"> \n' html += self.renderList() html += self.editorPane.renderButtons(request) if self.isNewIdevice: html += "<br/>" + common.submitButton("delete", _("Delete"), False) else: html += "<br/>" + common.submitButton("delete", _("Delete")) html += '<br/><input class="button" type="button" name="save" ' title = "none" if self.editorPane.idevice.edit == False: title = self.editorPane.idevice.title title = title.replace(" ", "+") html += 'onclick=saveIdevice("%s") value="%s"/>' % (escape(title), _("Save")) html += u'<br/><input class="button" type="button" name="import" onclick="importPackage(\'package\')"' html += u' value="%s" />' % _("Import iDevice") html += u'<br/><input class="button" type="button" name="export" ' html += u"onclick=\"exportPackage('package','%d')\"" % self.isNewIdevice html += u' value="%s" />' % _("Export iDevice") html += u'<br/><input class="button" type="button" name="quit" ' html += u"onclick=JavaScript:window.close()" html += u' value="%s" />\n' % _("Quit") html += common.hiddenField("pathpackage") html += "</fieldset>" html += "</div>\n" html += self.editorPane.renderIdevice(request) html += "</div>\n" html += "<br/></form>\n" html += "</body>\n" html += "</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\" />" # 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=\"/scripts/exe_effects/exe_effects.css\" />" html += u"<link rel=\"stylesheet\" type=\"text/css\" href=\"/scripts/exe_highlighter/exe_highlighter.css\" />" html += u"<link rel=\"stylesheet\" type=\"text/css\" href=\"/scripts/exe_games/exe_games.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 += common.getJavaScriptStrings() # The games require additional strings html += common.getGamesJavaScriptStrings() 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( ) + '";' 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/exe_lightbox/exe_lightbox.js"></script>\n' html += u'<script type="text/javascript" src="/scripts/exe_effects/exe_effects.js"></script>\n' html += u'<script type="text/javascript" src="/scripts/exe_highlighter/exe_highlighter.js"></script>\n' html += u'<script type="text/javascript" src="/scripts/exe_games/exe_games.js"></script>\n' html += u'<script type="text/javascript" src="/scripts/common.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' style = G.application.config.styleStore.getStyle(self.package.style) if style.hasValidConfig: html += style.get_edition_extra_head() html += u'</head>\n' 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" 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_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')
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
def render_GET(self, request): """Called for all requests to this object""" log.debug("render_GET") self.process(request) html = common.docType() html += "<html xmlns=\"http://www.w3.org/1999/xhtml\">\n" html += "<head>\n" html += "<style type=\"text/css\">\n" html += "@import url(/css/exe.css);\n" html += '@import url(/style/base.css);\n' html += "@import url(/style/standardwhite/content.css);</style>\n" html += '<script type="text/javascript" src="/scripts/libot_drag.js">' html += '</script>\n' html += '<script type="text/javascript" src="/scripts/common.js">' html += '</script>\n' html += '<script type="text/javascript" src="/scripts/editor.js">' html += '</script>\n' html += "<title>"+_("eXe : elearning XHTML editor")+"</title>\n" html += "<meta http-equiv=\"content-type\" content=\"text/html; " html += " charset=UTF-8\"></meta>\n"; html += "</head>\n" html += "<body>\n" html += "<div id=\"main\"> \n" html += "<form method=\"post\" action=\""+self.url+"\" " html += "id=\"contentForm\" >" html += common.hiddenField("action") html += common.hiddenField("object") html += common.hiddenField("isChanged", "1") html += "<font color=\"red\"<b>"+self.message+"</b></font>" html += "<div id=\"editorButtons\"> \n" html += self.renderList() html += self.editorPane.renderButtons(request) if self.isNewIdevice: html += "<br/>" + common.submitButton("delete", _("Delete"), False) else: html += "<br/>" + common.submitButton("delete", _("Delete")) html += '<br/><input class="button" type="button" name="save" ' title = "none" if self.editorPane.idevice.edit == False: title = self.editorPane.idevice.title html += 'onclick=saveIdevice("%s") value="%s"/>' % (title, _("Save")) html += u'<br/><input class="button" type="button" name="import" onclick="importPackage(\'package\')"' html += u' value="%s" />' % _("Import iDevice") html += u'<br/><input class="button" type="button" name="export" ' html += u'onclick="exportPackage(\'package\',\'%d\')"' % self.isNewIdevice html += u' value="%s" />' % _("Export iDevice") html += common.hiddenField("pathpackage") html += "</fieldset>" html += "</div>\n" html += self.editorPane.renderIdevice(request) html += "</div>\n" html += "<br/></form>\n" html += "</body>\n" html += "</html>\n" return html.encode('utf8')
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 __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" 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\"," 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,separator,sub,sup,separator," html += u"justifyleft,justifycenter,justifyright,justifyfull," html += u"separator,bullist,numlist,indent,outdent,separator," html += u"cut,copy,paste,pastetext,pasteword\",\n" html += u" theme_advanced_buttons2 : \"image,tablecontrols,separator," html += u"link,unlink,separator,undo,redo,separator," html += u" charmap,removeformat,cleanup,code,help\",\n" html += u"file_browser_callback : \"chooseImage_viaTinyMCE\",\n" html += u" theme_advanced_buttons3 : \"\",\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
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_POST(self, request): """ Process the preferences selection """ log.debug("render_POST " + repr(request.args)) if "ok" in request.args: self.config.locale = request.args["locale"][0] self.config.locales[self.config.locale].install(unicode=True) self.config.configParser.set('user', 'locale', self.config.locale) 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_GET(self, request): """Called for all requests to this object""" log.debug("render_GET") self.process(request) html = common.docType() html += '<html xmlns="http://www.w3.org/1999/xhtml">\n' html += "<head>\n" html += '<style type="text/css">\n' html += "@import url(/css/exe.css);\n" html += "@import url(/style/base.css);\n" html += "@import url(/style/standardwhite/content.css);</style>\n" html += '<script type="text/javascript" src="/scripts/libot_drag.js">' html += "</script>\n" html += '<script type="text/javascript" src="/scripts/common.js">' html += "</script>\n" html += "<title>" + _("eXe : elearning XHTML editor") + "</title>\n" html += '<meta http-equiv="content-type" content="text/html; ' html += ' charset=UTF-8"></meta>\n' html += "</head>\n" html += "<body>\n" html += '<div id="main"> \n' html += '<form method="post" action="' + self.url + '" ' html += 'id="contentForm" >' html += common.hiddenField("action") html += common.hiddenField("object") html += common.hiddenField("isChanged", "1") html += '<font color="red"<b>' + self.message + "</b></font>" html += '<div id="editorButtons"> \n' html += self.renderList() html += self.editorPane.renderButtons(request) if self.isNewIdevice: html += "<br/>" + common.submitButton("delete", _("Delete"), False) html += "<br/>" + common.submitButton("save", _("Save"), False) else: html += "<br/>" + common.submitButton("delete", _("Delete")) html += "<br/>" + common.submitButton("save", _("Save")) html += "<br/>" + common.submitButton("add", _("Save as")) html += "</fieldset>" html += "</div>\n" html += self.editorPane.renderIdevice(request) html += "</div>\n" html += "<br/></form>\n" html += "</body>\n" html += "</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"<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\" " html += u"src=\"APIWrapper.js\"></script>\n" html += u"<script type=\"text/javascript\" " html += u"src=\"SCOFunctions.js\"></script>\n" html += u'<script type="text/javascript" src="common.js"></script>\n' html += u"</head>\n" html += u'<body onload="loadPage()" onbeforeunload="unloadPage()" ' 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: 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 += block.renderView(self.node.package.style) html += u"</div>\n" html += u"</div>\n" html += u"</body></html>\n" html = html.encode('utf8') return html
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"<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/exe_lightbox.js"></script>\n' html += u'<script type="text/javascript" src="/scripts/common.js">' html += u'</script>\n' #modification by lernmodule.net html += u'<script type="text/javascript" src="/scripts/lernmodule_net.js">' html += u'</script>\n' #end modification html += u'<script type="text/javascript" src="/scripts/authoring.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'<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(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)) html += u'</'+articleTag+'>'+lb # iDevice div html += u"</"+sectionTag+">"+lb # /#main themeHasXML = common.themeHasConfigXML(self.node.package.style) if themeHasXML: #if style.hasValidConfig: html += self.renderLicense() html += self.renderFooter() html += u"</div>"+lb # /#outer if self.node.package.scolinks: html += u'<'+sectionTag+' class="previousnext">'+lb html += u'<a class="previouslink" ' html += u'href="javascript:goBack();">%s</a> | <a class="nextlink" ' % c_('Previous') html += u'href="javascript:goForward();">%s</a>' % c_('Next') html += u'</'+sectionTag+'>'+lb if not themeHasXML: #if not style.hasValidConfig: html += self.renderLicense() html += self.renderFooter() else: html += style.get_extra_body() html += u'</body></html>' 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") # Remove "resources/" from data="resources/ and the url param html = html.replace("video/quicktime\" data=\"resources/", "video/quicktime\" data=\"") html = html.replace("application/x-mplayer2\" data=\"resources/", "application/x-mplayer2\" data=\"") html = html.replace("audio/x-pn-realaudio-plugin\" data=\"resources/", "audio/x-pn-realaudio-plugin\" data=\"") html = html.replace("<param name=\"url\" value=\"resources/", "<param name=\"url\" value=\"") return html
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 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 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 html += common.getJavaScriptStrings() + lb html += u'<script type="text/javascript" src="common.js"></script>' + lb html += u'<script type="text/javascript" src="lernmodule_net.js"></script>' + lb 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 += u"</head>" + lb html += u'<body class="exe-ims"><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>' html += u"</" + 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.renderJavascriptForWeb() if idevice.title != "Forum Discussion": html += self.processInternalLinks( block.renderView(self.node.package.style)) html += u'</' + articleTag + '>' + lb # iDevice div html += u"<div id=\"lmsubmit\"></div><script type=\"text/javascript\" language=\"javascript\">doStart();</script>" + lb html += u"</" + sectionTag + ">" + lb # /#main html += self.renderLicense() html += self.renderFooter() html += u"</div>" + lb # /#outer if style.hasValidConfig: html += style.get_extra_body() html += u'</body>' html += u'<script type="text/javascript" src="lernmodule_net_custom.js"></script>' + lb html += u'</html>' html = html.encode('utf8') # JRJ: Eliminamos los atributos de las ecuaciones # Let's elliminate the attibutes of the equations aux = re.compile("exe_math_latex=\"[^\"]*\"") html = aux.sub("", html) aux = re.compile("exe_math_size=\"[^\"]*\"") html = aux.sub("", html) #JRJ: Cambio el & en los enlaces del glosario # Then let's change the & of the glossary links html = html.replace("&concept", "&concept") # Remove "resources/" from data="resources/ and the url param html = html.replace("video/quicktime\" data=\"resources/", "video/quicktime\" data=\"") html = html.replace("application/x-mplayer2\" data=\"resources/", "application/x-mplayer2\" data=\"") html = html.replace("audio/x-pn-realaudio-plugin\" data=\"resources/", "audio/x-pn-realaudio-plugin\" data=\"") html = html.replace("<param name=\"url\" value=\"resources/", "<param name=\"url\" value=\"") return html
def render_GET(self, request): """Called for all requests to this object""" # Processing log.debug("render_GET") self.process(request) # Rendering html = common.docType() html += "<html xmlns=\"http://www.w3.org/1999/xhtml\">\n" html += "<head>\n" html += "<style type=\"text/css\">\n" html += "@import url(/css/exe.css);\n" html += '@import url(/style/base.css);\n' html += "@import url(/style/standardwhite/content.css);</style>\n" html += '<script type="text/javascript" src="/scripts/authoring.js">' html += '</script>\n' html += '<script type="text/javascript" src="/scripts/common.js">' html += '</script>\n' html += '<script type="text/javascript" src="/scripts/editor.js">' html += '</script>\n' html += "<title>"+_("eXe : elearning XHTML editor")+"</title>\n" html += "<meta http-equiv=\"content-type\" content=\"text/html; " html += " charset=UTF-8\"></meta>\n"; html += "</head>\n" html += "<body>\n" html += "<div id=\"main\"> \n" html += "<form method=\"post\" action=\""+self.url+"\" " html += "id=\"contentForm\" >" html += common.hiddenField("action") html += common.hiddenField("object") html += common.hiddenField("isChanged", "1") if self.message != '': html += "<script>Ext.Msg.alert('"+_('Info')+"', '"+self.message+"');</script>" html += "<div id=\"editorButtons\"> \n" html += self.renderList() html += self.editorPane.renderButtons(request) if self.isNewIdevice: html += "<br/>" + common.submitButton("delete", _("Delete"), False) else: html += '<br /><input type="button" class="button" onclick="deleteIdevice()" value="'+_("Delete")+'" />' html += '<br/><input class="button" type="button" name="save" ' title = "none" if self.editorPane.idevice.edit == False: title = self.editorPane.idevice.title title = title.replace(" ", "+") html += 'onclick=saveIdevice("%s") value="%s"/>' % (escape(title), _("Save")) html += u'<br/><input class="button" type="button" name="import" ' html += u' onclick="importPackage(\'package\')" value="%s" />' % _("Import iDevice") html += u'<br/><input class="button" type="button" name="export" ' html += u'onclick="exportPackage(\'package\',\'%d\')"' % self.isNewIdevice html += u' value="%s" />' % _("Export iDevice") html += u'<br/><input class="button" type="button" name="quit" ' #html += u'onclick="parent.Ext.getCmp(\'ideviceeditorwin\').close()"' html += u'onclick="quitDialog()"' html += u' value="%s" />\n' % _("Quit") html += common.hiddenField("pathpackage") html += "</fieldset>" html += "</div>\n" html += self.editorPane.renderIdevice(request) html += "</div>\n" html += "<br/></form>\n" html += "</body>\n" html += "</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" 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") 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"<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>\n" html += u"<link rel=\"stylesheet\" type=\"text/css\" href=\"base.css\" />" if common.hasGalleryIdevice(self.node): html += u"<link rel=\"stylesheet\" type=\"text/css\" href=\"exe_lightbox.css\" />" html += u"<link rel=\"stylesheet\" type=\"text/css\" href=\"content.css\" />" 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 class=\"exe-ims\">\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" #modification by lernmodule.net html += u"<div id=\"lmsubmit\"></div><script type=\"text/javascript\" language=\"javascript\">doStart();</script></body></html>\n" #end modification 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") # Remove "resources/" from data="resources/ and the url param html = html.replace("video/quicktime\" data=\"resources/", "video/quicktime\" data=\"") html = html.replace("application/x-mplayer2\" data=\"resources/", "application/x-mplayer2\" data=\"") html = html.replace("audio/x-pn-realaudio-plugin\" data=\"resources/", "audio/x-pn-realaudio-plugin\" data=\"") html = html.replace("<param name=\"url\" value=\"resources/", "<param name=\"url\" value=\"") return html
def render_GET(self, request): """Called for all requests to this object""" # Processing log.debug("render_GET") self.process(request) # Rendering html = common.docType() html += "<html xmlns=\"http://www.w3.org/1999/xhtml\">\n" html += "<head>\n" html += "<style type=\"text/css\">\n" html += "@import url(/css/exe.css);\n" html += '@import url(/style/base.css);\n' html += "@import url(/style/standardwhite/content.css);</style>\n" html += '<script type="text/javascript" src="/scripts/libot_drag.js">' html += '</script>\n' html += '<script type="text/javascript" src="/scripts/common.js">' html += '</script>\n' html += '<script type="text/javascript" src="/scripts/editor.js">' html += '</script>\n' html += "<title>"+_("eXe : elearning XHTML editor")+"</title>\n" html += "<meta http-equiv=\"content-type\" content=\"text/html; " html += " charset=UTF-8\"></meta>\n"; html += "</head>\n" html += "<body>\n" html += "<div id=\"main\"> \n" html += "<form method=\"post\" action=\""+self.url+"\" " html += "id=\"contentForm\" >" html += common.hiddenField("action") html += common.hiddenField("object") html += common.hiddenField("isChanged", "1") html += "<font color=\"red\"><b>"+self.message+"</b></font>" html += "<div id=\"editorButtons\"> \n" html += self.renderList() html += self.editorPane.renderButtons(request, self.showHide) if self.isNewIdevice: html += "<br/>" + common.submitButton("delete", _("Delete"), False) else: html += "<br/>" + common.submitButton("delete", _("Delete")) html += '<br/><input class="button" type="button" name="save" ' title = "none" if self.editorPane.idevice.edit == False: title = self.editorPane.idevice.title title = title.replace(" ", "+") html += 'onclick=saveIdevice("%s") value="%s"/>' % (escape(title), _("Save")) html += u'<br/><input class="button" type="button" name="import" ' if self.showHide: html += ' disabled="disabled" ' html += u' onclick="importPackage(\'package\')" value="%s" />' % _("Import iDevice") html += u'<br/><input class="button" type="button" name="export" ' if self.showHide: html += ' disabled="disabled" ' html += u'onclick="exportPackage(\'package\',\'%d\')"' % self.isNewIdevice html += u' value="%s" />' % _("Export iDevice") #JR: anado un boton que permite mostrar u ocultar iDevices if self.showHide: html += "<br/>" + common.submitButton("showHide", _("Show/Hide"), False) else: html += "<br/>" + common.submitButton("showHide", _("Show/Hide")) html += u'<br/><input class="button" type="button" name="quit" ' html += u'onclick=JavaScript:window.close()' html += u' value="%s" />\n' % _("Quit") html += common.hiddenField("pathpackage") html += "</fieldset>" html += "</div>\n" #if ("showHide" in request.args): if self.showHide: html += self.editorPane.renderShowHideiDevices(self.ideviceStore.getFactoryIdevices()) else: html += self.editorPane.renderIdevice(request) html += "</div>\n" html += "<br/></form>\n" html += "</body>\n" html += "</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\" />" # 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=\"/scripts/exe_effects/exe_effects.css\" />" html += u"<link rel=\"stylesheet\" type=\"text/css\" href=\"/scripts/exe_highlighter/exe_highlighter.css\" />" html += u"<link rel=\"stylesheet\" type=\"text/css\" href=\"/scripts/exe_games/exe_games.css\" />" html += u"<link rel=\"stylesheet\" type=\"text/css\" href=\"/scripts/tinymce_4/js/tinymce/plugins/abcmusic/export/exe_abcmusic.css\" />" #93 (to do) 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 += common.getJavaScriptStrings() # The games require additional strings html += common.getGamesJavaScriptStrings() html += u"<script type=\"text/javascript\">" html += u"var exe_style = '%s';top.exe_style = exe_style;" % estilo # editorpane.py uses exe_style_dirname to auto-select the current style (just a provisional solution) html += u"var exe_style_dirname = '%s'; top.exe_style_dirname = exe_style_dirname;" % self.package.style html += u"var exe_package_name='" + self.package.name + "';" html += 'var exe_export_format="' + common.getExportDocType( ) + '".toLowerCase();' html += 'var exe_editor_mode="' + myPreferencesPage.getEditorMode( ) + '";' html += 'var exe_editor_version="' + myPreferencesPage.getEditorVersion( ) + '";' html += '</script>\n' html += u'<script type="text/javascript" src="../jsui/native.history.js"></script>\n' htmlLang = G.application.config.locale if self.package.dublinCore.language != "": htmlLang = self.package.dublinCore.language for subDir in G.application.config.localeDir.dirs(): if (subDir / 'LC_MESSAGES' / 'exe.mo').exists(): if str( subDir.basename() ) == htmlLang and htmlLang != myPreferencesPage.getSelectedLanguage( ): html += u'<script type="text/javascript" src="../jsui/i18n/' + htmlLang + '.js"></script>\n' html += u'<script type="text/javascript">var exe_elp_lang="' + htmlLang + '";</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/exe_lightbox/exe_lightbox.js"></script>\n' html += u'<script type="text/javascript" src="/scripts/exe_effects/exe_effects.js"></script>\n' html += u'<script type="text/javascript" src="/scripts/exe_highlighter/exe_highlighter.js"></script>\n' html += u'<script type="text/javascript" src="/scripts/exe_games/exe_games.js"></script>\n' html += u'<script type="text/javascript" src="/scripts/tinymce_4/js/tinymce/plugins/abcmusic/export/exe_abcmusic.js"></script>\n' #93 (to do) html += u'<script type="text/javascript" src="/scripts/common.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 += common.printJavaScriptIdevicesScripts('edition', self) 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' style = G.application.config.styleStore.getStyle(self.package.style) if style.hasValidConfig(): html += style.get_edition_extra_head() html += common.getExtraHeadContent(self.package) html += u'</head>\n' return html
def render_GET(self, request): """Render the preferences""" log.debug("render_GET") if self.localeNames_lang != self.config.locale: self.updateLocaleNames() # 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 exportXliff(source, target, copy, cdata) { opener.nevow_clientToServerEvent('exportXliffPackage', this, '', '%s', source, target, copy, cdata); window.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"<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 source language"), 'source', options = self.localeNames, selection = self.config.locale) html += common.formField('select', this_package, _(u"Select target language"), 'target', options = self.localeNames, selection = 'eu') html += common.formField('checkbox', this_package, _(u"Copy source also in target"), 'copy', name = 'copy', checked = True, title = None, instruction = _(u"If you don't choose this \ option, target field will be empty. Some Computer Aided Translation tools \ (i.g. OmegaT ) just translate the content of the target field. If you are \ using this kind of tools, you will need to pre-fill target field with a copy \ of the source field.")) html += common.formField('checkbox', this_package, _(u"Wrap fields in CDATA"), 'cdata', name = 'cdata', checked = False, title = None, instruction = _(u"This option will wrap all \ the exported fields in CDATA sections. This kind of sections are not \ recommended by XLIFF standard but it could be a good option if you want to \ use a pre-process tool (i.g.: Rainbow) before using the Computer Aided \ Translation software.")) html += u"<div id=\"editorButtons\"> \n" html += u"<br/>" html += common.button("ok", _("OK"), enabled=True, _class="button", onClick="exportXliff(document.forms.contentForm.source.value, \ document.forms.contentForm.target.value, \ document.forms.contentForm.copy.checked, \ document.forms.contentForm.cdata.checked \ )") 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. """ 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 += 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!="": desc = self.node.package.description desc = desc.replace('"', '"') html += '<meta name="description" content="'+desc+'" />'+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 # 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 += common.getJavaScriptStrings()+lb if common.hasGames(self.node): # The games require additional strings html += common.getGamesJavaScriptStrings() + lb 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 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 id=\""+self.node.id+"\" 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 id="exe-node-'+self.node.id+'" class=\"exe-scorm\" ' if common.hasQuizTest(self.node): html += u'onunload="unloadPage(true)">' else: html += u'onunload="unloadPage()">' html += u'<script type="text/javascript">document.body.className+=" js";jQuery(function(){loadPage()})</script>'+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>' html += u'</div>' html += u'</'+headerTag+'>'+lb self.node.exportType = 'scorm' 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)) html += u'</'+articleTag+'>'+lb # iDevice div html += u"</"+sectionTag+">"+lb # /#main themeHasXML = common.themeHasConfigXML(self.node.package.style) if themeHasXML: #if style.hasValidConfig: html += self.renderLicense() html += self.renderFooter() html += u"</div>"+lb # /#outer if self.node.package.scolinks: html += u'<'+sectionTag+' class="previousnext">'+lb html += u'<a class="previouslink" ' html += u'href="javascript:goBack();">%s</a> | <a class="nextlink" ' % c_('Previous') html += u'href="javascript:goForward();">%s</a>' % c_('Next') html += u'</'+sectionTag+'>'+lb if not themeHasXML: #if not style.hasValidConfig: html += self.renderLicense() html += self.renderFooter() else: html += style.get_extra_body() html += u'</body></html>' 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") # Remove "resources/" from data="resources/ and the url param html = html.replace("video/quicktime\" data=\"resources/", "video/quicktime\" data=\"") html = html.replace("application/x-mplayer2\" data=\"resources/", "application/x-mplayer2\" data=\"") html = html.replace("audio/x-pn-realaudio-plugin\" data=\"resources/", "audio/x-pn-realaudio-plugin\" data=\"") html = html.replace("<param name=\"url\" value=\"resources/", "<param name=\"url\" value=\"") return html
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 : true,\n" html += u" theme_advanced_resizing : true,\n" #set width according to settings html += u" width : \"%s\"\n" % (G.application.editorsWidth or "100%") 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
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 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 += 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!="": desc = self.node.package.description desc = desc.replace('"', '"') html += '<meta name="description" content="'+desc+'" />'+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 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 += common.getJavaScriptStrings()+lb if common.hasGames(self.node): # The games require additional strings html += common.getGamesJavaScriptStrings() + lb html += u'<script type="text/javascript" src="exe_games.js"></script>'+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 # Some styles might have their own JavaScript files (see their config.xml file) if style.hasValidConfig: html += style.get_extra_head() html += u"</head>"+lb html += u'<body class="exe-ims"><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"<div id=\"headerContent\">" html += u'<h1 id=\"nodeTitle\">' html += escape(self.node.titleLong) html += u'</h1>' html += u'</div>' html += u"</"+headerTag+">"+lb self.node.exportType = 'ims' 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.renderJavascriptForWeb() if idevice.title != "Forum Discussion": html += self.processInternalLinks( block.renderView(self.node.package.style)) html += u'</'+articleTag+'>'+lb # iDevice div html += u"</"+sectionTag+">"+lb # /#main html += self.renderLicense() html += self.renderFooter() html += u"</div>"+lb # /#outer if style.hasValidConfig: html += style.get_extra_body() html += u'</body></html>' html = html.encode('utf8') # JRJ: Eliminamos los atributos de las ecuaciones # Let's elliminate the attibutes of the equations aux = re.compile("exe_math_latex=\"[^\"]*\"") html = aux.sub("", html) aux = re.compile("exe_math_size=\"[^\"]*\"") html = aux.sub("", html) #JRJ: Cambio el & en los enlaces del glosario # Then let's change the & of the glossary links html = html.replace("&concept", "&concept") # Remove "resources/" from data="resources/ and the url param html = html.replace("video/quicktime\" data=\"resources/", "video/quicktime\" data=\"") html = html.replace("application/x-mplayer2\" data=\"resources/", "application/x-mplayer2\" data=\"") html = html.replace("audio/x-pn-realaudio-plugin\" data=\"resources/", "audio/x-pn-realaudio-plugin\" data=\"") html = html.replace("<param name=\"url\" value=\"resources/", "<param name=\"url\" value=\"") return html
def render_GET(self, request): """Render the preferences""" log.debug("render_GET") if self.localeNames_lang != self.config.locale: self.updateLocaleNames() # 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 exportXliff(source, target, copy, cdata) { parent.nevow_clientToServerEvent('exportXliffPackage', this, '', '%s', source, target, copy, cdata); parent.Ext.getCmp("xliffexportwin").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"<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 source language"), 'source', options=self.localeNames, selection=self.config.locale) html += common.formField('select', this_package, _(u"Select target language"), 'target', options=self.localeNames, selection='eu') html += common.formField('checkbox', this_package, _(u"Copy source also in target"), 'copy', name='copy', checked=True, title=None, instruction=_(u"If you don't choose this \ option, target field will be empty. Some Computer Aided Translation tools \ (i.g. OmegaT ) just translate the content of the target field. If you are \ using this kind of tools, you will need to pre-fill target field with a copy \ of the source field.")) html += common.formField('checkbox', this_package, _(u"Wrap fields in CDATA"), 'cdata', name='cdata', checked=False, title=None, instruction=_(u"This option will wrap all \ the exported fields in CDATA sections. This kind of sections are not \ recommended by XLIFF standard but it could be a good option if you want to \ use a pre-process tool (i.g.: Rainbow) before using the Computer Aided \ Translation software.")) html += u"<div id=\"editorButtons\"> \n" html += u"<br/>" html += common.button( "ok", _("OK"), enabled=True, _class="button", onClick="exportXliff(document.forms.contentForm.source.value, \ document.forms.contentForm.target.value, \ document.forms.contentForm.copy.checked, \ document.forms.contentForm.cdata.checked \ )") html += common.button( "cancel", _("Cancel"), enabled=True, _class="button", onClick="parent.Ext.getCmp('xliffexportwin').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 __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
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>' html += u'</div>' html += u"</" + headerTag + ">" + lb self.node.exportType = 'epub' 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 += htmlentitydecode(block.renderJavascriptForWeb()) if idevice.title != "Forum Discussion": html += htmlentitydecode(self.processInternalLinks( block.renderView(self.node.package.style))) html += u'</' + articleTag + '>' + lb # iDevice div html = re.sub("(<iframe[^>]*)(src=\"//)", "\g<1>src=\"https://", html) html += u"</" + sectionTag + ">" + lb # /#main if self.node.package.get_addPagination(): html += "<p class='pagination page-counter'>" + c_('Page %s of %s') % ('<strong>'+str(pages.index(self))+'</strong>','<strong>'+str((len(pages) -1))+'</strong>')+ "</p>"+lb html += self.renderLicense() html += unicode(BeautifulSoup(self.renderFooter())) html += u"</div>" + lb # /#outer if style.hasValidConfig: html += style.get_extra_body() html += u'</body></html>' 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") # Remove "resources/" from data="resources/ and the url param html = html.replace("video/quicktime\" data=\"resources/", "video/quicktime\" data=\"") html = html.replace("application/x-mplayer2\" data=\"resources/", "application/x-mplayer2\" data=\"") html = html.replace("audio/x-pn-realaudio-plugin\" data=\"resources/", "audio/x-pn-realaudio-plugin\" data=\"") html = html.replace("<param name=\"url\" value=\"resources/", "<param name=\"url\" value=\"") common.setExportDocType(old_dT) 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"<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
def render_GET(self, request): """Called for all requests to this object""" # Processing log.debug("render_GET") self.process(request) # Rendering html = common.docType() html += "<html xmlns=\"http://www.w3.org/1999/xhtml\">\n" html += "<head>\n" html += "<style type=\"text/css\">\n" html += "@import url(/css/exe.css);\n" html += '@import url(/style/base.css);\n' html += "@import url(/style/standardwhite/content.css);</style>\n" html += '<script type="text/javascript" src="/scripts/libot_drag.js">' html += '</script>\n' html += '<script type="text/javascript" src="/scripts/common.js">' html += '</script>\n' html += '<script type="text/javascript" src="/scripts/editor.js">' html += '</script>\n' html += "<title>"+_("eXe : elearning XHTML editor")+"</title>\n" html += "<meta http-equiv=\"content-type\" content=\"text/html; " html += " charset=UTF-8\"></meta>\n"; html += "</head>\n" html += "<body>\n" html += "<div id=\"main\"> \n" html += "<form method=\"post\" action=\""+self.url+"\" " html += "id=\"contentForm\" >" html += common.hiddenField("action") html += common.hiddenField("object") html += common.hiddenField("isChanged", "1") html += "<font color=\"red\"><b>"+self.message+"</b></font>" html += "<div id=\"editorButtons\"> \n" html += self.renderList() html += self.editorPane.renderButtons(request, self.showHide) if self.isNewIdevice: html += "<br/>" + common.submitButton("delete", _("Delete"), False) else: html += "<br/>" + common.submitButton("delete", _("Delete")) html += '<br/><input class="button" type="button" name="save" ' title = "none" if self.editorPane.idevice.edit == False: title = self.editorPane.idevice.title title = title.replace(" ", "+") html += 'onclick=saveIdevice("%s") value="%s"/>' % (escape(title), _("Save")) html += u'<br/><input class="button" type="button" name="import" ' if self.showHide: html += ' disabled="disabled" ' html += u' onclick="importPackage(\'package\')" value="%s" />' % _("Import iDevice") html += u'<br/><input class="button" type="button" name="export" ' if self.showHide: html += ' disabled="disabled" ' html += u'onclick="exportPackage(\'package\',\'%d\')"' % self.isNewIdevice html += u' value="%s" />' % _("Export iDevice") #JR: anado un boton que permite mostrar u ocultar iDevices if self.showHide: html += "<br/>" + common.submitButton("showHide", _("Show/Hide"), False) else: html += "<br/>" + common.submitButton("showHide", _("Show/Hide")) html += u'<br/><input class="button" type="button" name="quit" ' #html += u'onclick="parent.Ext.getCmp(\'ideviceeditorwin\').close()"' html += u'onclick="quitDialog()"' html += u' value="%s" />\n' % _("Quit") html += common.hiddenField("pathpackage") html += "</fieldset>" html += "</div>\n" #if ("showHide" in request.args): if self.showHide: html += self.editorPane.renderShowHideiDevices(self.ideviceStore.getFactoryIdevices()) else: html += self.editorPane.renderIdevice(request) html += "</div>\n" html += "<br/></form>\n" html += "</body>\n" html += "</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" 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"<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>\n" html += u"<link rel=\"stylesheet\" type=\"text/css\" href=\"base.css\" />" if common.hasGalleryIdevice(self.node): html += u"<link rel=\"stylesheet\" type=\"text/css\" href=\"exe_lightbox.css\" />" html += u"<link rel=\"stylesheet\" type=\"text/css\" href=\"content.css\" />" if common.hasGalleryIdevice(self.node): html += u'<script type="text/javascript" src="exe_lightbox.js"></script>\n' html += u'<script type="text/javascript" src="common.js"></script>\n' html += u"</head>\n" html += u"<body class=\"exe-ims\">\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") # Remove "resources/" from data="resources/ and the url param html = html.replace("video/quicktime\" data=\"resources/", "video/quicktime\" data=\"") html = html.replace("application/x-mplayer2\" data=\"resources/", "application/x-mplayer2\" data=\"") html = html.replace("audio/x-pn-realaudio-plugin\" data=\"resources/", "audio/x-pn-realaudio-plugin\" data=\"") html = html.replace("<param name=\"url\" value=\"resources/", "<param name=\"url\" value=\"") return html
def render(self): """ 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 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 += common.getJavaScriptStrings() + lb if common.hasGames(self.node): # The games require additional strings html += common.getGamesJavaScriptStrings() + lb html += u'<script type="text/javascript" src="exe_games.js"></script>' + 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 # Some styles might have their own JavaScript files (see their config.xml file) if style.hasValidConfig: html += style.get_extra_head() html += u"</head>" + lb html += u'<body class="exe-epub3"><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'<div id="headerContent">' html += u'<h1 id="nodeTitle">' html += escape(self.node.titleLong) html += u"</h1>" html += u"</div>" html += u"</" + headerTag + ">" + lb self.node.exportType = "epub" 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 += htmlentitydecode(block.renderJavascriptForWeb()) if idevice.title != "Forum Discussion": html += htmlentitydecode(self.processInternalLinks(block.renderView(self.node.package.style))) html += u"</" + articleTag + ">" + lb # iDevice div html += u"</" + sectionTag + ">" + lb # /#main html += self.renderLicense() html += unicode(BeautifulSoup(self.renderFooter(), convertEntities=BeautifulSoup.XHTML_ENTITIES)) html += u"</div>" + lb # /#outer if style.hasValidConfig: html += style.get_extra_body() html += u"</body></html>" 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") # Remove "resources/" from data="resources/ and the url param html = html.replace('video/quicktime" data="resources/', 'video/quicktime" data="') html = html.replace('application/x-mplayer2" data="resources/', 'application/x-mplayer2" data="') html = html.replace('audio/x-pn-realaudio-plugin" data="resources/', 'audio/x-pn-realaudio-plugin" data="') html = html.replace('<param name="url" value="resources/', '<param name="url" value="') common.setExportDocType(old_dT) return html
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
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>' html += u'</div>' html += u"</" + headerTag + ">" + lb self.node.exportType = 'epub' 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 += htmlentitydecode(block.renderJavascriptForWeb()) if idevice.title != "Forum Discussion": html += htmlentitydecode( self.processInternalLinks( block.renderView(self.node.package.style))) html += u'</' + articleTag + '>' + lb # iDevice div html += u"</" + sectionTag + ">" + lb # /#main if self.node.package.get_addPagination(): html += "<p class='pagination page-counter'>" + c_( 'Page %s of %s') % ('<strong>' + str( pages.index(self)) + '</strong>', '<strong>' + str( (len(pages) - 1)) + '</strong>') + "</p>" + lb html += self.renderLicense() html += unicode( BeautifulSoup(self.renderFooter(), convertEntities=BeautifulSoup.XHTML_ENTITIES)) html += u"</div>" + lb # /#outer if style.hasValidConfig: html += style.get_extra_body() html += u'</body></html>' 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") # Remove "resources/" from data="resources/ and the url param html = html.replace("video/quicktime\" data=\"resources/", "video/quicktime\" data=\"") html = html.replace("application/x-mplayer2\" data=\"resources/", "application/x-mplayer2\" data=\"") html = html.replace("audio/x-pn-realaudio-plugin\" data=\"resources/", "audio/x-pn-realaudio-plugin\" data=\"") html = html.replace("<param name=\"url\" value=\"resources/", "<param name=\"url\" value=\"") common.setExportDocType(old_dT) 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 setLocaleAndAnchors(l,anchors) { opener.nevow_clientToServerEvent('setLocale', this, '', l) opener.nevow_clientToServerEvent('setInternalAnchors', this, '', anchors) window.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="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')