本文整理汇总了PHP中ValidatingForm类的典型用法代码示例。如果您正苦于以下问题:PHP ValidatingForm类的具体用法?PHP ValidatingForm怎么用?PHP ValidatingForm使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ValidatingForm类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save_smbconf
}
return $ret;
}
if (isset($_POST["bsave"])) {
$ret = save_smbconf();
if (!isXMLRPCError()) {
new NotifyWidgetSuccess(sprintf(_T("SAMBA configuration saved. You may need to reload or restart the SAMBA service.")));
}
}
require "modules/samba/mainSidebar.php";
require "graph/navbar.inc.php";
$p = new PageGenerator(_T("General options"));
$p->setSideMenu($sidemenu);
$p->display();
$smb = get_smbconf();
$f = new ValidatingForm();
$f->push(new Table());
if ($smb["pdc"]) {
$workgroupTpl = new HiddenTpl("workgroup");
} else {
$workgroupTpl = new NetbiosUppercaseInputTpl("workgroup");
}
$f->add(new TrFormElement(_T("Domain name"), $workgroupTpl), array("value" => $smb["workgroup"], "required" => True));
$f->add(new TrFormElement(_T("Server name"), new NetbiosUppercaseInputTpl("netbios name")), array("value" => $smb["netbios name"], "required" => True));
$value = "";
if ($smb["pdc"]) {
$value = "checked";
}
$f->add(new TrFormElement(_T("This server is a PDC"), new CheckboxTpl("pdc")), array("value" => $value));
$f->add(new TrFormElement(_T("This server is a WINS server"), new CheckboxTpl("wins support")), array("value" => getCheckedState($smb, "wins support")));
$value = "";
示例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
* MMC is distributed in the hope that it will be useful,
* 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: display_ordered
function display_ordered($orders)
{
$f = new ValidatingForm();
$f->push(new Table());
foreach ($this->members as $pid => $plabel) {
$select = new SelectItem($this->input_pre . base64_encode($pid));
$select->setElements($this->c);
$select->setElementsVal($this->c);
$select->setSelected($orders[$pid]);
$f->add(new TrFormElement($plabel, $select, array()));
}
foreach ($this->getHidden() as $w) {
$f->add($w[0], $w[1]);
}
$this->display_options($f);
$f->pop();
foreach ($this->buttons as $b) {
$f->addButton($b[0], $b[1], $b[2]);
}
$f->display();
}
示例5: getSubnetStatements
$statements = getSubnetStatements($subnetInfos);
if (isAuthoritative($subnetInfos)) {
$authoritative = "CHECKED";
} else {
$authoritative = "";
}
$poolsRanges = getPoolsRanges($subnet);
$hasSubnetPools = count($poolsRanges) ? "checked" : "";
}
if ($_GET["action"] == "subnetadd") {
$formElt = new IPInputTpl("subnet");
$authoritative = "";
} else {
$formElt = new HiddenTpl("subnet");
}
$f = new ValidatingForm();
$f->push(new Table());
$f->add(new TrFormElement(_T("DHCP subnet address"), $formElt), array("value" => $subnet, "required" => True));
$f->add(new TrFormElement(_T("Netmask"), new NetmaskInputTpl("netmask")), array("value" => $netmask, "required" => True, "extra" => _T("(e.g. 24 for a /24 network)")));
$f->add(new TrFormElement(_T("Description"), new IA5InputTpl("description")), array("value" => $description));
$f->add(new TrFormElement(_T("Authoritative"), new CheckboxTpl("authoritative")), array("value" => $authoritative));
$f->pop();
$f->push(new Table());
$f->add(new TrFormElement(_T("DHCP options related to clients network parameters"), new HiddenTpl("")));
$f->add(new TrFormElement(_T("Broadcast address"), new IPInputTpl("broadcast-address")), array("value" => $options["broadcast-address"]));
$f->add(new TrFormElement(_T("Domain name"), new IA5InputTpl("domain-name"), array("tooltip" => _T("Domain name that will be appended to the client's hostname to form a fully-qualified domain-name (FQDN).") . "<br/>" . _T("If the domain name is a registered DNS domain, the subnet will be associated to the DNS domain.") . "<br/>" . _T("You can set more than one domain, separated by spaces. They will be added to the DHCP client DNS domain search path."))), array("value" => $options["domain-name"], "extra" => _T("Links the subnet to a DNS zone")));
$f->add(new TrFormElement(_T("Routers"), new HostIpListInputTpl("routers"), array("tooltip" => _T("List of routers (gateways) on client's subnet."))), array("value" => $options["routers"]));
$f->add(new TrFormElement(_T("Domain name servers"), new HostIpListInputTpl("domain-name-servers"), array("tooltip" => _T("DNS name servers available to the client. Separate servers addresses with ','."))), array("value" => $options["domain-name-servers"]));
$f->add(new TrFormElement(_T("NTP servers"), new HostIpListInputTpl("ntp-servers"), array("tooltip" => _T("Network Time Protocol servers available to the client. Separate servers addresses with ','."))), array("value" => $options["ntp-servers"]));
$f->add(new TrFormElement(_T("Proxy auto config URL"), new IA5InputTpl("local-pac-server"), array("tooltip" => _T("Automatic proxy configuration URL (PAC)."))), array("value" => $options["local-pac-server"]));
$f->add(new TrFormElement(_T("WINS servers"), new HostIpListInputTpl("netbios-name-servers"), array("tooltip" => _T("Netbios name servers available to Windows clients, listed in order of preference. Separate servers addresses with ','."))), array("value" => $options["netbios-name-servers"]));
示例6: require
*
* 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));
/* We dont have this information right now in the database schema
$f->add(new TitleElement(_T("Traffic control", "imaging")));
$f->push(new Table());
$interfaces = array("eth0" => "eth0", "eth1" => "eth1");
$ifaces = new SelectItem("net_int");
$ifaces->setElements($interfaces);
$ifaces->setElementsVal($interfaces);
$f->add(
new TrFormElement(_T("Network interface on which traffic shaping is done", "imaging"),
$ifaces)
);
$f->add(
示例7: PageGenerator
$is_wol_displayed = '';
}
$ro = False;
if ($is_image) {
$default_name = $item['image']['default_name'];
} else {
$default_name = $item['boot_service']['default_name'];
if (!isset($item['is_local'])) {
$ro = True;
}
}
$p = new PageGenerator(sprintf(_T("Edit : %s", "imaging"), $label));
$sidemenu->forceActiveItem("bootmenu");
$p->setSideMenu($sidemenu);
$p->display();
$f = new ValidatingForm();
$f->push(new Table());
$f->add(new HiddenTpl("location"), array("value" => $location, "hide" => True));
$input = new TrFormElement(_T('Default menu item label', 'imaging'), new InputTpl("default_name"));
$f->add($input, array("value" => $default_name, "disabled" => $ro ? 'disabled' : ''));
$f->add(new TrFormElement(_T("Selected by default", "imaging"), new CheckboxTpl("default")), array("value" => $is_selected));
$f->add(new TrFormElement(_T("Displayed", "imaging"), new CheckboxTpl("displayed")), array("value" => $is_displayed));
$f->add(new TrFormElement(_T("Selected by default on WOL", "imaging"), new CheckboxTpl("default_WOL")), array("value" => $is_wol_selected));
$f->add(new TrFormElement(_T("Displayed on WOL", "imaging"), new CheckboxTpl("displayed_WOL")), array("value" => $is_wol_displayed));
$f->pop();
$f->addButton("bvalid", _T("Validate"));
$f->pop();
$f->display();
} else {
$is_image = True;
if ($item['boot_service']) {
示例8: Machine
$f->pop();
$f->addValidateButton("bconfirm");
$f->addCancelButton("bback");
$f->display();
}
### /Advanced actions handling ###
/* single target: form display */
if (!isset($_GET['badvanced']) && $_GET['uuid'] && !isset($_POST['launchAction'])) {
$machine = new Machine(array('uuid' => $_GET['uuid'], 'hostname' => array('0' => $_GET['hostname']), 'displayName' => $_GET['hostname']));
if (strlen(web_probe_order()) > 0) {
$msc_host = new RenderedMSCHost($machine, web_probe_order());
$msc_host->ajaxDisplay();
} else {
// nothing set : do not probe
if (!isset($_POST["bprobe"])) {
$fprobe = new ValidatingForm();
$fprobe->addButton("bprobe", _T("Probe status", "msc"));
$fprobe->display();
print "<br/>";
} else {
$msc_host = new RenderedMSCHost($machine, web_probe_order_on_demand());
$msc_host->ajaxDisplay();
}
}
$msc_actions = new RenderedMSCActions(msc_script_list_file(), $machine->hostname, array('uuid' => $_GET['uuid']));
$msc_actions->display();
$ajax = new AjaxFilter(urlStrRedirect("base/computers/ajaxPackageFilter"), "container", array("uuid" => $machine->uuid, "hostname" => $machine->hostname));
$ajax->display();
$ajax->displayDivToUpdate();
}
/* group display */
示例9: array
require "localSidebar.php";
require "graph/navbar.inc.php";
$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);
示例10: NotifyWidgetSuccess
new NotifyWidgetSuccess(sprintf(_T("The computer %s has correctly been unregistered from imaging", 'imaging'), $target_name));
unset($_SESSION["imaging.isComputerRegistered_" . $target_uuid]);
header("Location: " . urlStrRedirect("base/computers/register_target", $params));
exit;
} else {
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
示例11: ValidatingForm
<?php
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
示例12: array_map
$list = array_map(format, $list);
} else {
$list = $group->members();
}
/* all computers of the group */
$machines = array();
foreach ($list as $machine) {
$machines[$machine['hostname'] . "##" . $machine['uuid']] = $machine['hostname'];
}
$right = array();
}
reset($right);
ksort($machines);
$left = array_diff_assoc($machines, $right);
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"])) {
示例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: intval
$ID = intval(@max($_GET['id'], $_POST['id']));
$NAME = $_GET['Label'];
$PARENTID = intval(@max($_GET['parentId'], $_POST['parentId']));
if (isset($_POST['bconfirm'])) {
$cfg = array('name' => $_POST['name'], 'id' => $_POST['id'], 'parentId' => $_POST['parentId']);
if ($ID && $ID != 1) {
deleteEntities($cfg['id'], $cfg['name'], $cfg['parentId']);
if (!isXMLRPCError()) {
header('location: main.php?module=base&submod=computers&action=entityList');
} else {
new NotifyWidgetFailure(_T("The entity has not been deleted.", "inventory"));
}
}
}
$p = new PageGenerator(_T("Delete entity", "inventory"));
$p->setSideMenu($sidemenu);
$p->display();
if ($ID == 1) {
header('location: main.php?module=base&submod=computers&action=entityList');
exit(0);
}
$f = new ValidatingForm();
$f->push(new Table());
$f->add(new TrFormElement(_T('Name', 'inventory'), new InputTpl('name')), array("value" => $NAME, "required" => True));
if ($ID) {
$f->add(new HiddenTpl("id"), array("value" => $ID, "hide" => True));
$f->add(new HiddenTpl("parentId"), array("value" => $PARENTID, "hide" => True));
}
$f->pop();
$f->addValidateButton("bconfirm");
$f->display();