Example #1
0
 def renderEdit(self, style):
     """
     Returns an XHTML string with the form elements for editing this block
     """
     log.debug("renderEdit")
     html  = u"<div class=\"iDevice\">\n"
     html += common.textInput("title"+self.id, self.idevice.title) + '<br/><br/>'
     html += self.mediaElement.renderEdit()       
     floatArr    = [[_(u'Left'), 'left'],
                   [_(u'Right'), 'right'],
                   [_(u'None'),  'none']]
     html += common.formField('select', _("Align:"),
                              "float" + self.id, '',
                              self.idevice.alignInstruc,
                              floatArr, self.idevice.float)
     html += "<br/>" + self.textElement.renderEdit()
     emphasisValues = [(_(u"No emphasis"),     Idevice.NoEmphasis),
                       (_(u"Some emphasis"),   Idevice.SomeEmphasis)]
     html += common.formField('select', _('Emphasis'),
                              'emphasis', self.id, 
                              '', # TODO: Instructions
                              emphasisValues,
                              self.idevice.emphasis)
     html += self.renderEditButtons()
     html += u"</div>\n"
     return html
Example #2
0
    def renderEdit(self, style):
        """
        Returns an XHTML string with the form elements for editing this block
        """
        log.debug("renderEdit")
        html  = u"<div class=\"iDevice\">\n"
        html += common.textInput("title"+self.id, self.idevice.title) + '<br/><br/>'
        html += self.mediaElement.renderEdit()       
        floatArr    = [[_(u'Left'), 'left'],
                      [_(u'Right'), 'right'],
                      [_(u'None'),  'none']]

        this_package = None
        if self.idevice is not None and self.idevice.parentNode is not None:
            this_package = self.idevice.parentNode.package
        html += common.formField('select', this_package, _("Align:"),
                                 "float" + self.id, '',
                                 self.idevice.alignInstruc,
                                 floatArr, self.idevice.float)
        #html += u'<div class="block">' #<b>%s</b></div>' % _(u"Caption:")
        #html += common.textInput("caption" + self.id, self.idevice.media.caption)
        #html += common.elementInstruc(self.idevice.media.captionInstruc)
        html += "<br/>" + self.textElement.renderEdit()
        emphasisValues = [(_(u"No emphasis"),     Idevice.NoEmphasis),
                          (_(u"Some emphasis"),   Idevice.SomeEmphasis)]

        html += common.formField('select', this_package, _('Emphasis'),
                                 'emphasis', self.id, 
                                 '', # TODO: Instructions
                                 emphasisValues,
                                 self.idevice.emphasis)
        html += self.renderEditButtons()
        html += u"</div>\n"
        return html
Example #3
0
    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")
Example #4
0
  def renderEdit(self):
      """
      Enables the user to set up their passage of text
      """
      # to render, choose the content with the preview-able resource paths:
      self.field.encodedContent = self.field.content_w_resourcePaths
      this_package = None
      if self.field_idevice is not None \
      and self.field_idevice.parentNode is not None:
          this_package = self.field_idevice.parentNode.package
          
      html = [
          # Render the iframe box
          common.formField('richTextArea', this_package, _('Text'),'',
                           self.editorId, self.field.instruc,
                           self.field.encodedContent),
          # Render our toolbar
          
          u'  <input type="button" value="%s" ' % _("Hide/Show Word"),
          u' onclick="$exeAuthoring.toggleWordInEditor(\'%s\');" />' % self.editorId,
          u'<br /><br />',
        
          common.formField('textInput',
                          '',
                          _('Other words'),
                          'clOtras'+self.id, '',
                          self.field.otrasInstruc,
                          self.field.otras,
                          size=80),
         
 
          u'</br></br>',
          ]
      
      return '\n    '.join(html)
Example #5
0
 def renderEdit(self, style):
     """
     Returns an XHTML string with the form elements for editing this block
     """
     log.debug("renderEdit")
     html = u'<div class="iDevice">\n'
     html += common.textInput("title" + self.id, self.idevice.title) + "<br/><br/>"
     html += self.mediaElement.renderEdit()
     floatArr = [[_(u"Left"), "left"], [_(u"Right"), "right"], [_(u"None"), "none"]]
     html += common.formField(
         "select", _("Align:"), "float" + self.id, "", self.idevice.alignInstruc, floatArr, self.idevice.float
     )
     html += "<br/>" + self.textElement.renderEdit()
     emphasisValues = [(_(u"No emphasis"), Idevice.NoEmphasis), (_(u"Some emphasis"), Idevice.SomeEmphasis)]
     html += common.formField(
         "select",
         _("Emphasis"),
         "emphasis",
         self.id,
         "",  # TODO: Instructions
         emphasisValues,
         self.idevice.emphasis,
     )
     html += self.renderEditButtons()
     html += u"</div>\n"
     return html
Example #6
0
 def renderEdit(self, style):
     """
     Returns an XHTML string with the form elements for editing this block
     """
     log.debug("renderEdit")
     html = u'<div class="iDevice">\n'
     html += u'<div class="block">\n'
     label = _(u"Filename")
     if self.idevice.userResources:
         label += u": "
         label += u'<span style="text-decoration:underline">'
         label += self.idevice.userResources[0].storageName
         label += u"</span>\n"
     html += common.formField("textInput", label, "path" + self.id, "", self.idevice.filenameInstruc, size=50)
     html += u'<input type="button" onclick="addFile(\'%s\')"' % self.id
     html += u' value="%s" />\n' % _(u"Select a file")
     html += u"</div>\n"
     html += u'<div class="block">\n'
     html += u"\n<b>%s</b>\n" % _(u"Label")
     html += common.elementInstruc(self.idevice.labelInstruc)
     html += u"</div>\n"
     html += common.textInput(u"label" + self.id, self.idevice.label)
     html += common.formField(
         "richTextArea",
         _(u"Description:"),
         "description",
         self.id,
         self.idevice.descriptionInstruc,
         self.idevice.description,
     )
     html += u'<div class="block">\n'
     html += self.renderEditButtons()
     html += u"</div>\n"
     html += u"\n</div>\n"
     return html
Example #7
0
    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')
Example #8
0
 def renderEdit(self, style):
     """
     Returns an XHTML string with the form elements for editing this block
     """
     log.debug("renderEdit")
     html  = u"<div class=\"iDevice\"><br/>\n"
     html += common.textInput("title" + self.id, self.idevice.title) + "<br/><br/>"
     sites = [(_(u"English Wikipedia Article"), "http://en.wikipedia.org/wiki/"),
              (_(u"Catalan Wikipedia Article"), "http://ca.wikipedia.org/wiki/"),
              (_(u"Chinese Wikipedia Article"), "http://zh.wikipedia.org/wiki/"),
              (_(u"Dutch Wikipedia Article"),   "http://nl.wikipedia.org/wiki/"),
              (_(u"French Wikipedia Article"),  "http://fr.wikipedia.org/wiki/"),
              (_(u"German Wikipedia Article"),  "http://de.wikipedia.org/wiki/"),
              (_(u"Greek Wikipedia Article"), "http://el.wikipedia.org/wiki/"),
              (_(u"Italian Wikipedia Article"), "http://it.wikipedia.org/wiki/"),
              (_(u"Japanese Wikipedia Article"),"http://ja.wikipedia.org/wiki/"),
              (_(u"Magyar Wikipedia Article"),"http://hu.wikipedia.org/wiki/"),
              (_(u"Polish Wikipedia Article"),  "http://pl.wikipedia.org/wiki/"),
              (_(u"Portugese Wikipedia Article"), "http://pt.wikipedia.org/wiki/"),
              (_(u"Slovenian Wikipedia Article"), "http://sl.wikipedia.org/wiki/"),
              (_(u"Spanish Wikipedia Article"), "http://es.wikipedia.org/wiki/"),
              (_(u"Swedish Wikipedia Article"), "http://sv.wikipedia.org/wiki/"),
              (_(u"Wikibooks Article"),         "http://en.wikibooks.org/wiki/"),
              (_(u"Wikiversity"),         "http://en.wikiversity.org/wiki/"),
              (_(u"Wiktionary"),         "http://en.wiktionary.org/wiki/"),
              (_(u"Wikieducator Content"),      "http://wikieducator.org/"),
              (_(u"Other"),                     "")]          
     this_package = None
     if self.idevice is not None and self.idevice.parentNode is not None:
         this_package = self.idevice.parentNode.package
     html += common.formField('select', this_package, _('Site'),'s',
                              'site'+self.id,
                              self.idevice.langInstruc,
                              sites,
                              self.idevice.site)
     url = "none"
     if self.idevice.site == "":
         url = "block"
     html += '<div style="display:%s"> %s: <br/>' % (url, _("Own site"))
     html += common.textInput("ownUrl"+self.id, self.idevice.ownUrl) + '<br/></div>'
     html += "<br/>"
     html += common.textInput("article", self.idevice.articleName)
     html += common.elementInstruc(self.idevice.searchInstruc)
     html += common.submitButton(u"loadWikipedia"+self.id, _(u"Load"))
     html += u"<br/>\n"
     html += self.articleElement.renderEdit()
     emphasisValues = [(_(u"No emphasis"),     Idevice.NoEmphasis),
                       (_(u"Some emphasis"),   Idevice.SomeEmphasis)]
     html += common.formField('select', this_package, _('Emphasis'),
                              'emphasis', self.id, 
                              '', # TODO: Instructions
                              emphasisValues,
                              self.idevice.emphasis)
     html += self.renderEditButtons(undo=self.idevice.undo)
     html += u"</div>\n"
     return html
