예제 #1
0
 /**
  * Returns a block of XHTML-valid code that contains markup for this specific
  * component. 
  * @param string $fieldName The field name to use when outputting form data or
  * similar parameters/information.
  * @access public
  * @return string
  */
 function getMarkup($fieldName)
 {
     $fromParent = parent::getMarkup($fieldName);
     // make sure that we add the form info to the markup
     $harmoni = Harmoni::instance();
     $urlObj = $harmoni->request->mkURL();
     $url = $urlObj->write();
     $formName = $this->getWizardFormName();
     $pre = "<form action='{$url}' method='post' name='{$formName}' id='{$formName}' enctype='multipart/form-data'>\n";
     $post = "\n</form>\n";
     // The removal of this confirmation on submission was added to
     // Wizard.abstract.php
     if (isset($this->confirmLeaving) && $this->confirmLeaving) {
         if (isset($this->confirmLeavingMessage) && $this->confirmLeavingMessage) {
             $string = $this->confirmLeavingMessage;
         } else {
             $string = dgettext("polyphony", "You in a wizard. Any unsubmitted changes will be lost.");
         }
         $post .= "\n<script type='text/javascript'>\n// <![CDATA[ \n\t\t\n\t\twindow.addUnloadConfirmationForElement(\"{$formName}\", \"{$string}\");\n\t\t\n\t\t// Override our parent's implementation to remove unload confirmation.\n\t\tfunction submitWizard(form) {\n\t\t\twindow.removeUnloadConfirmationForElement(form.id);\n\n\t\t\tif (validateWizard(form)) \n\t\t\t\tform.submit();\n\t\t}\n\t\n// ]]>\n</script>\n";
     }
     // ignore the field name
     return $fromParent . $pre . Wizard::parseText($this->_text, $this->getChildren(), $this->getIdString() . "_") . $post;
 }