* * 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();
$addParams = neededParamsAddComputer(); foreach ($addParams as $p) { if ($p[1] == 'string') { /* Protect input fields according to the field type */ switch ($p[0]) { case "computerip": $input = new IPInputTpl($p[0]); break; case "computermac": $input = new MACInputTpl($p[0]); break; case "computernet": $input = new IPInputTpl($p[0]); break; default: $input = new IPInputTpl($p[0]); } $value = isset($_POST[$p[0]]) ? $_POST[$p[0]] : ''; $f->add(new TrFormElement(_($p[2]), $input), array("value" => $value)); } } if (canAssociateComputer2Location()) { if (in_array("pulse2", $_SESSION["modulesList"])) { require 'modules/pulse2/includes/select_location.php'; $value = isset($_POST["location_uuid"]) ? $_POST["location_uuid"] : ''; $f->add(new TrFormElement(_("Location"), select_locations(null, "location_uuid")), array("value" => $value)); } } $f->pop(); $f->addValidateButton("bcreate"); $f->display();
$locations_select->setElements(array_values($location_list)); $locations_select->setElementsVal(array_keys($location_list)); $pattern_input = new InputTplTitle('patterns[]', _T('regular expression or value', 'inventory') . "\n" . _T('must not contain space character', 'inventory') . "\n"); for ($i = 0; $i < count($rule); $i++) { // Fields//$criteria_select, $fields = array(new SpanElement("<br>"), $locations_select, new SpanElement("<br>"), $selectOperatorType, new SpanElement("<br>"), $operator_select, new SpanElement("<br>"), $pattern_input, new SpanElement("<br>"), new buttonTpl2('removeLine', _T('Remove', 'inventory'), 'removeLine')); $values = array("", locationtoid($entity, $rule[$i]['entitie']), "", $rule[$i]['operand1'], "", $rule[$i]['operator'], "", $rule[$i]['operand2'], ""); $f->add(new TrFormElement(_T('Criterion', 'inventory'), new multifieldTpl($fields)), array("value" => $values, "required" => True)); } // Add line button $addEntityRightBtn = new buttonTpl2('addLine', _T('Add criterion', 'inventory')); $addEntityRightBtn->setClass('btnPrimary'); $f->add(new TrFormElement('', $addEntityRightBtn), array()); $f->add(new HiddenTpl("numRuleadd"), array("value" => $newnumRule, "hide" => True)); $f->pop(); $f->addValidateButton("bconfirm"); $f->display(); ?> <script type="text/javascript"> jQuery(function(){ modelLine = jQuery('.removeLine:first').parents('tr:first').clone(); // Remove line button jQuery('.removeLine').click(function(){ if (jQuery('.removeLine').length > 1) jQuery(this).parents('tr:first').remove(); }); // Add line button
// in case of modification/creation success, redirect to the edit page if ($redirect) { header('Location: ' . urlStrRedirect("base/users/edit", array("user" => $uid))); exit; } // in case of failure, set errorStatus to 0 in order to display the edit form $errorStatus = 0; // edit form page starts here $p = new PageGenerator($title); $sidemenu->forceActiveItem($activeItem); $p->setSideMenu($sidemenu); $p->display(); // create the form $f = new ValidatingForm(array('method' => 'POST', 'enctype' => 'multipart/form-data')); // add submit button $f->addValidateButton("buser"); // enable/disable buttons if ($mode == 'edit') { $f->addButton("enableAccount", _("Enable account"), "btnSecondary"); $f->addButton("disableAccount", _("Disable account"), "btnSecondary"); } // add reset form button $f->addCancelButton("breset"); // add all modules forms to the edit form $modules = callPluginFunction("baseEdit", array($FH, $mode)); foreach ($modules as $module => $editForm) { $f->push($editForm); $f->pop(); } // display the form $f->display();
header("Location: " . urlStrRedirect("imaging/manage/computersprofilecreator", $params)); } $p->addTab("tabsta", _T("Static imaging group", "dyngroup"), "", "modules/dyngroup/dyngroup/add_groups.php", $params); $p->display(); } else { $p = new PageGenerator(_T('Imaging server selection', 'dyngroup')); $p->setSideMenu($sidemenu); require_once "modules/pulse2/includes/profiles_xmlrpc.inc.php"; $f = new ValidatingForm(); $f->add(new HiddenTpl("id"), array("value" => $gid, "hide" => True)); $f->push(new Table()); $imss = xmlrpc_getAllImagingServersForProfiles(true); $elt = array(); $elt_values = array(); foreach ($imss as $uuid => $imaging_server) { $elt[$uuid] = $imaging_server['name']; $elt_values[$uuid] = $uuid; } $imss = new SelectItem("imaging_server"); $imss->setElements($elt); $imss->setElementsVal($elt_values); $f->add(new TrFormElement(_T("Select an imaging server for this group", "dyngroup"), $imss)); $f->pop(); $f->addValidateButton("bvalid"); $p->display(); $f->display(); } } ?>
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();
unset($_POST["local_proxy_selection_mode"]); // to prevent hidden field setting below } else { $local_proxy_selection_mode = web_proxy_selection_mode(); } $d = new ProxySelector($machines, $right, $left, $group->id, $proxy_number, $local_proxy_selection_mode); $f->add(new TrFormElement(_T('Local proxies selection', 'msc'), $d, $trOptions)); /* Add hidden input field to propagate the POST values from the previous page */ foreach ($_POST as $key => $value) { if (!in_array($key, array("machines", "members", "lpmachines", "lpmembers", "baddmachine", "baddmachine_x", "baddmachine_y", "bdelmachine", "bdelmachine_x", "bdelmachine_y"))) { $f->add(new HiddenTpl($key), array("value" => $value, "hide" => True)); } } $f->pop(); $f->addValidateButton("bconfirmproxy"); $f->addCancelButton("bback"); $f->display(); if ($local_proxy_selection_mode != "manual") { ?> <script lang=javascript> disableLocalProxyForm(); // table is disabled when entering the page </script></script> <?php } elseif ($local_proxy_selection_mode == "manual") { ?> <script lang=javascript> enableLocalProxyForm(); // table is disabled when entering the page </script></script> <?php }
$resultPopup->add('<div class="alert alert-error">' . $error . '</div>'); $resultPopup->setLevel(5); } // add info messages if ($result) { $services = getServicesNames(); $resultPopup->add('<div class="alert alert-success">' . $result . '</div>'); handleServicesModule($resultPopup, array($services[1] => "DHCP")); } if (!$error) { header("Location: " . urlStrRedirect("network/network/services")); exit; } } $f = new ValidatingForm(); $f->addValidateButton("bdhcpfailover"); $f->addCancelButton("breset"); $f->push(new Table()); $f->add(new TrFormElement(_T("Enable DHCP failover"), new CheckboxTpl("dhcp_failover")), array("value" => $show ? "checked" : "", "extraArg" => 'onclick="toggleVisibility(\'dhcpfailoverdiv\');"')); $f->pop(); $dhcpfailoverdiv = new Div(array("id" => "dhcpfailoverdiv")); $dhcpfailoverdiv->setVisibility($show); $f->push($dhcpfailoverdiv); $f->push(new Table()); $f->add(new TrFormElement(_T("Primary DHCP server name"), new HiddenTpl("primary")), array("value" => $FH->getArrayOrPostValue("primary"))); $f->add(new TrFormElement(_T("Primary DHCP IP address"), new IPInputTpl("primaryIp")), array("value" => $FH->getArrayOrPostValue("primaryIp"), "required" => true)); $f->pop(); $f->push(new DivExpertMode()); $f->push(new Table()); $f->add(new TrFormElement(_T("Primary DHCP failover port"), new InputTpl("primaryPort"), array("tooltip" => _T("TCP port where the server listen to failover messages", "network"))), array("value" => $FH->getArrayOrPostValue("primaryPort"), "required" => true)); $f->pop();
$f->pop(); $pathdiv = new Div(array("id" => "profilespath")); $pathdiv->setVisibility($hasProfiles); $f->push($pathdiv); $f->push(new Table()); # default value for profile path $value = "\\\\%N\\profiles\\%U"; if ($hasProfiles) { $value = $smb['logon path']; } $f->add(new TrFormElement(_T("Network path for profiles"), new InputTpl("logon path"), array("tooltip" => _T("The share must exist and be world-writable.", "samba"))), array("value" => $value)); $f->pop(); $f->pop(); $f->push(new DivExpertMode()); $f->push(new Table()); $syncTpl = new SelectItem("ldap passwd sync"); $labels = array(_T('Yes'), _T('No'), _T('Only (for smbk5pwd)')); $values = array('yes', 'no', 'only'); $syncTpl->setElements($labels); $syncTpl->setElementsVal($values); $f->add(new TrFormElement(_T("LDAP password sync"), $syncTpl), array("value" => $smb["ldap passwd sync"])); $d = array(_T("Opening script session") => "logon script", _T("Base directory path") => "logon home", _T("Connect base directory on network drive") => "logon drive"); foreach ($d as $description => $field) { $f->add(new TrFormElement($description, new IA5InputTpl($field)), array("value" => $smb[$field])); } $f->pop(); $f->pop(); $f->addValidateButton("bsave"); $f->addExpertButton("brestart", _T("Restart SAMBA")); $f->addButton("breload", _T("Reload SAMBA configuration")); $f->display();
} } } $a = array("value" => $network, "required" => True); $a["zone"] = $zone; $a["ajaxurl"] = "ajaxDnsGetZoneFreeIp"; $formElt = new GetFreeIPInputTpl(); } else { if ($_GET["action"] == "addhost") { $a = array("value" => "", "required" => True); $formElt = new IPInputTpl("ipaddress"); } else { $a = array("value" => $ipaddress); $formElt = new HiddenTpl("ipaddress"); } } $f->add(new TrFormElement(_T("Network address"), $formElt), $a); $f->pop(); if ($_GET["action"] == "addhost") { $f->addButton("badd", _("Create")); } else { /* On edit mode, the user can setup host aliases */ $m = new MultipleInputTpl("hostalias", _T("Hostname alias")); $m->setRegexp('/^[a-z][a-z0-9-]*[a-z0-9]$/'); if (empty($cnames)) { $cnames = array(""); } $f->add(new FormElement(_T("Hostname alias"), $m), $cnames); $f->addValidateButton("bedit"); } $f->display();
require_once "modules/backuppc/includes/html.inc.php"; // =========================================================================== // Receive form data if (isset($_POST['bAdvScripts'])) { $host = $_POST['host']; // Setting the scripts set_host_pre_backup_script($host, $_POST['pre_backup_script']); set_host_post_backup_script($host, $_POST['post_backup_script']); set_host_pre_restore_script($host, $_POST['pre_restore_script']); set_host_post_restore_script($host, $_POST['post_restore_script']); new NotifyWidgetSuccess(_T('Configuration saved', 'backuppc')); } // =========================================================================== // display an edit config form $f = new ValidatingForm(); $f->push(new Table()); $host = $_GET['objectUUID']; $pre_backup_script = get_host_pre_backup_script($host); $post_backup_script = get_host_post_backup_script($host); $pre_restore_script = get_host_pre_restore_script($host); $post_restore_script = get_host_post_restore_script($host); // BackupPC config for this host $host_config = $response['host_config']; $f->add(new HiddenTpl("host"), array("value" => $host, "hide" => True)); $f->add(new TrFormElement(_T("Pre-backup script", "backuppc"), new TextareaTpl('pre_backup_script')), array("value" => htmlspecialchars($pre_backup_script))); $f->add(new TrFormElement(_T("Post-backup script", "backuppc"), new TextareaTpl('post_backup_script')), array("value" => htmlspecialchars($post_backup_script))); $f->add(new TrFormElement(_T("Pre-restore script", "backuppc"), new TextareaTpl('pre_restore_script')), array("value" => htmlspecialchars($pre_restore_script))); $f->add(new TrFormElement(_T("Post-restore script", "backuppc"), new TextareaTpl('post_restore_script')), array("value" => htmlspecialchars($post_restore_script))); $f->pop(); $f->addValidateButton("bAdvScripts"); $f->display();
$f->add(new TrFormElement(_T("Description", "ppolicy"), new InputTpl("description")), array("value" => $FH->getArrayOrPostValue("description"))); $f->add(new TrFormElement(_T("Minimum length", "ppolicy"), new InputTpl("pwdMinLength", '/^[0-9]*$/'), array("tooltip" => ppolicyTips("pwdMinLength"))), array("value" => $FH->getArrayOrPostValue("pwdMinLength"))); $f->add(new TrFormElement(_T("Password quality check", "ppolicy"), new InputTpl("pwdCheckQuality", '/^[012]$/'), array("tooltip" => ppolicyTips("pwdCheckQuality"))), array("value" => $FH->getArrayOrPostValue("pwdCheckQuality"))); $f->add(new TrFormElement(_T("Minimum age (seconds)", "ppolicy"), new InputTpl("pwdMinAge", '/^[0-9]*$/'), array("tooltip" => ppolicyTips("pwdMinAge"))), array("value" => $FH->getArrayOrPostValue("pwdMinAge"))); $f->add(new TrFormElement(_T("Maximum age (seconds)", "ppolicy"), new InputTpl("pwdMaxAge", '/^[0-9]*$/'), array("tooltip" => ppolicyTips("pwdMaxAge"))), array("value" => $FH->getArrayOrPostValue("pwdMaxAge"))); $f->add(new TrFormElement(_T("Number of grace authentications", "ppolicy"), new InputTpl("pwdGraceAuthNLimit", '/^[0-9]*$/'), array("tooltip" => ppolicyTips("pwdGraceAuthNLimit"))), array("value" => $FH->getArrayOrPostValue("pwdGraceAuthNLimit"))); if ($FH->getArrayOrPostValue("pwdMustChange") == 'TRUE' || $FH->getArrayOrPostValue("pwdMustChange") == 'on') { $pwdMustChange = "checked"; } else { $pwdMustChange = ""; } $f->add(new TrFormElement(_T("Force users to change their passwords on the first connection ?", "ppolicy"), new CheckboxTpl("pwdMustChange"), array("tooltip" => ppolicyTips("pwdMustChange"))), array("value" => $pwdMustChange)); $f->add(new TrFormElement(_T("Password history", "ppolicy"), new InputTpl("pwdInHistory", '/^[0-9]*$/'), array("tooltip" => ppolicyTips("pwdInHistory"))), array("value" => $FH->getArrayOrPostValue("pwdInHistory"))); if ($FH->getArrayOrPostValue("pwdLockout") == 'TRUE' || $FH->getArrayOrPostValue("pwdLockout") == 'on') { $pwdLockout = "checked"; } else { $pwdLockout = ""; } $f->add(new TrFormElement(_T("Preventive user lockout ?", "ppolicy"), new CheckboxTpl("pwdLockout"), array("tooltip" => ppolicyTips("pwdLockout"))), array("value" => $pwdLockout, "extraArg" => 'onclick="toggleVisibility(\'lockoutdiv\');"')); $f->pop(); $lockoutdiv = new Div(array("id" => "lockoutdiv")); $lockoutdiv->setVisibility($pwdLockout); $f->push($lockoutdiv); $f->push(new Table()); $f->add(new TrFormElement(_T("Password maximum failure", "ppolicy"), new InputTpl("pwdMaxFailure", '/^[0-9]*$/'), array("tooltip" => ppolicyTips("pwdMaxFailure"))), array("value" => $FH->getArrayOrPostValue("pwdMaxFailure"))); $f->add(new TrFormElement(_T("Lockout duration (seconds)", "ppolicy"), new InputTpl("pwdLockoutDuration", '/^[0-9]*$/'), array("tooltip" => ppolicyTips("pwdLockoutDuration"))), array("value" => $FH->getArrayOrPostValue("pwdLockoutDuration"))); $f->pop(); $f->pop(); $f->addValidateButton("bppolicy"); $f->pop(); $f->display();
$group->importMembers($elementare, $content); new NotifyWidgetSuccess(_T("Group successfully created", "dyngroup")); header("Location: " . urlStrRedirect("base/computers/display", array('gid' => $group->id))); exit; } elseif (xmlrpc_group_name_exists($groupname)) { new NotifyWidgetFailure(sprintf(_T("A group already exists with name '%s'", "dyngroup"), $groupname)); } $f = new ValidatingForm(array('enctype' => "multipart/form-data")); $f->push(new Table()); $f->add(new TrFormElement(_T("Group name", "dyngroup"), new InputTpl("groupname")), array("required" => True, "value" => $groupname)); $r = new RadioTpl('visible'); $r->setChoices(array(_T('Yes', 'dyngroup'), _T('No', 'dyngroup'))); $r->setValues(array('visible', 'hidden')); $r->setSelected($visibility); $f->add(new TrFormElement(_T("Add shortcut", "dyngroup"), $r), array("required" => True)); $f->add(new TrFormElement(_T("Select the file you want to import", "dyngroup"), new FileTpl('importfile')), array("required" => True)); $a = getPossiblesCriterionsInMainModule(); $r = new RadioTpl('elementare'); $r->setChoices($a); $r->setValues($a); if (!isset($elementare) || $elementare == '') { $elementare = $a[0]; } $r->setSelected($elementare); $f->add(new TrFormElement(_T("Select what is inside the file", "dyngroup"), $r), array("required" => True)); $f->pop(); $f->addValidateButton("bimport"); $f->display(); ?>
$fields = array(array("label", _T("Name", "pkgs"), array("required" => True)), array("version", _T("Version", "pkgs"), array("required" => True)), array('description', _T("Description", "pkgs"), array())); $cmds = array(array('command', _T('Command\'s name : ', 'pkgs'), _T('Command : ', 'pkgs'))); $options = array(array('reboot', _T('Need a reboot ?', 'pkgs'))); foreach ($fields as $p) { $f->add(new TrFormElement($p[1], new InputTpl($p[0])), array_merge(array("value" => $package[$p[0]]), $p[2])); } foreach ($options as $p) { $op = $package[$p[0]] == 1 || $package[$p[0]] == '1' || $package[$p[0]] === 'enable'; $f->add(new TrFormElement($p[1], new CheckboxTpl($p[0])), array("value" => $op ? 'checked' : '')); } foreach ($cmds as $p) { $f->add(new HiddenTpl($p[0] . 'name'), array("value" => $package[$p[0]]['name'], "hide" => True)); $f->add(new TrFormElement($p[2], new TextareaTpl($p[0] . 'cmd')), array("value" => htmlspecialchars($package[$p[0]]['command']))); } $f->pop(); $f->addValidateButton("bconfirm", _T("Add", "pkgs")); $f->display(); } ?> <script src="jsframework/lib/fileuploader/fileuploader.js" type="text/javascript"></script> <!-- js for file upload --> <link href="jsframework/lib/fileuploader/fileuploader.css" rel="stylesheet" type="text/css"> <!-- css for file upload --> <script type="text/javascript"> Event.observe(window, 'load', function() { // load this piece of code when page is loaded /* * Auto fill fields of form * if tempdir is empty (when changing packageAPI) * default tempdir will be chosen in ajaxGetSuggestedCommand * php file. */