Example #9
0
 def renderEdit(self):
     """
     Returns an XHTML string with the form element for editing this field
     """
     if self.lms.lms == "":
         return ""
     if self.lms.lms == "moodle":
         typeArr    = [[_(u'A single simple discussion'),       'single'],
                       [_(u'Each person posts one discussion'), 'eachuser'],
                       [_(u'Standard forum for general use'),   'general']]
         postArr    = [[_(u'Discussions and replies are allowed'),     '2'],
                       [_(u'No discussions, but replies are allowed'), '1'],
                       [_(u'No discussions, no replies'),              '0']]
         subscArr   = [[_(u'No'),             '0'], 
                       [_(u'Yes, forever'),   '1'], 
                       [_(u'Yes, initially'), '2']]
         groupArr   = [[_(u'No groups'),       '0'], 
                       [_(u'Separate groups'), '1'], 
                       [_(u'Visible groups'),  '2']]
         visibleArr = [[_(u'Show'), '1'], 
                       [_(u'Hide'), '0']]
         html  = common.formField('select', _(u"Forum type:"),
                                  "type" + self.id, '',
                                  self.lms.typeInstruc,
                                  typeArr, 
                                  self.lms.type)
         html += common.formField('select', 
                                  _(u"Can a student post to this forum?:"),
                                  "studentpost" + self.id, '',
                                  self.lms.postInstruc,
                                  postArr, 
                                  self.lms.studentpost)
         html += common.formField('select', 
                                  _(u"Force everyone to be subscribed?:"),
                                  "subscription" + self.id, '',
                                  self.lms.subscInstruc,
                                  subscArr, 
                                  self.lms.subscription)
         html += common.formField('select', 
                                  _(u"Group mode:"),
                                  "groupmode" + self.id, '',
                                  self.lms.groupInstruc,
                                  groupArr, 
                                  self.lms.groupmode)
         html += common.formField('select', 
                                  _(u"Visible to students:"),
                                  "visible" + self.id, '',
                                  self.lms.visibleInstruc,
                                  visibleArr, 
                                  self.lms.visible)
     else:
         html  = common.textInput("other"+self.id, 
                                  self.lms.otherLabel)
         html += u"http://" + common.textInput("url"+self.id, 
                                     self.lms.otherUrl) + u"<br/>"
     return html
Example #10
0
 def renderEdit(self):
     """
     Returns an XHTML string with the form element for editing this field
     """
     html  = ""
     if self.idevice.message <> "":
         html += '<p style="color: red; font-weight: bold;">'
         html += '%s</p>' % self.idevice.message
     html += u'<p>'
     html += common.textInput("name"+ self.id, self.idevice.title)
     html += u'</p>'
     forums = [(_(u"New Forum"), 'newForum')]
     forums += [(pt.forumName, pt.forumName) for pt in 
                 self.idevice.forumsCache.getForums()]
     if self.idevice.isNewForum:
         selected = 'newForum'
     else:
         selected = self.forum.forumName
     html  = common.formField('select', 
                              _(u"Forum Name:"),
                              'changeForum', 'forumSelect'+self.id,
                              '',
                              forums, selected)
     if not self.idevice.noForum:
         introduction = self.forum.introduction.replace("\r", "")
         introduction = introduction.replace("\n","\\n")
         html += common.textInput("fName"+ self.id, self.forum.forumName)
         html += common.elementInstruc(self.forum.nameInstruc)
         html += "<p><b>%s</b></p>" % _("Introduction")
         html += common.richTextArea("fIntro"+self.id, 
                                     introduction)
     topics = [(_('None'), 'none'), (_('New Topic'), 'newTopic')]
     topics += [(pt.topic, pt.topic) for pt in self.forum.discussions]
     if self.idevice.isNewTopic:
         selected = 'newTopic'
     else:
         selected = self.idevice.discussion.topic
     html  = common.formField('select', 
                              _(u"Discussion Topic/Thread:"),
                              'changeTopic', 'topicSelect'+self.id,
                              '',
                              topics, selected)
     html += self.discussionElement.renderEdit()
     lmss = [(_(u"Please select a LMS"), ''),
             (_('Moodle'), 'moodle'),
             (_('Other'), 'other')]
     html  = common.formField('select', 
                              _(u"Learning Management System:"),
                              'changeLms', 'lmsSelect'+self.id,
                              self.forum.lmsInstruc,
                              lmss, self.forum.lms.lms)
     html += self.lmsElement.renderEdit()
     return html
Example #11
0
 def renderEdit(self, style):
     """
     Returns an XHTML string with the form elements for editing this block
     """
     log.debug("renderEdit")
     floatArr        = [[_(u'Left'), 'left'],
                       [_(u'Right'), 'right'],
                       [_(u'None'),  'none']]
     html  = u"<div class=\"iDevice\">\n"
     html += '<div class="block">'
     html += u"<strong>%s</strong>" % _(u"Caption:")
     html += common.elementInstruc(self.idevice.captionInstruc)
     html += '</div>'
     html += '<div class="block">'
     html += common.textInput("caption" + self.id, self.idevice.caption)
     html += '</div>'
     html += '<div class="block">'
     html += self.textElement.renderEdit()
     html += '</div>'
     html += self.imageMagnifierElement.renderEdit()       
     this_package = None
     if self.idevice is not None and self.idevice.parentNode is not None:
         this_package = self.idevice.parentNode.package
     html += common.formField('select', this_package, _("Align:"),
                              "float" + self.id, '',
                              self.idevice.alignInstruc,
                              floatArr, self.idevice.float)
     zoomOpts = []
     for i in range(100, 201, 10):
         zoomOpts.append(('%d%%' % (i), str(i)))
     selection = self.idevice.imageMagnifier.initialZSize
     html += common.formField('select', this_package, _(u"Initial Zoom"),
                              "initial" + self.id, '',
                              self.idevice.initialZoomInstruc,
                              zoomOpts, selection)
     selection = self.idevice.imageMagnifier.maxZSize
     html += common.formField('select', this_package, _(u"Maximum zoom"),
                              "maxZoom" + self.id, '',
                              self.idevice.maxZoomInstruc,
                              zoomOpts, selection)
     glassSizeArr    = [[_(u'Small'), '1'],
                       [_(u'Medium'),'2'],
                       [_(u'Large'),'3'],
                       [_(u'Extra large'),'4'],]
     html += common.formField('select', this_package, 
                              _(u"Size of magnifying glass: "),
                              "glass" + self.id, '',
                              self.idevice.glassSizeInstruc,
                              glassSizeArr, 
                              self.idevice.imageMagnifier.glassSize)
     html += self.renderEditButtons(undo=self.idevice.undo)
     html += u"</div>\n"
     return html
