예제 #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)
 {
     if ($this->_callBack != "") {
         $code = '$this->_contentText = ' . $this->_callBack . '($this);';
         eval($code);
     }
     return Wizard::parseText($this->_contentText, $this->getChildren(), $fieldName . "_");
 }
예제 #2
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;
 }
예제 #3
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)
 {
     $this->_currentFieldName = $fieldName;
     return Wizard::parseText($this->_contentText, $this->getChildren(), $this->getFieldName());
 }
 /**
  * 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)
 {
     // check if we have min/max values that are appropriate, etc.
     if ($this->_num < $this->_min) {
         $this->_num = $this->_min;
     }
     if ($this->_max != -1 && $this->_num > $this->_max) {
         $this->_num = $this->_max;
     }
     $this->_ensureNumber($this->_num);
     $includeAdd = !($this->_num == $this->_max);
     $includeRemove = !($this->_num == $this->_min);
     $m = "<table width='100%' border='0' cellspacing='0' cellpadding='2'>\n";
     $this->_orderedSet->reset();
     while ($this->_orderedSet->hasNext()) {
         $collectionId = $this->_orderedSet->next();
         $key = $collectionId->getIdString();
         $this->_collections[$key]["_remove"]->setEnabled($includeRemove);
         $m .= "<tr><td valign='top' style='border-bottom: 1px solid #555;'>";
         $m .= $this->_collections[$key]["_remove"]->getMarkup($fieldName . "_" . $key . "__remove");
         // Display the list
         $m .= "\n<br/>" . $this->_collections[$key]["_moveToPosition"]->getMarkup($fieldName . "_" . $key . "__moveToPosition");
         $m .= $this->_collections[$key]["_moveToPositionChoice"]->getMarkup($fieldName . "_" . $key . "__moveToPositionChoice");
         $m .= "</td><td style='border-bottom: 1px solid #555;'>";
         $m .= Wizard::parseText($this->_text, $this->_collections[$key], $fieldName . "_" . $key . "_");
         $m .= "</td></tr>\n";
     }
     $this->_addButton->setEnabled($includeAdd);
     $m .= "<tr><td colspan='2'>" . $this->_addButton->getMarkup($fieldName . "_add") . "</td></tr>\n";
     $m .= "</table>\n";
     return $m;
 }
 /**
  * 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)
 {
     // check if we have min/max values that are appropriate, etc.
     if ($this->_num < $this->_min) {
         $this->_num = $this->_min;
     }
     if ($this->_max != -1 && $this->_num > $this->_max) {
         $this->_num = $this->_max;
     }
     $this->_ensureNumber($this->_num);
     $includeAdd = !($this->_num == $this->_max);
     $includeRemove = !($this->_num == $this->_min);
     $cnt = 0;
     $pfunc = $this->_prefixFunction;
     $m = "<table width='100%' border='0' cellspacing='0' cellpadding='2'>\n";
     foreach (array_keys($this->_collections) as $key) {
         $this->_collections[$key]["_remove"]->setEnabled($includeRemove);
         $m .= "<tr>";
         $m .= "<td valign='top' style='border-bottom: 1px solid #555; width: 75px'>" . $this->_collections[$key]["_remove"]->getMarkup($fieldName . "_" . $key . "__remove") . "</td>";
         if ($pfunc) {
             $m .= "<td valign='middle' style='border-bottom: 1px solid #555;'>" . $pfunc($cnt, $this->_getAllValues($key)) . "</td>";
         }
         $m .= "<td style='border-bottom: 1px solid #555;'>";
         $m .= Wizard::parseText($this->_text, $this->_collections[$key], $fieldName . "_" . $key . "_");
         $m .= "</td></tr>\n";
         $cnt++;
     }
     $this->_addButton->setEnabled($includeAdd);
     $m .= "<tr><td colspan='2'>" . $this->_addButton->getMarkup($fieldName . "_add") . "</td></tr>\n";
     $m .= "</table>\n";
     return $m;
 }
 /**
  * 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)
 {
     return Wizard::parseText($this->_contentText, $this->getChildren(), $fieldName . "_");
 }
예제 #7
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
  */
 public function getMarkup($fieldName)
 {
     ob_start();
     print $this->getRulesJS($fieldName);
     print "\n<table border='1' class='radio_matrix row_radio_matrix'>";
     // Options Row
     print "\n\t<thead>";
     print "\n\t\t<tr>";
     print "\n\t\t\t<th></th>";
     // Fieldname column
     $options = $this->getOptions();
     for ($i = 0; $i < count($options); $i++) {
         print "\n\t\t\t<th class='option'>";
         if (!is_null($options[$i]->description)) {
             print "\n\t\t\t\t<a href='#' onclick=\"RadioMatrix.openDescriptionWindow(this, this.nextSibling); return false;\">";
         }
         print $options[$i]->displayText;
         if (!is_null($options[$i]->description)) {
             print "</a>";
             print "<textarea name='option{$i}_desc' style='display: none;' rows='1' cols='1'>";
             print $options[$i]->description;
             print "</textarea>";
             print "\n\t\t\t";
         }
         print "</th>";
     }
     print "\n\t\t</tr>";
     print "\n\t</thead>";
     // Fields rows
     $fields = $this->getFields();
     print "\n\t<tbody>";
     for ($i = 0; $i < count($fields); $i++) {
         if ($fields[$i]->spacerBefore !== false) {
             print "\n\t</tbody>\n\t<tbody>";
             print "\n\t\t<tr>\n\t\t\t<th colspan='" . (count($options) + 1) . "' class='spacer'>";
             if (strlen($fields[$i]->spacerBefore)) {
                 print $fields[$i]->spacerBefore;
             } else {
                 print " &nbsp; ";
             }
             print "</th>\n\t\t</tr>";
             print "\n\t</tbody>\n\t<tbody>";
         }
         print "\n\t<tr>";
         if (method_exists($this->_parent, 'getFieldName')) {
             $displayText = Wizard::parseText($fields[$i]->displayText, $this->_parent->getChildren(), $this->_parent->getFieldName());
         } else {
             $displayText = $fields[$i]->displayText;
         }
         print "\n\t\t<th class='field'>" . $displayText . "</th>";
         for ($j = 0; $j < count($options); $j++) {
             print "\n\t\t<td>" . $this->getMatrixButton($fieldName, $i, $j) . "</td>";
         }
         print "\n\t</tr>";
         if ($fields[$i]->spacerAfter !== false) {
             print "\n\t</tbody>\n\t<tbody>";
             print "\n\t\t<tr>\n\t\t\t<th colspan='" . (count($options) + 1) . "' class='spacer'>";
             if (strlen($fields[$i]->spacerAfter)) {
                 print $fields[$i]->spacerAfter;
             } else {
                 print " &nbsp; ";
             }
             print "</th>\n\t\t</tr>";
             print "\n\t</tbody>\n\t<tbody>";
         }
     }
     print "\n\t</tbody>";
     print "\n</table>";
     return ob_get_clean();
 }