本文整理汇总了PHP中ValidatingForm::add方法的典型用法代码示例。如果您正苦于以下问题:PHP ValidatingForm::add方法的具体用法?PHP ValidatingForm::add怎么用?PHP ValidatingForm::add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ValidatingForm
的用法示例。
在下文中一共展示了ValidatingForm::add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: AjaxFilter
// Rules list display
$ajax = new AjaxFilter(urlStrRedirect("shorewall/shorewall/ajax_" . $page));
$ajax->display();
$t = new TitleElement(_T("Rules"), 2);
$t->display();
$ajax->displayDivToUpdate();
// Add rule form
print '<script type="text/javascript" src="modules/shorewall/includes/functions.js"></script><br />';
$t = new TitleElement(_T("Add rule"), 2);
$t->display();
$f = new ValidatingForm(array("id" => "rule"));
$f->push(new Table());
$decisionTpl = new SelectItem("decision");
$decisionTpl->setElements(array(_T("Accept"), _T("Drop")));
$decisionTpl->setElementsVal(array("ACCEPT", "DROP"));
$f->add(new TrFormElement(_T("Decision"), $decisionTpl));
$src_zones = getZonesInterfaces($src);
if (count($src_zones) > 1) {
$sources = array("All");
$sourcesVals = array("all");
foreach ($src_zones as $zone) {
$sources[] = sprintf("%s (%s)", $zone[0], $zone[1]);
$sourcesVals[] = $zone[0];
}
$sourcesTpl = new SelectItem("source");
$sourcesTpl->setElements($sources);
$sourcesTpl->setElementsVal($sourcesVals);
$f->add(new TrFormElement(_T("Source"), $sourcesTpl));
} else {
$tr = new TrFormElement(_T("Source"), new HiddenTpl("source"));
$tr->setStyle("display: none");
示例2: stripslashes
*
* You should have received a copy of the GNU General Public License
* along with MMC; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
require "modules/samba/includes/machines.inc.php";
require "modules/samba/includes/samba.inc.php";
require "modules/samba/mainSidebar.php";
require "graph/navbar.inc.php";
if (isset($_POST["baddmach"])) {
$machine = $_POST["machine"];
$comment = stripslashes($_POST["comment"]);
add_machine($machine, $comment);
if (!isXMLRPCError()) {
new NotifyWidgetSuccess(sprintf(_T("Computer %s successfully added"), $machine));
header("Location: " . urlStrRedirect("samba/machines/index"));
exit;
}
}
$p = new PageGenerator(_T("Add a computer"));
$p->setSideMenu($sidemenu);
$p->display();
$f = new ValidatingForm();
$f->addSummary(_T("The computer name can only contains letters lowercase and numbers, and must begin with a letter."));
$f->push(new Table());
$f->add(new TrFormElement(_T("Computer name"), new NetbiosInputTpl("machine")), array("value" => $machine, "required" => True));
$f->add(new TrFormElement(_T("Comment"), new InputTpl("comment")), array("value" => $comment));
$f->pop();
$f->pop();
$f->addValidateButton("baddmach");
$f->display();
示例3: TitleElement
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with MMC. If not, see <http://www.gnu.org/licenses/>.
*/
/* common ajax includes */
require "../includes/ajaxcommon.inc.php";
$t = new TitleElement(_T("Imaging server configuration", "imaging"), 3);
$t->display();
$config = xmlrpc_getImagingServerConfig($location);
$imaging_server = $config[0];
$default_menu = $config[1];
$f = new ValidatingForm(array("action" => urlStrRedirect("imaging/manage/save_configuration")));
$f->add(new HiddenTpl("is_uuid"), array("value" => $imaging_server['imaging_uuid'], "hide" => True));
$lang = xmlrpc_getAllKnownLanguages();
$lang_choices = array();
$lang_values = array();
$lang_id2uuid = array();
foreach ($lang as $l) {
$lang_choices[$l['imaging_uuid']] = $l['label'];
$lang_values[$l['imaging_uuid']] = $l['imaging_uuid'];
$lang_id2uuid[$l['id']] = $l['imaging_uuid'];
}
$language = new SelectItem("language");
$language->setElements($lang_choices);
$language->setElementsVal($lang_values);
if ($imaging_server['fk_language']) {
$language->setSelected($lang_id2uuid[$imaging_server['fk_language']]);
}
示例4: AjaxFilter
$ajax = new AjaxFilter(urlStrRedirect("shorewall/shorewall/ajax_" . $page));
$ajax->display();
$t = new TitleElement(_T("Rules"), 2);
$t->display();
$ajax->displayDivToUpdate();
// Add rule form
print '<script type="text/javascript" src="modules/shorewall/includes/functions.js"></script><br />';
$t = new TitleElement(_T("Add rule"), 2);
$t->display();
$f = new ValidatingForm(array("id" => "rule"));
$f->push(new Table());
$decisionTpl = new SelectItem("decision");
$decisionTpl->setElements(array(_T("Accept"), _T("Drop")));
$decisionTpl->setElementsVal(array("ACCEPT", "DROP"));
$decisionTpl->setSelected(fromPOST("decisionTpl"));
$f->add(new TrFormElement(_T("Decision"), $decisionTpl));
$src_zones = getZonesInterfaces($src);
if (count($src_zones) > 1) {
$sources = array("All");
$sourcesVals = array("all");
foreach ($src_zones as $zone) {
$sources[] = sprintf("%s (%s)", $zone[0], $zone[1]);
$sourcesVals[] = $zone[0];
}
$sourcesTpl = new SelectItem("source");
$sourcesTpl->setElements($sources);
$sourcesTpl->setElementsVal($sourcesVals);
$sourcesTpl->setSelected(fromPOST("source"));
$f->add(new TrFormElement(_T("Source zone"), $sourcesTpl));
} else {
$tr = new TrFormElement(_T("Source zone"), new HiddenTpl("source"));
示例5: TitleElement
// Add NAT rule form
$t = new TitleElement(_T("Add NAT rule"), 2);
$t->display();
$f = new ValidatingForm();
$f->push(new Table());
$zones_types = getZonesTypes();
$external = array();
$externalVals = array();
foreach (getZonesInterfaces($zones_types["external"]) as $zone) {
$external[] = sprintf("%s (%s)", $zone[0], $zone[1]);
$externalVals[] = $zone[1];
}
$externalTpl = new SelectItem("external_if");
$externalTpl->setElements($external);
$externalTpl->setElementsVal($externalVals);
$f->add(new TrFormElement(_T("External network (Internet)"), $externalTpl));
$internal = array();
$internalVals = array();
foreach (getZonesInterfaces($zones_types["internal"]) as $zone) {
$internal[] = sprintf("%s (%s)", $zone[0], $zone[1]);
$internalVals[] = $zone[1];
}
$internalTpl = new SelectItem("internal_if");
$internalTpl->setElements($internal);
$internalTpl->setElementsVal($internalVals);
$f->add(new TrFormElement(_T("Internal network"), $internalTpl));
$f->pop();
$f->addButton("badd", _T("Add NAT rule"));
$f->display();
if (!servicesModuleEnabled()) {
echo '<br/>';
示例6: array
}
} else {
// add rule mode
$rule[] = array("operand1" => "Network/IP", "operand2" => "/.*/", "entitie" => $entityroot, "aggregator" => "", "operator" => "match", "actif" => 1, "numRule" => $datarule['nb_regle'] + 1);
}
if (!isset($regle)) {
$newnumRule = $datarule['nb_regle'] + 1;
} else {
$newnumRule = $regle;
}
$p = new PageGenerator(_T("Add rule", 'inventory'));
$p->setSideMenu($sidemenu);
$p->display();
$f = new ValidatingForm();
$f->push(new Table());
$f->add(new TrFormElement(_T("Active", "inventory"), new CheckboxTpl('active')), array("value" => $rule[0]['actif'] == 1 ? 'checked' : ''));
$selectOperatorType = new SelectItemtitle("operator[]", _T('selection from this item', 'inventory') . "\n");
$selectOperatorType->setElements($operatorType);
$selectOperatorType->setElementsVal($operatorType);
$aggregator_select = new SelectItemtitle("aggregator", _T('aggregator a rule', 'inventory') . "\n" . _T('AND all rules TRUE select entitie', 'inventory') . "\n" . _T('OR one rule TRUE select entitie', 'inventory') . "\n" . _T('NONE rule TRUE select entitie', 'inventory'));
$aggregator_select->setElements(array('AND', 'OR', 'NONE'));
$aggregator_select->setElementsVal(array('AND', 'OR', ''));
$f->add(new TrFormElement(_T('Aggregator', 'inventory'), $aggregator_select), array("value" => $rule[0]['aggregator']));
// or sans aggregator
//$f->add(new HiddenTpl("aggregator"), array("value" => "", "hide" => True));
$operator_select = new SelectItemtitle("operators[]", _T('Match', 'inventory') . ":\n" . _T(' regular expression', 'inventory') . "\n" . _T(' special characters must be escaped in regular expressions', 'inventory') . "\n" . _T(' .^$*+?()[{\\|') . "\n" . _T(' not start with word /^(?!my string).*$/', 'inventory') . "\n" . _T(' start with my string /^my string.*$/', 'inventory') . "\n" . _T(' does not contain /^((?!my string).)*$/', 'inventory') . "\n" . _T(' egal to or contains', 'inventory') . "/my string/" . "\n" . _T(' finishes by /.*(my string)$/', 'inventory') . "\n\n" . _T('Equal or noequal', 'inventory') . ":\n" . _T(' strictly equal or inequality', 'inventory') . "\n\n" . _T('Contains or NoContains', 'inventory') . ":\n" . _T(' has value or not', 'inventory') . "\n\n" . _T('Starts by or Finishes', 'inventory') . ":\n" . _T(' begins or ends with value', 'inventory'));
$operators = array("match" => _T('matches (regex)', 'inventory'), "equal" => _T('equal', 'inventory'), "noequal" => _T('not equal', 'inventory'), "contains" => _T('contains', 'inventory'), "nocontains" => _T('not contains', 'inventory'), "starts" => _T('starts by', 'inventory'), "finishes" => _T('finishes by', 'inventory'));
$operator_select->setElements(array_values($operators));
$operator_select->setElementsVal(array_keys($operators));
$locations_select = new SelectItemtitle("target_location[]", _T('entities list', 'inventory'));
$location_list = array();
示例7: sprintf
$a_href_open = "<a href=''>";
print "<p>";
print sprintf(_T("Boot menu generation is still in progress for the following items : %s. Please wait or reload the page %shere%s.", "imaging"), join($running_on, ', '), $a_href_open, '</a>');
print "</p>";
}
if (count($initerror_on) > 0) {
print "<p>";
print _T("The registering in the imaging server has failed.", "imaging");
print "</p>";
exit;
}
if (count($todo_on) > 0) {
# DISPLAY the sync link
print "<table><tr><td><b>";
print sprintf(_T('You have modified the boot menu for the following items : %s. If you are done please click on "Generate Menu" to update the computer boot menu.', 'imaging'), join($todo_on, ', '));
print "</b></font></td><td>";
$f = new ValidatingForm();
$f->add(new HiddenTpl("location_uuid"), array("value" => $location, "hide" => True));
$f->addButton("bsync", _T("Generate Menu", "imaging"));
$f->display();
print "</td></tr></table>";
} elseif (isExpertMode()) {
print "<table><tr><td>";
print _T('Click on "Force Generation" if you want to force the update of the boot menu', 'imaging');
print "</td><td>";
$f = new ValidatingForm();
$f->add(new HiddenTpl("location_uuid"), array("value" => $location, "hide" => True));
$f->addButton("bsync", _T("Force Generation", "imaging"));
$f->display();
print "</td></tr></table>";
}
示例8: getPackageLabel
$p_api->fromURI(quick_get("papi"));
$name = quick_get('ltitle');
if (!isset($name) || $name == '') {
$name = getPackageLabel($p_api, quick_get('pid'));
}
// form design
$f = new ValidatingForm();
// display top label
if (isset($_GET['uuid']) && $_GET['uuid']) {
$hostname = $_GET['hostname'];
$uuid = $_GET['uuid'];
$machine = getMachine(array('uuid' => $uuid), True);
$hostname = $machine->hostname;
$label = new RenderedLabel(3, sprintf(_T('Single advanced launch : action "%s" on "%s"', 'msc'), $name, $machine->hostname));
$f->push(new Table());
$f->add(new HiddenTpl("uuid"), array("value" => $uuid, "hide" => True));
$f->add(new HiddenTpl("name"), array("value" => $hostname, "hide" => True));
} else {
$gid = $_GET['gid'];
$group = new Group($gid, true);
if ($group->exists != False) {
if (quick_get('convergence')) {
$label = new RenderedLabel(3, sprintf(_T('Software Convergence: action "%s" on "%s"', 'msc'), $name, $group->getName()));
} else {
$label = new RenderedLabel(3, sprintf(_T('Group Advanced launch : action "%s" on "%s"', 'msc'), $name, $group->getName()));
}
$f->push(new Table());
$f->add(new HiddenTpl("gid"), array("value" => $gid, "hide" => True));
}
}
$label->display();
示例9: array
$services = array(array('Start computer', 'Boot on system hard drive', true), array('Create rescue image', 'Backup system hard drive', true), array('Create master', 'Backup system hard drive as a master', true), array('Memtest', 'Launch RAM checking utility', false));
$id = $_GET['itemid'];
if (count($_POST) == 0) {
// get current values
if ($services[$id][2] == true) {
$in_bootmenu = 'CHECKED';
}
$label = $services[$id][0];
$desc = $services[$id][1];
$p = new PageGenerator(_T("Edit service : ", "imaging") . $label);
$sidemenu->forceActiveItem("service");
$p->setSideMenu($sidemenu);
$p->display();
$f = new ValidatingForm();
$f->push(new Table());
$f->add(new TrFormElement(_T("Label", "imaging"), new InputTpl("service_label")), array("value" => $label));
$f->add(new TrFormElement(_T("Description", "imaging"), new InputTpl("service_desc")), array("value" => $desc));
$f->add(new TrFormElement(_T("In default bootmenu", "imaging"), new CheckboxTpl("service_bootmenu")), array("value" => $in_bootmenu));
$f->pop();
$f->addButton("bvalid", _T("Validate"));
$f->pop();
$f->display();
} else {
// set new values
foreach ($_POST as $key => $value) {
}
$label = $_POST['service_label'];
$str = sprintf(_T("Service <strong>%s</strong> modified with success", "imaging"), $label);
new NotifyWidgetSuccess($str);
// goto menu boot list
header("Location: " . urlStrRedirect("imaging/manage/service"));
示例10: NotifyWidgetFailure
new NotifyWidgetFailure(sprintf(_T("Failed to unregister the computer %s", 'imaging'), $target_name));
}
$is_unregistering = True;
} else {
/*
* type: 'group' for a profile, '' for a single computer
*/
$type = $_GET["type"];
$target_uuid = $_GET['target_uuid'];
$target_name = $_GET['target_name'];
$f = new ValidatingForm();
// Set title
if ($type == '') {
// Computer
if (!xmlrpc_isComputerRegistered($target_uuid) && !xmlrpc_isComputerInProfileRegistered($target_uuid)) {
$f->add(new TitleElement(sprintf(_T("Register computer '%s'", "imaging"), $target_name)));
}
} else {
// Profile
if (!xmlrpc_isProfileRegistered($target_uuid)) {
$f->add(new TitleElement(sprintf(_T("Imaging activation for group '%s'", "imaging"), $target_name)));
}
}
// Get boot menu
if ($type == '') {
// Computer
$ret = xmlrpc_getMyMenuComputer($target_uuid);
} else {
// Profile
$ret = xmlrpc_getMyMenuProfile($target_uuid);
}
示例11: ValidatingForm
require "../../../includes/config.inc.php";
require "../../../includes/i18n.inc.php";
require "../../../includes/acl.inc.php";
require "../../../includes/session.inc.php";
require "../../../includes/PageGenerator.php";
require "../includes/data_Windows_Answer_File_Generator.inc.php";
?>
<!--Click on to validate disposed of the response file
.on smb: // ipPulse / postinst / sysprep /-->
<?php
if (isset($_SESSION['parameters'])) {
//If this session exists : editing file, else creating file
$parameters = $_SESSION['parameters'];
}
$f = new ValidatingForm(array("id" => "formxml"));
$f->add(new HiddenTpl("codeToCopy"), array("value" => "", "hide" => True));
$f->add(new HiddenTpl("infobulexml"), array("value" => '', "hide" => True));
//==== NEW SECTION ====
// Installation Notes
//=====================
//Add section title
$f->add(new TitleElement(_T("Installation Notes", "imaging")));
$f->add(new TrFormElement("", new Iconereply('Installation_Notes', $InfoBule_Installation_Notes)));
$f->push(new Table());
//_____________
$f->add(new TrFormElement(_T('Title', 'imaging'), new InputTplTitle('Location', "name file xml")), array("required" => True, 'value' => isset($parameters) ? $parameters['Title'] : ''));
//_____________
$f->add(new TrFormElement("Notes" . ":", new OptTextareaTpl(array('name' => 'Comments', 'value' => isset($parameters) ? $parameters['Notes'] : 'Enter your comments here...'))));
$f->pop();
//Add empty line for separation
$f->add(new SepTpl());
示例12: ValidatingForm
natcasesort($left);
$f = new ValidatingForm();
$f->push(new Table());
$trOptions = array('firstColWidth' => '200px');
$rb = new RadioTpl("proxy_mode");
$rb->setChoices(array(_T('Single with fallback', 'msc'), _T('Multiple', 'msc')));
$rb->setvalues(array('single', 'multiple'));
if (!empty($_POST["proxy_mode"])) {
$proxy_mode = $_POST["proxy_mode"];
unset($_POST["proxy_mode"]);
// to prevent hidden field setting below
} else {
$proxy_mode = web_local_proxy_mode();
}
$rb->setSelected($proxy_mode);
$f->add(new TrFormElement(_T('Local Proxy Mode', 'msc'), $rb, $trOptions));
if (!empty($_POST["max_clients_per_proxy"])) {
$max_clients_per_proxy_value = $_POST["max_clients_per_proxy"];
unset($_POST["max_clients_per_proxy"]);
// to prevent hidden field setting below
} else {
$max_clients_per_proxy_value = web_max_clients_per_proxy();
}
$f->add(new TrFormElement(_T('Maximum number of simultaneous connections to a proxy', 'msc'), new MyNumericInputTpl("max_clients_per_proxy"), $trOptions), array("value" => $max_clients_per_proxy_value, "required" => True));
if (!empty($_POST["proxy_number"])) {
$proxy_number = $_POST["proxy_number"];
unset($_POST["proxy_number"]);
// to prevent hidden field setting below
} else {
$proxy_number = web_proxy_number();
}
示例13: PageGenerator
//New page with side menu, create and show
$p = new PageGenerator($main_title);
$p->setSideMenu($sidemenu);
$p->display();
//Create a list of informations
$n = new ListInfos($arrB, $title_datagrid);
$n->first_elt_padding = 1;
$n->disableFirstColumnActionLink();
$n->setName(_T("List"));
//Add action on list and show list
$n->addActionItem(new ActionPopupItem(_T("Delete"), $del_page, "delete", "eltdata"));
$n->display();
//Create Title and show
$t = new TitleElement($sub_title, 2);
$t->display();
//Create Form to get informations
$f = new ValidatingForm();
//Create table inside Form
$f->push(new Table());
//Add element input in table
$f->add(new TrFormElement($elt_label, new InputTpl("eltdata"), array("tooltip" => $elt_help)), array("value" => "", "required" => true));
//Add Botton in Form and show
$f->pop();
$f->addButton("btAdd", _T("Add"));
$f->display();
if (!servicesModuleEnabled()) {
echo '<br/>';
$f = new ValidatingForm(array("id" => "service"));
$f->addButton("btApply", _T("Apply configuration"));
$f->display();
}
示例14: NotifyWidgetSuccess
new NotifyWidgetSuccess(_T("SSH public keys updated.", "sshlpk"));
}
} else {
if (!$showSshkeys && hasSshKeyObjectClass($uid)) {
delSSHKeyObjectClass($uid);
if (!isXMLRPCError()) {
new NotifyWidgetSuccess(_T("SSH public keys attributes deleted.", "sshlpk"));
}
}
}
redirectTo(urlStrRedirect('base/users/sshkeys'));
}
$p = new PageGenerator(_T("Change your SSH keys", "sshlpk"));
$p->setSideMenu($sidemenu);
$p->display();
$show = hasSshKeyObjectClass($uid);
$f = new ValidatingForm();
$f->push(new Table());
$f->add(new TrFormElement(_T("Enable SSH keys management", "sshlpk"), new CheckboxTpl("showusersshkey")), array("value" => $show ? "checked" : "", "extraArg" => 'onclick="toggleVisibility(\'sshkeydiv\');"'));
$f->pop();
$sshkeydiv = new Div(array("id" => "sshkeydiv"));
$sshkeydiv->setVisibility($show);
$f->push($sshkeydiv);
if ($show) {
$sshkeys = getAllSshKey($uid);
} else {
$sshkeys = array("0" => "");
}
$f->add(new TrFormElement('', new MultipleInputTpl("sshuserkeys", _T("Public SSH Key", "sshlpk"))), $sshkeys);
$f->addValidateButton("bssh");
$f->display();
示例15: array
$_SESSION['PACKAGEAPI'] = array();
}
foreach ($res as $mirror) {
$list_val[$mirror['uuid']] = $mirror['uuid'];
$list[$mirror['uuid']] = $mirror['mountpoint'];
$_SESSION['PACKAGEAPI'][$mirror['uuid']] = $mirror;
}
$span = new SpanElement(_T("Choose package source", "pkgs"), "pkgs-title");
$selectpapi = new SelectItem('p_api');
$selectpapi->setElements($list);
$selectpapi->setElementsVal($list_val);
$_SESSION['pkgs_selected'] = array_values($list_val)[0];
$f = new ValidatingForm();
$f->push(new Table());
// Step title
$f->add(new TrFormElement("", $span), array());
$r = new RadioTpl("package-method");
$vals = array("package", "upload", "empty");
$keys = array(_T("Already uploaded on the server", "pkgs"), _T("Upload from this web page", "pkgs"), _T("Make an empty package", "pkgs"));
$r->setValues($vals);
$r->setChoices($keys);
// Package API
$f->add(new TrFormElement("<div id=\"p_api_label\">" . _T("Package API", "pkgs") . "</div>", $selectpapi), array("value" => $p_api_id, "required" => True));
$f->add(new TrFormElement(_T("Package source", "pkgs"), $r), array());
$f->add(new TrFormElement("<div id='directory-label'>" . _T("Files directory", "pkgs") . "</div>", new Div(array("id" => "package-temp-directory"))), array());
$f->add(new HiddenTpl("mode"), array("value" => "creation", "hide" => True));
$span = new SpanElement(_T("Package Creation", "pkgs"), "pkgs-title");
$f->add(new TrFormElement("", $span), array());
// fields
$fields = array(array("label", _T("Name", "pkgs"), array("required" => True, 'placeholder' => _T('<fill_package_name>', 'pkgs'))), array("version", _T("Version", "pkgs"), array("required" => True)), array('description', _T("Description", "pkgs"), array()));
$command = _T('Command:', 'pkgs') . '<br /><br />';