Example #12
0
 def renderEdit(self, style):
     """
     Returns an XHTML string with the form element for editing this block
     """
     html  = "<div class=\"iDevice\"><br/>\n"
     html += common.textInput("title"+self.id, self.idevice.title)
     html += common.formField('richTextArea',_(u'Reflective question:'),
                              'activity', self.id, self.activityInstruc,
                              self.activity)
     html += common.formField('richTextArea',_(u'Feedback:'),
                              'answer', self.id, self.answerInstruc,
                              self.answer)
     html += "<br/>" + self.renderEditButtons()
     html += "</div>\n"
     return html
Example #13
0
    def renderEdit(self, style):
        """
        Returns an XHTML string with the form elements for editing this block
        """
        log.debug("renderEdit")

        html = u"<div class=\"iDevice\"><br/>\n"
        html += common.textInput("title" + self.id, self.idevice.title)

        html += '<br/><br/>RSS URL ' + common.textInput(
            "url" + self.id, self.idevice.url)
        html += common.submitButton(u"loadRss" + self.id, _(u"Load"))
        html += common.elementInstruc(self.idevice.urlInstruc)
        html += u"<br/>\n"
        html += self.rssElement.renderEdit()
        emphasisValues = [(_(u"No emphasis"), Idevice.NoEmphasis),
                          (_(u"Some emphasis"), Idevice.SomeEmphasis)]

        this_package = None
        if self.idevice is not None and self.idevice.parentNode is not None:
            this_package = self.idevice.parentNode.package
        html += common.formField(
            'select',
            this_package,
            _('Emphasis'),
            'emphasis',
            self.id,
            '',  # TODO: Instructions
            emphasisValues,
            self.idevice.emphasis)

        html += self.renderEditButtons(undo=self.idevice.undo)
        html += u"</div>\n"
        return html
Example #14
0
    def renderEdit(self, style):
        """
        Returns an XHTML string with the form elements for editing this block
        """
        log.debug("renderEdit")
        html  = u"<div class=\"iDevice\">\n"
        html += self.imageElement.renderEdit()       
        floatArr    = [[_(u'Left'), 'left'],
                      [_(u'Right'), 'right'],
                      [_(u'None'),  'none']]

        this_package = None
        if self.idevice is not None and self.idevice.parentNode is not None:
            this_package = self.idevice.parentNode.package
        html += common.formField('select', this_package, _("Align:"),
                                 "float" + self.id, '',
                                 '',
                                 floatArr, self.idevice.float)

        html += u'<div class="block"><b>%s</b></div>' % _(u"Caption:")
        html += common.textInput("caption" + self.id, self.idevice.caption)
        html += common.elementInstruc(self.idevice.captionInstruc)
        html += "<br/>" + self.textElement.renderEdit()
        html += self.renderEditButtons()
        html += u"</div>\n"
        return html
Example #15
0
 def renderEdit(self, style):
     """
     Returns an XHTML string with the form element for editing this block
     """
     html = u'<div class="block">\n'
     html += u"<strong>%s</strong> " % _("URL:")
     html += common.elementInstruc(self.idevice.urlInstruc)
     html += u"</div>\n"
     html += u'<div class="block">\n'
     html += common.textInput("url" + self.id, self.idevice.url)
     heightArr = [[_("small"), "200"], [_("medium"), "300"], [_("large"), "500"], [_("super-size"), "800"]]
     html += u"</div>\n"
     html += u'<div class="block">\n'
     this_package = None
     if self.idevice is not None and self.idevice.parentNode is not None:
         this_package = self.idevice.parentNode.package
     html += common.formField(
         "select",
         this_package,
         _("Frame Height:"),
         "height" + self.id,
         options=heightArr,
         selection=self.idevice.height,
     )
     html += u"</div>\n"
     html += self.renderEditButtons()
     return html
Example #16
0
 def renderEdit(self, style):
     """
     Returns an XHTML string with the form elements for editing this block
     """
     log.debug("renderEdit")
     html  = u'<div class="iDevice">\n'
     html += common.textInput("path"+self.id, "", 50)
     html += u'<input type="button" onclick="addFile(\'%s\')"' % self.id
     html += u' value="%s" />\n' % _(u"Select a file")
     html += common.elementInstruc(self.idevice.filenameInstruc)
     html += u'<div class="block">\n'
     html += u'\n<b>%s</b>\n' % _(u'Label')
     html += common.elementInstruc(self.idevice.labelInstruc)
     html += u'</div>\n'
     html += common.textInput(u'label'+self.id, self.idevice.label)
     html += common.formField('richTextArea',u'Description:','description',
                              self.id, self.idevice.descriptionInstruc,
                              self.idevice.description)
     if self.idevice.userResources:
         html += u'<span style="text-decoration:underline">'
         html += self.idevice.userResources[0].storageName
         html += u'</span>\n'
     html += u'<div class="block">\n'
     html += self.renderEditButtons()
     html += u'</div>\n'
     html += u'\n</div>\n'
     return html
Example #17
0
 def renderEdit(self, style):
     """
     Returns an XHTML string with the form elements for editing this block
     """
     log.debug("renderEdit")
     html  = u"<div class=\"iDevice\"><br/>\n"
     html += common.textInput("title" + self.id, self.idevice.title)
     html += '<br/><br/>RSS URL ' + common.textInput("url" + self.id,
                                                     self.idevice.url)
     html += common.submitButton(u"loadRss"+self.id, _(u"Load"))
     html += common.elementInstruc(self.idevice.urlInstruc)
     html += u"<br/>\n"
     html += self.rssElement.renderEdit()
     emphasisValues = [(_(u"No emphasis"),     Idevice.NoEmphasis),
                       (_(u"Some emphasis"),   Idevice.SomeEmphasis)]
     this_package = None
     if self.idevice is not None and self.idevice.parentNode is not None:
         this_package = self.idevice.parentNode.package
     html += common.formField('select', this_package, _('Emphasis'),
                              'emphasis', self.id, 
                              '', # TODO: Instructions
                              emphasisValues,
                              self.idevice.emphasis)
     html += self.renderEditButtons(undo=self.idevice.undo)
     html += u"</div>\n"
     return html
Example #18
0
 def renderEdit(self, style):
     """
     Returns an XHTML string with the form element for editing this block
     """
     html = u'<p class="exe-text-field">\n'
     html += u"<label for='url%s'>%s</label> " % (self.id, _('URL:'))
     html += common.elementInstruc(self.idevice.urlInstruc)
     html += common.textInput("url" + self.id, self.idevice.url)
     html += ' <span class="exe-field-instructions">' + _(
         "Remember that HTTP pages cannot be included into HTTPS websites."
     ) + '</span>'
     heightArr = [[_('small'), '200'], [_('medium'), '300'],
                  [_('large'), '500'], [_('super-size'), '800']]
     html += u"</p>\n"
     this_package = None
     if self.idevice is not None and self.idevice.parentNode is not None:
         this_package = self.idevice.parentNode.package
     html += common.formField('select',
                              this_package,
                              _('Frame Height:'),
                              "height" + self.id,
                              options=heightArr,
                              selection=self.idevice.height)
     html += self.renderEditButtons()
     return html
Example #19
0
    def renderEdit(self, style):
        """
        Returns an XHTML string with the form elements for editing this block
        """
        log.debug("renderEdit")
        html = u"<div class=\"iDevice\">\n"
        html += self.flashElement.renderEdit()
        floatArr = [[_(u'Left'), 'left'], [_(u'Right'), 'right'],
                    [_(u'None'), 'none']]

        this_package = None
        if self.idevice is not None and self.idevice.parentNode is not None:
            this_package = self.idevice.parentNode.package
        html += common.formField('select',
                                 this_package,
                                 _("Align:"),
                                 "float" + self.id,
                                 options=floatArr,
                                 selection=self.idevice.float)
        html += u"\n"
        html += u"<b>%s </b>" % _(u"Caption:")
        html += common.textInput("caption" + self.id, self.idevice.caption)
        html += common.elementInstruc(self.idevice.captionInstruc)
        html += "<br/>" + self.textElement.renderEdit()
        html += self.renderEditButtons()
        html += u"</div>\n"
        return html
 def renderEdit(self, style):
     """
     Returns an XHTML string with the form element for editing this block
     """
     html  = u'<div class="block">\n'
     html += u"<strong>%s</strong> " % _('URL:')
     html += common.elementInstruc(self.idevice.urlInstruc)
     html += u"</div>\n"
     html += u'<div class="block">\n'
     html += common.textInput("url"+self.id, self.idevice.url) 
     heightArr = [['small',      '200'],
                  ['medium',     '300'],
                  ['large',      '500'],
                  ['super-size', '800']]
     html += u"</div>\n"
     html += u'<div class="block">\n'
     this_package = None
     if self.idevice is not None and self.idevice.parentNode is not None:
         this_package = self.idevice.parentNode.package
     html += common.formField('select', this_package, _('Frame Height:'), 
                              "height"+self.id,
                              options = heightArr,
                              selection = self.idevice.height)
     html += u"</div>\n"
     html += self.renderEditButtons()
     return html
