コード例 #1
0
ファイル: FormGenerator.php プロジェクト: neoclust/mmc
 /**
  *  display input Element
  *  $arrParam accept ["value"] to corresponding value
  */
 function display($arrParam = array())
 {
     if (empty($arrParam)) {
         $arrParam = $this->options;
     }
     if (!isset($this->cssErrorName)) {
         $this->cssErrorName = $this->template->name;
     }
     printf('<tr');
     if ($this->class !== null) {
         printf(' class="%s"', $this->class);
     }
     if ($this->style !== null) {
         printf(' style="%s"', $this->style);
     }
     printf('><td class="label" width="%s" ', $this->firstColWidth);
     print displayErrorCss($this->cssErrorName);
     print 'style = "text-align: right;">';
     //if we got a tooltip, we show it
     if ($this->tooltip) {
         print "<a href=\"#\" class=\"tooltip\">" . $this->desc . "<span>" . $this->tooltip . "</span></a>";
     } else {
         print $this->desc;
     }
     print '</td><td>';
     // set hidden form with old_value for each TrFormElement field
     if (isset($arrParam["value"])) {
         // if checkbox
         if ($arrParam["value"] == "checked") {
             $old_value = "on";
         } else {
             $old_value = $arrParam["value"];
         }
     } else {
         $old_value = "";
     }
     if (is_object($this->template)) {
         $field_name = $this->template->name;
     } else {
         if (is_array($this->template)) {
             $field_name = $this->template["name"];
         } else {
             $field_name = "";
         }
     }
     if ($field_name && is_string($old_value)) {
         print '<input type="hidden" name="old_' . $field_name . '" value="' . $old_value . '" />';
     }
     // display real field
     parent::display($arrParam);
     if (isset($arrParam["extra"])) {
         print "&nbsp;" . $arrParam["extra"];
     }
     print "</td></tr>";
 }
コード例 #2
0
ファイル: editacl.php プロジェクト: sebastiendu/mmc
 /**
  *  display input Element
  *  $arrParam accept ["value"] to corresponding value
  */
 function display($arrParam = array())
 {
     if (empty($arrParam)) {
         $arrParam = $this->options;
     }
     if (!isset($this->cssErrorName)) {
         $this->cssErrorName = $this->template->name;
     }
     if ($this->rowNum % 2) {
         print '
         <tr class="alternate"><td width="50%" ';
     } else {
         print '<tr><td ';
     }
     print displayErrorCss($this->cssErrorName);
     print 'style = "text-align: left;">';
     if ($this->tab) {
         print '<dd>';
     }
     //if we got a tooltip, we show it
     if ($this->tooltip) {
         print "<a href=\"#\" class=\"tooltip\">" . $this->desc . "<span>" . $this->tooltip . "</span></a>";
     } else {
         if (!isset($this->template)) {
             print '<h2>' . $this->desc . '</h2>';
         } else {
             print $this->desc;
         }
     }
     print '</td><td style = "text-align: left;">';
     if (isset($this->template)) {
         if (!empty($this->arrparam)) {
             parent::display($this->arrparam);
         } else {
             parent::display($arrParam);
         }
     }
     if (isset($arrParam["extra"])) {
         print "&nbsp;" . $arrParam["extra"];
     }
     print "</td></tr>\n        ";
 }
コード例 #3
0
ファイル: MultipleInput.tpl.php プロジェクト: sebastiendu/mmc
if (isset($_POST[$name])) {
    $arr = $_POST[$name];
} else {
    $arr = array();
}
if (isset($_POST['del'])) {
    if (count($arr) > 1) {
        unset($arr[$_POST['del']]);
    } else {
        if (count($arr) == 1) {
            $arr[$_POST['del']] = '';
        }
    }
} else {
    $arr[] = '';
}
$arr = array_values($arr);
global $aclArray;
if (!isset($aclArray)) {
    /*
     * When this template is reloaded, we loose $aclArray, and this triggesr a PHP warning on some PHP version.
     * We can safely set it to an empty array.
     */
    $aclArray = array();
}
$mtpl = new MultipleInputTpl($name, urldecode($_POST['desc']), true);
$mtpl->setRegexp(stripslashes(rawurldecode($_POST['regexp'])));
$fe = new FormElement(_T($name), $mtpl);
$fe->setCssError($name);
$fe->display($arr);
コード例 #4
0
ファイル: details.php プロジェクト: sebastiendu/mmc
}
global $__TPLref;
$__TPLref["autocomplete"] = "admin";
renderTPL("groups");
?>

</table>

<?php 
if (!isset($customParameters) || empty($customParameters)) {
    $customParameters = array('');
}
$cp = new MultipleInputTpl("customparameters", _("Custom parameters"));
$cp->setRegexp('/^[a-z: _]+[ ]*=.*$/');
$cpf = new FormElement(_("Custom parameters"), $cp);
$cpf->display($customParameters);
?>

</div>

<?php 
if ($_GET["action"] == "add") {
    ?>
<input name="bcreate" type="submit" class="btnPrimary" value="<?php 
    echo _T("Create");
    ?>
" />
<?php 
} else {
    ?>
<input name="share" type="hidden" value="<?php 
コード例 #5
0
ファイル: network2.inc.php プロジェクト: neoclust/mmc
    function display($arrParam = array()) {
        if (empty($arrParam)) $arrParam = $this->options;

        if ($this->key==0) {
            $desc = $this->desc;
        } else {
            $desc = '';
        }

	if ($this->ajaxPage == ""){
            $this->ajaxPage = "includes/FormGenerator/MultipleInput.tpl.php";
	}

        // set hidden form with old_value for each DeletableTrFormElement field
        // set a random old_value if some field has been created
        if($this->new) {
            $old_value = uniqid();
        }
        else if(isset($arrParam["value"])) {
            $old_value = $arrParam["value"];
        }
        else {
            $old_value = "";
        }
        if(is_object($this->template)) {
            $field_name = $this->template->name;
        }
        else if(is_array($this->template)) {
            $field_name = $this->template["name"];
        }
        else {
            $field_name = "";
        }
        if ($field_name) {
            print '<input type="hidden" name="old_'.$field_name.'" value="'.$old_value.'" />';
        }

        print '<tr><td width="40%" ';
        print displayErrorCss($this->cssErrorName);
        print 'style = "text-align: right;">';

        //if we got a tooltip, we show it
        if ($this->tooltip) {
            print "<a href=\"#\" class=\"tooltip\">".$desc."<span>".$this->tooltip."</span></a>";
        } else {
            print $desc;
        }
        print '</td><td>';

        // reald field display
        FormElement::display($arrParam);
        print '<input name="bdel" type="submit" class="btnSecondary" value="'._("Delete").'" onclick="
        new Ajax.Updater(\''.$this->name.'\',\''.$this->ajaxPage.'\',
        { parameters: Form.serialize($(\'' . $this->formId . '\'))+\'&amp;minputname='.$this->name.'&amp;del='.$this->key.'&amp;desc='.urlencode($this->desc) . '&amp;regexp='.rawurlencode($this->template->regexp) . '\' }); return false;"/>';

        print '</td></tr>';

    }