Example #21
0
 def renderEdit(self, style):
     """
     Returns an XHTML string with the form element for editing this block
     """
     html = u'<div class="block">\n'
     html += u"<strong>%s</strong> " % _('URL:')
     html += common.elementInstruc(self.idevice.urlInstruc)
     html += u"</div>\n"
     html += u'<div class="block">\n'
     html += common.textInput("url" + self.id, self.idevice.url)
     heightArr = [['small', '200'], ['medium', '300'], ['large', '500'],
                  ['super-size', '800']]
     html += u"</div>\n"
     html += u'<div class="block">\n'
     this_package = None
     if self.idevice is not None and self.idevice.parentNode is not None:
         this_package = self.idevice.parentNode.package
     html += common.formField('select',
                              this_package,
                              _('Frame Height:'),
                              "height" + self.id,
                              options=heightArr,
                              selection=self.idevice.height)
     html += u"</div>\n"
     html += self.renderEditButtons()
     return html
Example #22
0
 def renderEdit(self):
     """
     Enables the user to set up their passage of text
     """
     html = [
         common.formField('richTextArea', _('Cloze Text'),'',
                          self.editorId, self.field.instruc,
                          self.field.encodedContent),
         u'<table style="width: 100%;">',
         u'<tbody>',
         u'<tr>',
         u'<td>',
         u'  <input type="button" value="%s" ' % _("Hide/Show Word")+
         ur"""onclick="tinyMCE.execInstanceCommand('mce_editor_1','Underline', false);"/>"""
         u'</td><td>',
         common.checkbox('strictMarking%s' % self.id,
                         self.field.strictMarking,
                         title=_(u'Strict Marking?'),
                         instruction=self.field.strictMarkingInstruc),
         u'</td><td>',
         common.checkbox('checkCaps%s' % self.id,
                         self.field.checkCaps,
                         title=_(u'Check Caps?'),
                         instruction=self.field.checkCapsInstruc),
         u'</td><td>',
         common.checkbox('instantMarking%s' % self.id,
                         self.field.instantMarking,
                         title=_(u'Instant Marking?'),
                         instruction=self.field.instantMarkingInstruc),
         u'</td>',
         u'</tr>',
         u'</tbody>',
         u'</table>',
         ]
     return '\n    '.join(html)
Example #23
0
 def renderEdit(self):
     """
     Returns an XHTML string with the form element for editing this field
     """
     html = common.formField('textInput',self.field.name,'',
                             self.id,self.field.content)
     return html
Example #24
0
 def renderEdit(self, style):
     """
     Returns an XHTML string with the form elements for editing this block
     """
     log.debug("renderEdit")
     html  = u'<div class="iDevice">\n'
     html += u'<div class="block">\n'
     label = _(u'Filename:')
     if self.idevice.userResources:
         label += u': '
         label += u'<span style="text-decoration:underline">'
         label += self.idevice.userResources[0].userName
         label += u'</span>\n'
     html += u'<div>' 
     html += common.formField('textInput',
                              label,
                              'path'+self.id, '',
                              self.idevice.filenameInstruc,
                              size=50)
     html += u'</div"><div style="padding-top:28px;" >'
     html += u'<input type="button" onclick="addFile(\'%s\')"' % self.id
     html += u' value="%s" />\n' % _(u"Select a file")
     html += u'</div><br style="clear:both;" />' 
     html += u'</div>\n'
     html += u'<div class="block">\n'
     html += u'\n<b>%s</b>\n' % _(u'Label:')
     html += common.elementInstruc(self.idevice.labelInstruc)
     html += u'</div>\n'
     html += common.textInput(u'label'+self.id, self.idevice.label)
     html += self.descriptionElement.renderEdit()
     html += u'<div class="block">\n'
     html += self.renderEditButtons()
     html += u'</div>\n'
     html += u'\n</div>\n'
     return html
Example #25
0
 def renderEdit(self, style):
     """
     Returns an XHTML string with the form elements for editing this block
     """
     log.debug("renderEdit")
     html  = u"<div class=\"iDevice\">\n"
     html += self.flashMovieElement.renderEdit()       
     floatArr    = [[_(u'Left'), 'left'],
                   [_(u'Right'), 'right'],
                   [_(u'None'),  'none']]
     html += common.formField('select', _("Align:"),
                              "float" + self.id,
                              options = floatArr,
                              selection = self.idevice.float)
     html += u'<div class="block">'
     html += u"<b>%s </b>" % _(u"Caption:")
     html += common.elementInstruc(self.idevice.captionInstruc)
     html += u'</div>\n'
     html += u'<div class="block">'
     html += common.textInput("caption" + self.id, self.idevice.caption)
     html += u'</div>\n'
     html += u'<div class="block">'
     html += self.textElement.renderEdit()
     html += self.renderEditButtons()
     html += u'</div>\n'
     html += u"</div>\n"
     return html
Example #26
0
 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')
Example #27
0
 def renderEdit(self):
     """
     Returns an XHTML string with the form element for editing this field
     """
     html = common.formField('richTextArea',self.field.name,'',
                             self.id, self.field.instruc,
                             self.field.feedback)
     return html
Example #28
0
    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>&nbsp;</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')
Example #29
0
 def renderEdit(self, style):
     """
     Returns an XHTML string with the form elements for editing this block
     """
     log.debug("renderEdit")
     html  = u"<div class=\"iDevice\"><br/>\n"
     html += common.textInput("title" + self.id, self.idevice.title)
     sites = [(_(u"English Wikipedia Article"), "http://en.wikipedia.org/"),
              (_(u"Chinese Wikipedia Article"), "http://zh.wikipedia.org/"),
              (_(u"German Wikipedia Article"),  "http://de.wikipedia.org/"),
              (_(u"French Wikipedia Article"),  "http://fr.wikipedia.org/"),
              (_(u"Japanese Wikipedia Article"),"http://ja.wikipedia.org/"),
              (_(u"Italian Wikipedia Article"), "http://il.wikipedia.org/"),
              (_(u"Polish Wikipedia Article"),  "http://pl.wikipedia.org/"),
              (_(u"Dutch Wikipedia Article"),   "http://nl.wikipedia.org/"),
              (_(u"Portugese Wikipedia Article"),
                                                "http://pt.wikipedia.org/"),
              (_(u"Spanish Wikipedia Article"), "http://es.wikipedia.org/"),
              (_(u"Swedish Wikipedia Article"), "http://sv.wikipedia.org/"),
              (_(u"Wikibooks Article"),         "http://en.wikibooks.org/"),
              (_(u"Wikieducator Content"),      "http://wikieducator.org/")]
     html += common.formField('select', _('Site'),
                              'site'+self.id, '',
                              self.idevice.langInstruc,
                              sites,
                              self.idevice.site)
     html += common.textInput("article", self.idevice.articleName)
     html += common.elementInstruc(self.idevice.searchInstruc)
     html += common.submitButton(u"loadWikipedia"+self.id, _(u"Load"))
     html += u"<br/>\n"
     html += self.articleElement.renderEdit()
     emphasisValues = [(_(u"No emphasis"),     Idevice.NoEmphasis),
                       (_(u"Some emphasis"),   Idevice.SomeEmphasis),
                       (_(u"Strong emphasis"), Idevice.StrongEmphasis)]
     html += common.formField('select', _('Emphasis'),
                              'emphasis'+self.id, '',
                              '', # TODO: Instructions
                              emphasisValues,
                              self.idevice.emphasis)
     html += self.renderEditButtons()
     html += u"</div>\n"
     return html
Example #30
0
    def renderEdit(self):
        """
        Returns an XHTML string with the form element for editing this field
        """
        html = common.textInput("name" + self.id, self.field.name, 25)
        html += common.submitImage("deleteField", self.id, "/images/stock-cancel.png", _("Delete"), 1)
        html += "<br/>\n"

        this_package = None
        html += common.formField("richTextArea", this_package, "", "instruc", self.id, "", self.field.instruc)
        return html
Example #31
0
 def renderEdit(self):
     """
     Returns an XHTML string with the form element for editing this field
     """
     log.debug("renderEdit content="+self.field.content+
               ", height="+unicode(self.height))
     html = common.formField('richTextArea',self.field.name,'',
                             self.id, self.field.instruc,
                             self.field.content,
                             str(self.width), str(self.height))
     return html
    def renderEdit(self, style):
        """
        Returns an XHTML string with the form elements for editing this block
        """
        log.debug("renderEdit")
        html = u"<div class=\"iDevice\">\n"
        html += common.textInput("title" + self.id,
                                 self.idevice.title) + '<br/><br/>'
        html += self.mediaElement.renderEdit()
        floatArr = [[_(u'Left'), 'left'], [_(u'Right'), 'right'],
                    [_(u'None'), 'none']]

        this_package = None
        if self.idevice is not None and self.idevice.parentNode is not None:
            this_package = self.idevice.parentNode.package
        html += common.formField('select', this_package, _("Align:"),
                                 "float" + self.id, '',
                                 self.idevice.alignInstruc, floatArr,
                                 self.idevice.float)
        #html += u'<div class="block">' #<b>%s</b></div>' % _(u"Caption:")
        #html += common.textInput("caption" + self.id, self.idevice.media.caption)
        #html += common.elementInstruc(self.idevice.media.captionInstruc)
        html += "<br/>" + self.textElement.renderEdit()
        emphasisValues = [(_(u"No emphasis"), Idevice.NoEmphasis),
                          (_(u"Some emphasis"), Idevice.SomeEmphasis)]

        html += common.formField(
            'select',
            this_package,
            _('Emphasis'),
            'emphasis',
            self.id,
            '',  # TODO: Instructions
            emphasisValues,
            self.idevice.emphasis)
        html += self.renderEditButtons()
        html += u"</div>\n"
        return html
Example #33
0
 def renderEdit(self, style):
     """
     Returns an XHTML string with the form element for editing this block
     """
     html  = "<div class=\"iDevice\"><br/>\n"
     html += common.textInput("title"+self.id, self.idevice.title)
     html += common.formField('richTextArea',_(u'Question:'),'question',
                             self.id, self.questionInstruc,
                             self.question)
     html += common.formField('richTextArea',_(u'Hint:'),'hint',
                             self.id, self.hintInstruc,
                             self.hint)
     html += "<table width =\"100%%\">"
     html += "<tbody>"
     for element in self.optionElements:
         html += element.renderEdit() 
     html += "</tbody>"
     html += "</table>\n"
     value = _("Add another option")    
     html += common.submitButton("addOption"+unicode(self.id), value)
     html += "<br /><br />" + self.renderEditButtons()
     html += "</div>\n"
     return html
  def renderEdit(self):
      """
      Enables the user to set up their passage of text
      """
      # to render, choose the content with the preview-able resource paths:
      self.field.encodedContent = self.field.content_w_resourcePaths
      this_package = None
      if self.field_idevice is not None \
      and self.field_idevice.parentNode is not None:
          this_package = self.field_idevice.parentNode.package
          
      html = [
          # Render the iframe box
          common.formField('richTextArea', this_package, _('Text'),'',
                           self.editorId, self.field.instruc,
                           self.field.encodedContent, 
                           default_prompt = self.field.default_prompt),
          # Render our toolbar
          
          u'  <input type="button" value="%s" ' % _("Hide/Show Word"),
          u' onclick="tinyMCE.execInstanceCommand(\'%s\',\'Underline\', false);" />' % self.editorId,
          u'</br></br>',
        
          common.formField('textInput',
                          '',
                          _('Other words'),
                          'clOtras'+self.id, '',
                          self.field.otrasInstruc,
                          self.field.otras,
                          size=80, 
                          default_prompt = "Enter additional words for learners to select from separated by ,"),
         
 
          u'</br></br>',
          ]
      
      return '\n    '.join(html)
Example #35
0
    def renderEdit(self):
        """
        Returns an XHTML string with the form element for editing this field
        """
        html  = common.textInput("name"+self.id, self.field.name, 25)
        html += common.submitImage("deleteField", self.id, 
                                   "/images/stock-cancel.png", 
                                   _("Delete"), 1)
        html += "<br/>\n"

        this_package = None
        html += common.formField('richTextArea', this_package, '','instruc',
                                 self.id, '',
                                 self.field.instruc)
        return html
Example #36
0
 def renderEdit(self):
     """
     Returns an XHTML string for editing this option element
     """
     html  = common.formField('richTextArea',_(u'Question:'),'',
                             self.questionId, self.idevice.questionInstruc,
                             self.question_question.field.content)
     html += _("True") + " " 
     html += common.option(self.keyId, self.question_isCorrect, "true") 
     html += _("False") + " " 
     html += common.option(self.keyId, not self.question_isCorrect, "false") 
     html += "<br/><br/>\n"
     html += common.elementInstruc(self.idevice.keyInstruc)
     html += common.formField('richTextArea',_(u'Feedback'),'',
                             self.feedbackId, self.idevice.feedbackInstruc,
                             self.question_feedback.field.content)
     html += common.formField('richTextArea',_(u'Hint'),'',
                             self.hintId, self.idevice.hintInstruc,
                             self.question_hint.field.content)
     html += common.submitImage(self.id, self.idevice.id, 
                                "/images/stock-cancel.png",
                                _("Delete question"))
     html += "<br/><br/>\n"
     return html
Example #37
0
    def renderEdit(self, style):
        """
        Returns an XHTML string with the form elements for editing this block
        """
        log.debug("renderEdit")

        html = u"<div class=\"iDevice\"><br/>\n"
        print self.idevice.message
        if self.idevice.message != "":
            html += common.editModeHeading(self.idevice.message)
            html += common.elementInstruc(self.idevice.kpseInstruc_)
            html += common.textInput("kpse" + self.id, self.idevice.latexpath)
            html += u'<input type="button" onclick="addKpsepath(\'%s\')"' % self.id
            html += u"value=\"%s\"/>\n" % _(u"Search")
            html += u"<br/><br/>\n"

        html += common.textInput("title" + self.id,
                                 self.idevice.title) + "<br/><br/>"

        this_package = None
        if self.idevice is not None and self.idevice.parentNode is not None:
            this_package = self.idevice.parentNode.package

        html += common.textInput("path" + self.id, self.idevice.source)
        html += u'<input type="button" onclick="addTeX(\'%s\')"' % self.id
        html += u"value=\"%s\"/>\n" % _(u"Add file")
        html += common.submitButton(u"loadSource" + self.id, _(u"Load"))

        html += u"<br/>\n"
        html += self.articleElement.renderEdit()
        emphasisValues = [(_(u"No emphasis"), Idevice.NoEmphasis),
                          (_(u"Some emphasis"), Idevice.SomeEmphasis)]

        html += common.formField(
            'select',
            this_package,
            _('Emphasis'),
            'emphasis',
            self.id,
            '',  # TODO: Instructions
            emphasisValues,
            self.idevice.emphasis)

        html += self.renderEditButtons(undo=self.idevice.undo)
        html += u"</div>\n"
        return html
Example #38
0
    def renderEdit(self, style):
        """
        Returns an XHTML string with the form elements for editing this block
        """
        log.debug("renderEdit")
        html = u'<div class="iDevice">\n'
        html += u'<div class="block">\n'

        label = _(u'Filename:')
        if self.idevice.userResources:
            label += u': '
            label += u'<span style="text-decoration:underline">'
            label += self.idevice.userResources[0].storageName
            label += u'</span>\n'
        html += u'<div>'
        this_package = None
        if self.idevice is not None and self.idevice.parentNode is not None:
            this_package = self.idevice.parentNode.package
        html += common.formField('textInput',
                                 this_package,
                                 label,
                                 'path' + self.id,
                                 '',
                                 self.idevice.filenameInstruc,
                                 size=40)
        html += u'<input type="button" onclick="addFile(\'%s\')"' % self.id
        html += u' value="%s" />\n' % _(u"Select a file")
        html += u'</div><br style="clear:both;" />'
        html += u'</div>\n'
        html += u'<div class="block">\n'
        html += u'\n<b>%s</b>\n' % _(u'Label:')
        html += common.elementInstruc(self.idevice.labelInstruc)
        html += u'</div>\n'
        html += common.textInput(u'label' + self.id, self.idevice.label)
        html += self.descriptionElement.renderEdit()
        html += u'<div class="block">\n'
        html += self.renderEditButtons()
        html += u'</div>\n'
        html += u'\n</div>\n'

        return html
Example #39
0
 def renderEdit(self, style):
     """
     Returns an XHTML string with the form element for editing this block
     """
     html = u"<div>\n"
     html += self.contentElement.renderEdit()
     ## drop down menu defines if element is exported for presentation
     this_package = None
     if self.idevice is not None and self.idevice.parentNode is not None:
         this_package = self.idevice.parentNode.package
     html += common.formField(
         'select',
         this_package,
         _("Custom export options"),
         "export" + self.id,
         options=[[_('Don\'t export'), freetextidevice.NOEXPORT],
                  [_('Presentation'), freetextidevice.PRESENTATION],
                  [_('Handout'), freetextidevice.HANDOUT]],
         selection=self.idevice.exportType)
     html += self.renderEditButtons()
     html += u"</div>\n"
     return html
Example #40
0
 def renderEdit(self, style):
     """
     Returns an XHTML string with the form element for editing this block
     """
     heightArr = [['small', '300'],
                 ['normal', '500'],
                 ['large', '700']]
     html  = u'<div><div class="block">\n'
     html += u"<strong>%s</strong>" % _("PDF import")
     html += common.elementInstruc(self.idevice.appletInstruc)
     html += u'</div>'
     html += u'<div class="block">\n'
     html += u"<strong>%s</strong>" % _("Path to PDF file")
     html += u'</div>\n'
     html += u'<div class="block">\n'
     html += common.textInput("path"+self.id, self.idevice.path, 50) 
     html += u'<input type="button" onclick="addPdf(\'%s\')"' % self.id
     html += u"value=\"%s\"/>\n" % _(u"Add file")
     html += u'</div>'
     html += u'<div class="block">\n'
     html += u"<strong>%s</strong>" % _("Pages to import")
     html += common.elementInstruc(self.idevice.pagesInstruc)
     html += u'</div>\n'
     html += u'<div class="block">\n'
     html += common.textInput("pages"+self.id, self.idevice.pages, 10)
     html += u"</div>\n"
     html += u"<div>\n"
     this_package = None
     if self.idevice is not None and self.idevice.parentNode is not None:
         this_package = self.idevice.parentNode.package
     html += common.formField('select', this_package, _('Frame Height:'),
             "height" + self.id, options = heightArr, 
             selection = self.idevice.height)
     html += u"</div>\n"
     for element in self.elements:
         html += element.renderEdit() + "<br/>"
     html += u"</div>\n"
     html += self.renderEditButtons()
     return html
Example #41
0
    def renderPreview(self):
        """
        Returns an XHTML string with the form element for previewing this field
        """
        html  = "<b>" + self.field.name + "</b> "
        if self.field.instruc != "":
            html += common.elementInstruc(self.field.instruc)
        html += "<br/>" 
        html += common.image("img"+self.id, 
                             "/images/"+ImageEditorElement.DefaultImage,
                             self.field.width,
                             self.field.height)
        floatArr    = [[_(u'Left'), 'left'],
                      [_(u'Right'), 'right'],
                      [_(u'None'),  'none']]

        this_package = None
        html += common.formField('select', this_package, _("Align:"),
                                 "float" + self.id, '',
                                 '',
                                 floatArr, '')
        html += "<br/>\n"
        return html
Example #42
0
    def renderIdevice(self, request):
        """
        Returns an XHTML string for rendering the new idevice
        """
        html = "<div id=\"editorWorkspace\">\n"
        html += "<script type=\"text/javascript\">\n"
        html += "<!--\n"
        html += """
            function selectStyleIcon(icon,e) {
                var div = document.getElementById("styleIcons");
                var imgs = div.getElementsByTagName("IMG");
                for (var i=0;i<imgs.length;i++) {
                    imgs[i].style.border = "1px solid #E8E8E8";
                }
                e.style.border = "1px solid #333333";            
                submitLink("selectIcon",icon,1);
            }        
            function submitLink(action, object, changed) 
            {
                var form = document.getElementById("contentForm")
                form.action.value = action;
                form.object.value = object;
                form.isChanged.value = changed;
                form.submit();
            }\n"""
        html += """
            function submitIdevice() 
            {
                var form = document.getElementById("contentForm")
                if (form.ideviceSelect.value == "newIdevice")
                    form.action.value = "newIdevice"
                else
                    form.action.value = "changeIdevice"
                form.object.value = form.ideviceSelect.value;
                form.isChanged.value = 1;
                form.submit();
            }\n"""
        html += """
            function submitStyle()
            {
                var form = document.getElementById("contentForm")
                form.action.value = "changeStyle";
                form.object.value = form.styleSelect.value;
                form.isChanged.value = 0;
                form.submit();
            }\n"""
        html += "//-->\n"
        html += "</script>\n"

        self.purpose = self.idevice.purpose.replace("\r", "")
        self.purpose = self.purpose.replace("\n", "\\n")

        self.tip = self.idevice.tip.replace("\r", "")
        self.tip = self.tip.replace("\n", "\\n")

        if self.idevice.edit:
            html += "<b>" + _("Name") + ": </b>\n"
            html += common.elementInstruc(self.nameInstruc) + "<br/>"
            html += '<input type="text" name= "title" id="title" value="%s"/>' % self.idevice.title

            this_package = None
            html += common.formField('richTextArea', this_package,
                                     _(u"Pedagogical Tip"), 'tip', '',
                                     self.tipInstruc, self.tip)

            html += "<b>" + _("Emphasis") + ":</b> "
            html += "<select onchange=\"submit();\" name=\"emphasis\">\n"

            emphasisValues = {
                Idevice.NoEmphasis: _(u"No emphasis"),
                Idevice.SomeEmphasis: _(u"Some emphasis")
            }
            for value, description in emphasisValues.items():
                html += "<option value=\"" + unicode(value) + "\" "
                if self.idevice.emphasis == value:
                    html += "selected "
                html += ">" + description + "</option>\n"

            html += "</select> \n"
            html += common.elementInstruc(self.emphasisInstruc)
            html += "<br/><br/>\n"

            if self.idevice.emphasis > 0:
                html += self.__renderStyles() + " "
                html += u'<a style="margin-right:.5em" href="javascript:void(0)" '
                html += u'onclick="showMessageBox(\'iconpanel\');">'
                html += u'%s</a>' % _('Select an icon')
                icon = self.idevice.icon
                if icon != "":

                    iconExists = False
                    myIcon = Path(G.application.config.stylesDir /
                                  self.style.get_dirname() / "icon_" +
                                  self.idevice.icon + ".gif")
                    if myIcon.exists():
                        iconExists = True
                    else:
                        myIcon = Path(G.application.config.stylesDir /
                                      self.style.get_dirname() / "icon_" +
                                      self.idevice.icon + ".png")
                        if myIcon.exists():
                            iconExists = True
                    if iconExists:
                        html += '<img style="vertical-align:middle;max-width:60px;height:auto" '
                        html += 'src="/style/%s/icon_%s' % (
                            self.style.get_dirname(), icon)
                        html += '%s"/><br />' % myIcon.ext

                html += u'<div style="display:none;z-index:99;">'
                html += u'<div id="iconpaneltitle">' + _("Icons") + '</div>'
                html += u'<div id="iconpanelcontent">'
                html += self.__renderIcons()
                html += u'</div>'
                html += u'</div>\n'
                html += u'<br style="clear:both;margin-bottom:10px" />'
            for element in self.elements:
                html += element.renderEdit()
        else:
            html += "<b>" + self.idevice.title + "</b><br/><br/>"
            for element in self.elements:
                html += element.renderPreview()
            if self.idevice.purpose != "" or self.idevice.tip != "":
                html += "<a title=\"" + _("Pedagogical Help") + "\" "
                html += "onclick=\"showMessageBox('phelp');\" "
                html += "href=\"javascript:void(0)\" style=\"cursor:help;\">\n "
                html += '<img alt="%s" src="/images/info.png" border="0" ' % _(
                    'Info')
                html += "align=\"middle\" /></a>\n"
                html += "<div style='display:none;'>"
                if self.idevice.purpose != "":
                    html += "<div id='phelptitle'>" + _('Purpose') + "</div>"
                    html += "<div id='phelpcontent'>" + self.purpose + "</div>"
                if self.idevice.tip != "":
                    html += "<div id='phelptitle'>" + _('Tip:') + "</div>"
                    html += "<div id='phelpcontent'>" + self.idevice.tip + "</div>"
                html += "</div>"
                html += "</div>\n"
        html += "</div>\n"
        self.message = ""

        return html
Example #43
0
    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')
Example #44
0
    def renderEdit(self, style):
        """
        Renders a table of thumbnails allowing the user to
        move/add/delete/change each gallery image
        """
        this_package = None
        if self.idevice is not None and self.idevice.parentNode is not None:
            this_package = self.idevice.parentNode.package
        html = [u'<div class="iDevice">',
                common.formField('textInput', this_package, _('Title'),
                                 "title"+self.id, '',
                                 self.idevice.titleInstruc,
                                 self.idevice.title),
                u'<div class="block">',
                u'<input type="button" ',
                u'onclick="addGalleryImage(\'%s\')"' % self.id,
                u'value="%s" />\n' % _(u"Add images"),
                common.elementInstruc(self.idevice.addImageInstr),
                u'</div>',
                ]

        if len(self.idevice.images) == 0:
            html += [u'<p class="exeImageGallery no-images">',
                    _(u'No Images Loaded'),
                    u'</p>']
        else:
            def genCell(image, i, id):
                """Generates a single cell of our table"""
                def submitLink(method):
                    """Makes submitLink javascript code"""
                    method = 'gallery.%s.%s' % (method, image.id)
                    params = "'%s', %s, true" % (method, self.id)
                    return "javascript:submitLink(%s)" % params

                def confirmThenSubmitLink(msg, method):
                    method = 'gallery.%s.%s' % (method, image.id)
                    params = "'%s', '%s', %s, true" % (re.escape(msg), method, self.id)
                    return "javascript:confirmThenSubmitLink(%s)" % params
                changeGalleryImage = '\n'.join([
                        u'<a title="%s"' % _(u'Change Image'),
                        u' href="#" ',
                        u' onclick="changeGalleryImage(' +
                        u"'%s', '%s')" % (self.id, image.id) +
                        u'">'])
                result = [changeGalleryImage,
                          u'<img class="exeImageGallery-thumbnail"',
                          u' alt="%s"' % image.caption,
                          u' src="%s"/></a>' % image.thumbnailSrc,
                          u'<span>',
                          u'<input id="caption%s" ' % image.id,
                          u' name="caption%s" ' % image.id,
                          u' value="%s" ' % image.caption,
                          u' />',
                          # Edit button
                          changeGalleryImage,
                          u'<img alt="%s"' % _(u'Change Image'),
                          u' class="submit" width="16" height="16"'
                          u' src="/images/stock-edit.png"/>'
                          u'</a> ']
                # Move left button
                if image.index > 0:
                    result += [
                          u'<a title="%s"' % _(u'Move Image Left'),
                          u' href="%s">' % submitLink('moveLeft'),
                          u'<img alt="%s"' % _(u'Go Back'),
                          u' class="submit" width="16" height="16"'
                          u' src="/images/stock-go-back.png"/>'
                          u'</a> ',
                          ]
                else:
                    result += [
                          u'<img class="submit" width="16" height="16"'
                          u' src="/images/stock-go-back-off.png"/>']
                # Move right button
                if image.index < len(image.parent.images)-1:
                    result += [
                          u' <a title="%s"' % _(u'Move Image Right'),
                          u' href="%s">' % submitLink('moveRight'),
                          u'<img alt="%s"' % _(u'Go Forward'),
                          u' class="submit" width="16" height="16"'
                          u' src="/images/stock-go-forward.png" /></a>',
                          ]
                else:
                    result += [
                          u'<img alt="%s" ' % _(u'Go Forward (Not Available)'),
                          u' class="submit" width="16" height="16"'
                          u' src="/images/stock-go-forward-off.png"/>']
                result += [
                          # Delete button
                          u' <a title="%s"' % _(u'Delete Image'),
                          u' href="%s">' % (confirmThenSubmitLink(_('Delete this image?'), 'delete')),
                          u'<img class="submit" width="16" height="16" alt="%s" ' \
                                                        % _(u'Delete'),
                          u' src="/images/stock-delete.png" /></a>',
                          u' <a href="javascript:addGalleryImage(%s)"' % id,
                          u' title="%s"><img src="/images/stock-add.png"' % _(u"Add images"),
                          u' class="submit" width="16" height="16" alt="%s" /></a>' % _(u"Add images"),
                          u'      </span>']
                return result
            html += self._generateTable(genCell)
        html += [self.renderEditButtons(undo=self.idevice.undo),
                 u'</div>']
        return u'\n    '.join(html)
Example #45
0
    def renderEdit(self, style):
        """
        Returns an XHTML string with the form elements for editing this block
        """
        log.debug("renderEdit")

        html = u"<div class=\"iDevice\"><br/>\n"
        html += common.textInput("title" + self.id,
                                 self.idevice.title) + "<br/><br/>"

        sites = [
            (_(u"English Wikipedia Article"), "http://en.wikipedia.org/wiki/"),
            (_(u"Basque Wikipedia Article"), "http://eu.wikipedia.org/wiki/"),
            (_(u"Catalan Wikipedia Article"), "http://ca.wikipedia.org/wiki/"),
            (_(u"Chinese Wikipedia Article"), "http://zh.wikipedia.org/wiki/"),
            (_(u"Dutch Wikipedia Article"), "http://nl.wikipedia.org/wiki/"),
            (_(u"French Wikipedia Article"), "http://fr.wikipedia.org/wiki/"),
            (_(u"German Wikipedia Article"), "http://de.wikipedia.org/wiki/"),
            (_(u"Galician Wikipedia Article"),
             "http://gl.wikipedia.org/wiki/"),
            (_(u"Greek Wikipedia Article"), "http://el.wikipedia.org/wiki/"),
            (_(u"Italian Wikipedia Article"), "http://it.wikipedia.org/wiki/"),
            (_(u"Japanese Wikipedia Article"),
             "http://ja.wikipedia.org/wiki/"),
            (_(u"Magyar Wikipedia Article"), "http://hu.wikipedia.org/wiki/"),
            (_(u"Polish Wikipedia Article"), "http://pl.wikipedia.org/wiki/"),
            (_(u"Portugese Wikipedia Article"),
             "http://pt.wikipedia.org/wiki/"),
            (_(u"Slovenian Wikipedia Article"),
             "http://sl.wikipedia.org/wiki/"),
            (_(u"Spanish Wikipedia Article"), "http://es.wikipedia.org/wiki/"),
            (_(u"Swedish Wikipedia Article"), "http://sv.wikipedia.org/wiki/"),
            (_(u"Wikibooks Article"), "http://en.wikibooks.org/wiki/"),
            (_(u"Wikiversity"), "http://en.wikiversity.org/wiki/"),
            (_(u"Wiktionary"), "http://en.wiktionary.org/wiki/"),
            (_(u"Wikieducator Content"), "http://wikieducator.org/"),
            (_(u"Other"), "")
        ]

        this_package = None
        if self.idevice is not None and self.idevice.parentNode is not None:
            this_package = self.idevice.parentNode.package
        html += common.formField('select', this_package, _('Site'), 's',
                                 'site' + self.id, self.idevice.langInstruc,
                                 sites, self.idevice.site)

        url = "none"
        if self.idevice.site == "":
            url = "block"
        html += '<div style="display:%s"> %s: <br/>' % (url, _("Own site"))
        html += common.textInput("ownUrl" + self.id,
                                 self.idevice.ownUrl) + '<br/></div>'
        html += "<br/>"
        html += common.textInput("article", self.idevice.articleName)
        html += common.elementInstruc(self.idevice.searchInstruc)
        html += common.submitButton(u"loadWikipedia" + self.id, _(u"Load"))

        html += u"<br/>\n"
        html += self.articleElement.renderEdit()
        emphasisValues = [(_(u"No emphasis"), Idevice.NoEmphasis),
                          (_(u"Some emphasis"), Idevice.SomeEmphasis)]

        html += common.formField(
            'select',
            this_package,
            _('Emphasis'),
            'emphasis',
            self.id,
            '',  # TODO: Instructions
            emphasisValues,
            self.idevice.emphasis)

        html += self.renderEditButtons(undo=self.idevice.undo)
        html += u"</div>\n"
        return html
Example #46
0
    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 renderIdevice(self, request):
        """
        Returns an XHTML string for rendering the new idevice
        """
        html = "<div id=\"editorWorkspace\">\n"
        html += "<script type=\"text/javascript\">\n"
        html += "<!--\n"
        html += """
            function submitLink(action, object, changed) 
            {
                var form = document.getElementById("contentForm")
            
                form.action.value = action;
                form.object.value = object;
                form.isChanged.value = changed;
                form.submit();
            }\n"""
        html += """
            function submitIdevice() 
            {
                var form = document.getElementById("contentForm")
                if (form.ideviceSelect.value == "newIdevice")
                    form.action.value = "newIdevice"
                else
                    form.action.value = "changeIdevice"
                form.object.value = form.ideviceSelect.value;
                form.isChanged.value = 1;
                form.submit();
            }\n"""
        html += """
            function submitStyle()
            {
                var form = document.getElementById("contentForm")
                form.action.value = "changeStyle";
                form.object.value = form.styleSelect.value;
                form.isChanged.value = 0;
                form.submit();
            }\n"""
        html += "//-->\n"
        html += "</script>\n"

        self.purpose = self.idevice.purpose.replace("\r", "")
        self.purpose = self.purpose.replace("\n", "\\n")

        self.tip = self.idevice.tip.replace("\r", "")
        self.tip = self.tip.replace("\n", "\\n")

        if self.idevice.edit:
            html += "<b>" + _("Name") + ": </b>\n"
            html += common.elementInstruc(self.nameInstruc) + "<br/>"
            html += '<input type="text" name= "title" id="title" value="%s"/>' % self.idevice.title

            this_package = None
            html += common.formField('richTextArea', this_package,
                                     _(u"Pedagogical Tip"), 'tip', '',
                                     self.tipInstruc, self.tip)

            html += "<b>" + _("Emphasis") + ":</b> "
            html += "<select onchange=\"submit();\" name=\"emphasis\">\n"

            emphasisValues = {
                Idevice.NoEmphasis: _(u"No emphasis"),
                Idevice.SomeEmphasis: _(u"Some emphasis")
            }
            for value, description in emphasisValues.items():
                html += "<option value=\"" + unicode(value) + "\" "
                if self.idevice.emphasis == value:
                    html += "selected "
                html += ">" + description + "</option>\n"

            html += "</select> \n"
            html += common.elementInstruc(self.emphasisInstruc)
            html += "<br/><br/>\n"

            if self.idevice.emphasis > 0:
                html += self.__renderStyles() + " "
                html += u'<a href="#" '
                html += u'onmousedown="Javascript:updateCoords(event);"\n'
                html += u'onclick="Javascript:showMe(\'iconpanel\', 350, 100);">'
                html += u'Select an icon:</a> \n'
                icon = self.idevice.icon
                if icon != "":
                    html += '<img align="middle" '
                    html += 'src="/style/%s/icon_%s' % (
                        self.style.get_dirname(), icon)
                    html += '.gif"/><br/>'
                html += u'<div id="iconpanel" style="display:none; z-index:99;">'
                html += u'<div style="float:right;" >\n'
                html += u'<img alt="%s" ' % _("Close")
                html += u'src="/images/stock-stop.png" title="%s"\n' % _(
                    "Close")
                html += u'onmousedown="Javascript:hideMe();"/></div><br/> \n'
                html += u'<div align="center"><b>%s:</b></div><br/>' % _(
                    "Icons")
                html += self.__renderIcons()
                html += u'</div><br/>\n'
            for element in self.elements:
                html += element.renderEdit()
        else:
            html += "<b>" + self.idevice.title + "</b><br/><br/>"
            for element in self.elements:
                html += element.renderPreview()
            if self.idevice.purpose != "" or self.idevice.tip != "":
                html += "<a title=\"" + _("Pedagogical Help") + "\" "
                html += "onmousedown=\"Javascript:updateCoords(event);\" \n"
                html += "onclick=\"Javascript:showMe('phelp', 380, 240);\" \n"
                html += "href=\"Javascript:void(0)\" style=\"cursor:help;\">\n "
                html += '<img alt="%s" src="/images/info.png" border="0" \n' % _(
                    'Info')
                html += "align=\"middle\" /></a>\n"
                html += "<div id=\"phelp\" style=\"display:none;\">\n"
                html += "<div style=\"float:right;\" "
                html += '<img alt="%s" src="/images/stock-stop.png" \n' % _(
                    'Close')
                html += " title='" + _(
                    "Close") + "' border='0' align='middle' \n"
                html += "onmousedown=\"Javascript:hideMe();\"/></div>\n"
                if self.idevice.purpose != "":
                    html += "<b>Purpose:</b><br/>%s<br/>" % self.purpose

                if self.idevice.tip != "":
                    html += "<b>Tip:</b><br/>%s<br/>" % self.idevice.tip

                html += "</div>\n"
        html += "</div>\n"
        self.message = ""

        return html
Example #48
0
    def renderEdit(self, style):
        """
        Returns an XHTML string with the form elements for editing this block
        """
        log.debug("renderEdit")
        floatArr = [[_(u'Left'), 'left'], [_(u'Right'), 'right'],
                    [_(u'None'), 'none']]
        html = u"<div class=\"iDevice\">\n"

        # Caption
        html += '<div class="block">'
        html += u"<strong>%s</strong>" % _(u"Caption:")
        html += common.elementInstruc(self.idevice.captionInstruc)
        html += '</div>'
        html += '<div class="block">'
        html += common.textInput("caption" + self.id, self.idevice.caption)
        html += '</div>'

        # Text
        html += '<div class="block">'
        html += self.textElement.renderEdit()
        html += '</div>'

        # Image
        html += self.imageMagnifierElement.renderEdit()

        this_package = None
        if self.idevice is not None and self.idevice.parentNode is not None:
            this_package = self.idevice.parentNode.package

        # Align
        html += common.formField('select', this_package, _("Align:"),
                                 "float" + self.id, '',
                                 self.idevice.alignInstruc, floatArr,
                                 self.idevice.float)

        # Initial and Max Zoom opts
        zoomOpts = []
        for i in range(100, 201, 10):
            zoomOpts.append(('%d%%' % (i), str(i)))

        # Initial Zoom Size
        selection = self.idevice.imageMagnifier.initialZSize
        html += common.formField('select', this_package, _(u"Initial Zoom"),
                                 "initial" + self.id, '',
                                 self.idevice.initialZoomInstruc, zoomOpts,
                                 selection)

        # Maximum Zoom
        selection = self.idevice.imageMagnifier.maxZSize
        html += common.formField('select', this_package, _(u"Maximum zoom"),
                                 "maxZoom" + self.id, '',
                                 self.idevice.maxZoomInstruc, zoomOpts,
                                 selection)

        # Size of Magnifying Glass
        glassSizeArr = [
            [_(u'Small'), '1'],
            [_(u'Medium'), '2'],
            [_(u'Large'), '3'],
            [_(u'Extra large'), '4'],
        ]
        html += common.formField('select', this_package,
                                 _(u"Size of magnifying glass: "),
                                 "glass" + self.id, '',
                                 self.idevice.glassSizeInstruc, glassSizeArr,
                                 self.idevice.imageMagnifier.glassSize)

        html += self.renderEditButtons(undo=self.idevice.undo)
        html += u"</div>\n"
        return html