Ejemplo n.º 1
0
 function addEditDialogHTML($add)
 {
     global $user;
     # dialog for on page editing
     $h = '';
     $h .= "<div dojoType=dijit.Dialog\n";
     $h .= "      id=\"addeditdlg\"\n";
     $h .= "      title=\"Edit {$this->restypename}\"\n";
     $h .= "      duration=250\n";
     $h .= "      draggable=true>\n";
     $h .= "<div id=\"addeditdlgcontent\">\n";
     $h .= "<div id=\"computerdlgcontent\">\n";
     # id
     $h .= "<input type=\"hidden\" id=\"editresid\">\n";
     $types = array("blade" => "Bare Metal", "lab" => "Lab", "virtualmachine" => "Virtual Machine");
     $provisioning = getProvisioning();
     $provtypes = getProvisioningTypes();
     $states = array('blade' => array(2 => 'available', 10 => 'maintenance', 20 => 'vmhostinuse'), 'lab' => array(2 => 'available', 10 => 'maintenance'), 'virtualmachine' => array(10 => 'maintenance'));
     $h .= "<script type=\"text/javascript\">\n";
     $h .= "var options = {\n";
     $options = array();
     foreach ($types as $type => $tmp) {
         $opt = '';
         $opt .= "  {$type}: {\n";
         $opt .= "    provisioning: [\n";
         $arr = array();
         foreach ($provtypes[$type] as $key => $val) {
             $arr[] = "      {value: '{$key}', label: '{$val}'}";
         }
         $opt .= implode(",\n", $arr);
         $opt .= "\n    ],\n";
         $opt .= "    states: [\n";
         $arr = array();
         foreach ($states[$type] as $key => $val) {
             $arr[] = "      {value: '{$key}', label: '{$val}'}";
         }
         $opt .= implode(",\n", $arr);
         $opt .= "\n    ]\n";
         $opt .= "  }";
         $options[] = $opt;
     }
     $h .= implode(",\n", $options);
     $h .= "\n}\n";
     $h .= "</script>\n";
     # add single or multiple
     $h .= "<div id=\"singlemultiplediv\" class=\"hidden\">\n";
     /*$h .= "<label for=\"addsingle\">Add Single Computer</label><span ";
     		$h .= "class=\"labeledform\"><input type=\"radio\" name=\"mode\" ";
     		$h .= "id=\"addsingle\" checked=\"checked\" onclick=\"toggleAddSingle();\">";
     		$h .= "</span><br><br>\n";
     		$h .= "<label for=\"addmultiple\">Add Multiple Computers</label><span ";
     		$h .= "class=\"labeledform\"><input type=\"radio\" name=\"mode\" ";
     		$h .= "id=\"addmultiple\" onclick=\"toggleAddMultiple();\"><br><br>\n";*/
     $extra = array('onChange' => 'toggleSingleMultiple();');
     $modes = array('single' => 'Single Computer', 'multiple' => 'Multiple Computers');
     $h .= labeledFormItem('mode', i('Add') . ' ', 'select', $modes, 1, '', '', '', $extra);
     $h .= "<br>\n";
     $h .= "</div>\n";
     # singlemultiplediv
     # add multiple note
     $h .= "<div id=\"multiplenotediv\" class=\"hidden\">\n";
     $h .= "<b>NOTE</b>: 'Start IP' and 'End IP' can only differ in the number ";
     $h .= "after the last '.'. The<br>hostnames will be generated from the ";
     $h .= "'Hostname' field. The hostnames for each<br>computer can only differ ";
     $h .= "by the value of a number in the first part of the hostname.<br>Place ";
     $h .= "a '%' character in the 'Hostname' field where that number will be. ";
     $h .= "Then fill in<br>'Start value' and 'End value' with the first and last ";
     $h .= "values to be used in the hostname.<br><br>";
     $h .= "</div>\n";
     # multiplenotediv
     # div for canceling moving blade to vmhostinuse
     $h .= "<div class=\"highlightnoticewarn hidden\" id=\"cancelvmhostinusediv\">\n";
     $h .= "<span id=\"tohostfuturespan\">\n";
     $h .= "NOTICE: This computer is scheduled to start being reloaded as a vmhost at<br>";
     $h .= "<span id=\"tohostfuturetimespan\"></span>";
     $h .= ". You may cancel this scheduled<br>reload by clicking the button below.";
     $h .= "<br><br></span>\n";
     $h .= "<span id=\"tohostnowspan\">\n";
     $h .= "NOTICE: This computer is currently being reloaded as a vmhost. You may cancel this<br>";
     $h .= "process by clicking on the button below. After canceling the reload, it may take several<br>";
     $h .= "minutes for the cancellation process to complete.";
     $h .= "<br><br></span>\n";
     $h .= "<input type=\"hidden\" id=\"tohostcancelcont\">\n";
     $h .= "<button dojoType=\"dijit.form.Button\">\n";
     $h .= "\tCancel Scheduled Reload\n";
     $h .= "\t<script type=\"dojo/method\" event=onClick>\n";
     $h .= "\t\tcancelScheduledtovmhostinuse();\n";
     $h .= "\t</script>\n";
     $h .= "</button>\n";
     $h .= "</div>\n";
     # cancelvmhostinusediv
     $h .= "<div class=\"highlightnoticenotify hidden\" id=\"cancelvmhostinuseokdiv\"></div>\n";
     # hostname
     $errmsg = i("Name can only contain letters, numbers, dashes(-), periods(.), and underscores(_). It can be from 1 to 36 characters long.");
     $h .= labeledFormItem('name', i('Name') . '*', 'text', '^([a-zA-Z0-9_][-a-zA-Z0-9_\\.]{1,35})$', 1, '', $errmsg);
     # start/end
     $h .= "<div id=\"startenddiv\" class=\"hidden\">\n";
     $extra = array('smallDelta' => 1, 'largeDelta' => 10);
     $h .= labeledFormItem('startnum', i('Start') . '*', 'spinner', '{min:0,max:255,places:0}', 1);
     $h .= labeledFormItem('endnum', i('End') . '*', 'spinner', '{min:0,max:255,places:0}', 1);
     $h .= "</div>\n";
     # startenddiv
     # owner
     $extra = array('onKeyPress' => 'setOwnerChecking');
     $h .= labeledFormItem('owner', i('Owner') . '*', 'text', '', 1, "{$user['unityid']}@{$user['affiliation']}", i('Unknown user'), 'checkOwner', $extra);
     $cont = addContinuationsEntry('AJvalidateUserid');
     $h .= "<input type=\"hidden\" id=\"valuseridcont\" value=\"{$cont}\">\n";
     # type
     $extra = array('onChange' => 'selectType();');
     $h .= labeledFormItem('type', i('Type'), 'select', $types, 1, '', '', '', $extra);
     # single computer fields
     $h .= "<div id=\"singleipmacdiv\">\n";
     # public IP
     $ipreg = '(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)';
     $ipreg1 = "^{$ipreg}\$";
     $errmsg = i("Invalid Public IP address specified - must be a valid IPV4 address");
     $h .= labeledFormItem('ipaddress', i('Public IP Address') . '*', 'text', $ipreg1, 1, '', $errmsg);
     # private IP
     $errmsg = i("Invalid Private IP address specified - must be a valid IPV4 address");
     $h .= labeledFormItem('privateipaddress', i('Private IP Address'), 'text', $ipreg1, 0, '', $errmsg);
     # Public MAC
     $macreg = '^([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2}$';
     $errmsg = i("Invalid Public MAC address specified");
     $h .= labeledFormItem('publicmac', i('Public MAC Address'), 'text', $macreg, 0, '', $errmsg);
     # private MAC
     $errmsg = i("Invalid Private MAC address specified");
     $h .= labeledFormItem('privatemac', i('Private MAC Address'), 'text', $macreg, 0, '', $errmsg);
     $h .= "</div>\n";
     # singleipmacdiv
     # multi computer fields
     $h .= "<div id=\"multiipmacdiv\" class=\"hidden\">\n";
     # start public IP
     $errmsg = i("Invalid Start Public IP Address specified - must be a valid IPV4 address");
     $h .= labeledFormItem('startpubipaddress', i('Start Public IP Address') . '*', 'text', $ipreg1, 1, '', $errmsg);
     # end public IP
     $errmsg = i("Invalid End Public IP Address specified - must be a valid IPV4 address");
     $h .= labeledFormItem('endpubipaddress', i('End Public IP Address') . '*', 'text', $ipreg1, 1, '', $errmsg);
     # start private IP
     $errmsg = i("Invalid Start Private IP Address specified - must be a valid IPV4 address");
     $h .= labeledFormItem('startprivipaddress', i('Start Private IP Address') . '*', 'text', $ipreg1, 1, '', $errmsg);
     # end private IP
     $errmsg = i("Invalid End Private IP Address specified - must be a valid IPV4 address");
     $h .= labeledFormItem('endprivipaddress', i('End Private IP Address') . '*', 'text', $ipreg1, 1, '', $errmsg);
     # start MAC
     $errmsg = i("Invalid Start MAC Address specified");
     $h .= labeledFormItem('startmac', i('Start MAC Address'), 'text', $macreg, 0, '', $errmsg);
     $h .= "</div>\n";
     # multiipsdiv
     # provisioning engine
     $extra = array('onChange' => 'selectProvisioning();');
     $h .= labeledFormItem('provisioningid', i('Provisioning Engine'), 'selectonly', $provisioning, 1, '', '', '', $extra);
     # state
     $extra = array('onChange' => 'selectState();');
     $states = array(2 => 'available', 23 => 'hpc', 10 => 'maintenance', 20 => 'vmhostinuse');
     $h .= labeledFormItem('stateid', i('State'), 'selectonly', $states, 1, '', '', '', $extra);
     # maintenance notes
     $h .= "<div id=\"notesspan\">\n";
     $h .= labeledFormItem('notes', i('Reason for maintenance'), 'textarea');
     $h .= "</div>\n";
     # VMhost profile
     $profiles = getVMProfiles();
     uasort($profiles, 'sortKeepIndex');
     $h .= "<div id=\"vmprofilespan\">\n";
     $h .= labeledFormItem('vmprofileid', i('VM Host Porfile'), 'select', $profiles);
     $h .= "</div>\n";
     # platform
     $platforms = getPlatforms();
     $h .= labeledFormItem('platformid', i('Platform'), 'select', $platforms);
     # schedule
     $tmp = getUserResources(array("scheduleAdmin"), array("manageGroup"));
     $schedules = $tmp["schedule"];
     $h .= labeledFormItem('scheduleid', i('Schedule'), 'selectonly', $schedules);
     # current image
     $h .= "<div id=\"curimgspan\">\n";
     $h .= "<label for=\"curimg\">Current Image:</label>\n";
     $h .= "<span class=\"labeledform\" id=\"curimg\"></span><br>\n";
     $h .= "</div>\n";
     # ram
     $extra = array('smallDelta' => 1024, 'largeDelta' => 4096);
     $h .= labeledFormItem('ram', i('RAM (MB)') . '*', 'spinner', '{min:500,max:16777215,places:0}', 1);
     # cores
     $extra = array('smallDelta' => 1, 'largeDelta' => 4);
     $h .= labeledFormItem('cores', i('No. Cores') . '*', 'spinner', '{min:1,max:255,places:0}', 1);
     # proc speed
     $extra = array('smallDelta' => 100, 'largeDelta' => 1000);
     $h .= labeledFormItem('procspeed', i('Processor Speed (MHz)') . '*', 'spinner', '{min:500,max:10000,places:0}', 1);
     # network speed
     $tmpArr = array("10" => "10", "100" => "100", "1000" => "1000", "10000" => "10000", "100000" => "100000");
     $h .= labeledFormItem('network', i('Network'), 'select', $tmpArr);
     # predictive loading module
     $vals = getPredictiveModules();
     $h .= labeledFormItem('predictivemoduleid', i('Predictive Loading Module'), 'select', $vals);
     # NAT
     $h .= "<div class=\"boxedoptions\">\n";
     # use NAT
     $extra = array('onChange' => "toggleNAT('natenabled', 'nathostid');");
     $h .= labeledFormItem('natenabled', i('Connect Using NAT'), 'check', '', '', '1', '', '', $extra);
     # which NAT host
     $nathosts = getNAThosts(0, 1);
     $h .= labeledFormItem('nathostid', i('NAT Host'), 'selectonly', $nathosts);
     $h .= "</div>\n";
     # NAT
     # NAT Host
     $h .= "<div id=\"nathost\" class=\"boxedoptions\">\n";
     # use as NAT host
     $extra = array('onChange' => "toggleNAThost();");
     $h .= labeledFormItem('nathostenabled', i('Use as NAT Host'), 'check', '', '', '1', '', '', $extra);
     # public IP
     $errmsg = i("Invalid NAT Public IP address specified - must be a valid IPV4 address");
     $h .= labeledFormItem('natpublicipaddress', i('NAT Public IP Address'), 'text', $ipreg1, 1, '', $errmsg);
     # internal IP
     $errmsg = i("Invalid NAT Internal IP address specified - must be a valid IPV4 address");
     $h .= labeledFormItem('natinternalipaddress', i('NAT Internal IP Address'), 'text', $ipreg1, 1, '', $errmsg);
     $h .= "</div>\n";
     # NAT Host
     # compid
     $h .= "<div id=\"compidspan\">\n";
     $h .= "<label for=\"compid\">Computer ID:</label>\n";
     $h .= "<span class=\"labeledform\" id=\"compid\"></span><br>\n";
     $h .= "</div>\n";
     # location
     $errmsg = i("Location can be up to 255 characters long and may contain letters, numbers, spaces, and these characters: - , . _ @ # ( )");
     $h .= labeledFormItem('location', i('Location'), 'text', '^([-a-zA-Z0-9_\\. ,@#\\(\\)]{0,255})$', 0, '', $errmsg);
     $h .= "</div>\n";
     # computerdlgcontent
     $h .= "</div>\n";
     # addeditdlgcontent
     $h .= "<div id=\"addeditdlgerrmsg\" class=\"nperrormsg\"></div>\n";
     $h .= "<div id=\"editdlgbtns\" align=\"center\">\n";
     $h .= dijitButton('addeditbtn', "Confirm", "saveResource();");
     $h .= dijitButton('', "Cancel", "dijit.byId('addeditdlg').hide();");
     $h .= "</div>\n";
     # editdlgbtns
     $h .= "</div>\n";
     # dialog
     $h .= "<div dojoType=dijit.Dialog\n";
     $h .= "      id=\"groupingnote\"\n";
     $h .= "      title=\"Computer Grouping\"\n";
     $h .= "      duration=250\n";
     $h .= "      draggable=true>\n";
     $h .= "Computer(s) successfully added. Each computer needs<br>to be a member of a computer resource group. The<br>following dialog<br>will allow you to add the new<br>computer(s) to a group.<br><br>\n";
     $h .= "<div align=\"center\">\n";
     $h .= dijitButton('', "Close", "dijit.byId('groupingnote').hide();");
     $h .= "</div>\n";
     # btn div
     $h .= "</div>\n";
     # groupingnote
     $h .= "<div dojoType=dijit.Dialog\n";
     $h .= "      id=\"groupdlg\"\n";
     $h .= "      title=\"Computer Grouping\"\n";
     $h .= "      duration=250\n";
     $h .= "      draggable=true>\n";
     $h .= "<div id=\"groupdlgcontent\"></div>\n";
     $h .= "<div align=\"center\">\n";
     $script = "    dijit.byId('groupdlg').hide();\n";
     $script .= "    checkFirstAdd();\n";
     $h .= dijitButton('', "Close", $script);
     $h .= "</div>\n";
     # btn div
     $h .= "</div>\n";
     # groupdlg
     return $h;
 }
Ejemplo n.º 2
0
function newReservationHTML()
{
    global $user, $skin;
    $forimaging = getContinuationVar('imaging', processInputVar('imaging', ARG_NUMERIC, 0));
    $checkout = getUserResources(array("imageAdmin", "imageCheckOut"));
    $imaging = getUserResources(array("imageAdmin"));
    $server = getUserResources(array("serverCheckOut"), array("available"));
    $imagedata = getImages();
    $baseaccess = 0;
    $imagingaccess = 0;
    $serveraccess = 0;
    $images = array();
    $noimaging = array();
    $serverimages = array();
    $dorevisionscont = 0;
    if (in_array('imageAdmin', $user['privileges']) && count($imaging['image'])) {
        $imagingaccess = 1;
    }
    if (in_array('imageCheckOut', $user['privileges']) && count($checkout['image'])) {
        $baseaccess = 1;
        foreach ($checkout['image'] as $id => $name) {
            $images[$id] = array('name' => $name, 'basic' => 1, 'imaging' => 0, 'server' => 1, 'checkout' => 1, 'maxinitialtime' => 0, 'revisions' => 0);
            if (array_key_exists($id, $imagedata) && !$imagedata[$id]["forcheckout"]) {
                $images[$id]['checkout'] = 0;
            }
            if ($imagingaccess && array_key_exists($id, $imaging['image'])) {
                if ($imagedata[$id]['rootaccess'] == 1 || $imagedata[$id]['ownerid'] == $user['id']) {
                    $images[$id]['imaging'] = 1;
                } else {
                    $noimaging[$id] = 1;
                }
            }
            if (array_key_exists($id, $imagedata) && $imagedata[$id]["maxinitialtime"] != 0) {
                $images[$id]['maxinitialtime'] = $imagedata[$id]['maxinitialtime'];
            }
            $subowner = 0;
            if (array_key_exists($id, $imagedata) && $imagedata[$id]['imagemetaid'] != NULL && count($imagedata[$id]['subimages'])) {
                foreach ($imagedata[$id]['subimages'] as $subid) {
                    if (array_key_exists($subid, $imagedata) && $imagedata[$subid]['ownerid'] == $user['id'] && count($imagedata[$subid]['imagerevision']) > 1) {
                        $subowner = 1;
                    }
                }
            }
            if ($subowner || array_key_exists($id, $imagedata) && count($imagedata[$id]['imagerevision']) > 1 && ($imagedata[$id]['ownerid'] == $user['id'] || checkUserHasPerm('View Debug Information'))) {
                $images[$id]['revisions'] = 1;
                $dorevisionscont = 1;
            }
        }
    }
    if (in_array('serverCheckOut', $user['privileges']) && count($checkout['image'])) {
        $serveraccess = 1;
        $extraimages = getServerProfileImages($user['id']);
        foreach ($extraimages as $id => $name) {
            if (!array_key_exists($id, $images)) {
                $images[$id] = array('name' => $name, 'basic' => 0, 'imaging' => 0, 'server' => 1, 'checkout' => 1, 'maxinitialtime' => 0, 'revisions' => 0);
                if (array_key_exists($id, $imagedata) && !$imagedata[$id]["forcheckout"]) {
                    $images[$id]['checkout'] = 0;
                }
                if (array_key_exists($id, $imagedata) && $imagedata[$id]["maxinitialtime"] != 0) {
                    $images[$id]['maxinitialtime'] = $imagedata[$id]['maxinitialtime'];
                }
                $subowner = 0;
                if (array_key_exists($id, $imagedata) && $imagedata[$id]['imagemetaid'] != NULL && count($imagedata[$id]['subimages'])) {
                    foreach ($imagedata[$id]['subimages'] as $subid) {
                        if (array_key_exists($subid, $imagedata) && $imagedata[$subid]['ownerid'] == $user['id'] && count($imagedata[$subid]['imagerevision']) > 1) {
                            $subowner = 1;
                        }
                    }
                }
                if ($subowner || array_key_exists($id, $imagedata) && count($imagedata[$id]['imagerevision']) > 1 && ($imagedata[$id]['ownerid'] == $user['id'] || checkUserHasPerm('View Debug Information'))) {
                    $images[$id]['revisions'] = 1;
                    $dorevisionscont = 1;
                }
            }
        }
    }
    $imageid = getUsersLastImage($user['id']);
    if (is_null($imageid) && count($images)) {
        $tmp = array_keys($images);
        $imageid = $tmp[0];
    }
    uasort($images, "sortKeepIndex");
    $groupid = getUserGroupID('Specify End Time', 1);
    $members = getUserGroupMembers($groupid);
    if (array_key_exists($user['id'], $members)) {
        $openend = 1;
    } else {
        $openend = 0;
    }
    $groupid = getUserGroupID('Allow No User Check', 1);
    $members = getUserGroupMembers($groupid);
    if (array_key_exists($user['id'], $members)) {
        $nousercheck = 1;
    } else {
        $nousercheck = 0;
    }
    $cdata = array('baseaccess' => $baseaccess, 'imagingaccess' => $imagingaccess, 'serveraccess' => $serveraccess, 'openend' => $openend, 'nousercheck' => $nousercheck, 'imaging' => $forimaging, 'noimaging' => $noimaging);
    $debug = processInputVar('debug', ARG_NUMERIC, 0);
    if ($debug && checkUserHasPerm('View Debug Information')) {
        $cdata['debug'] = 1;
    }
    $h = '';
    $h = "<div dojoType=dijit.Dialog\n";
    $h .= "      id=\"newResDlg\"\n";
    $h .= "      title=\"" . i("New Reservation") . "\"\n";
    $h .= "      duration=250\n";
    $h .= "      draggable=true>\n";
    $h .= "   <input type=\"hidden\" id=\"openend\" value=\"{$openend}\">\n";
    $h .= "   <div id=\"newResDlgContent\">\n";
    /*$cbtn  = "   <div align=\"center\"><br>\n";
    	$cbtn .= "   <button dojoType=\"dijit.form.Button\">\n";
    	$cbtn .= "     " . i("Close") . "\n";
    	$cbtn .= "     <script type=\"dojo/method\" event=\"onClick\">\n";
    	$cbtn .= "       dijit.byId('newResDlg').hide();\n";
    	$cbtn .= "     </script>\n";
    	$cbtn .= "   </button>\n";
    	$cbtn .= "   </div>\n"; # center
    
    	if($forimaging) {
    		$h .= "<h2>" . i("Create / Update an Image") . "</h2>\n";
    		if($imagingaccess == 0) {
    			$h .= i("You don't have access to any base images from which to create new images.") . "<br>\n";
    			return $h . $cbtn;
    		}
    	}
    	else*/
    $h .= "<h2>" . i("New Reservation") . "</h2>\n";
    if (!count($images)) {
        $h .= i("You do not have access to any images.");
        $h .= "<br><br>\n";
        $h .= "   <div align=\"center\"><br>\n";
        $h .= "   <button dojoType=\"dijit.form.Button\">\n";
        $h .= "     " . i("Close") . "\n";
        $h .= "     <script type=\"dojo/method\" event=\"onClick\">\n";
        $h .= "       dijit.byId('newResDlg').hide();\n";
        $h .= "     </script>\n";
        $h .= "   </button>\n";
        $h .= "   </div>\n";
        # center
        $h .= "</div>\n";
        # newResDlgContent
        $h .= "</div>\n";
        # newResDlg
        return $h;
    }
    $chk = array('base' => '', 'imaging' => '', 'server' => '');
    if (!$baseaccess && $serveraccess) {
        $chk['server'] = 'checked';
    } elseif ($forimaging) {
        $chk['imaging'] = 'checked';
    } else {
        $chk['base'] = 'checked';
    }
    $showradios = 0;
    if ($baseaccess + $imagingaccess + $serveraccess > 1) {
        $showradios = 1;
    }
    if ($showradios) {
        $h .= i("Reservation type:") . "<br>\n";
    }
    $h .= "<span";
    if (!$baseaccess || $showradios == 0) {
        $h .= " class=\"hidden\"";
    }
    $h .= "><input type=\"radio\" id=\"basicrdo\" name=\"restype\" ";
    $h .= "onclick=\"selectResType();\" {$chk['base']}>\n";
    $h .= "<label for=\"basicrdo\">" . i("Basic Reservation");
    $h .= "</label></span>\n";
    $h .= "<span";
    if (!$imagingaccess || $showradios == 0) {
        $h .= " class=\"hidden\"";
    }
    $h .= "><input type=\"radio\" id=\"imagingrdo\" name=\"restype\" ";
    $h .= "onclick=\"selectResType();\" {$chk['imaging']}>\n";
    $h .= "<label for=\"imagingrdo\">" . i("Imaging Reservation");
    $h .= "</label></span>\n";
    $h .= "<span";
    if (!$serveraccess || $showradios == 0) {
        $h .= " class=\"hidden\"";
    }
    $h .= "><input type=\"radio\" id=\"serverrdo\" name=\"restype\" ";
    $h .= "onclick=\"selectResType();\" {$chk['server']}>\n";
    $h .= "<label for=\"serverrdo\">" . i("Server Reservation");
    $h .= "</label></span>\n";
    if ($showradios) {
        $h .= "<br><br>\n";
    }
    $h .= "<span id=\"deployprofileslist\" class=\"hidden\">\n";
    $h .= "<div dojoType=\"dojo.data.ItemFileWriteStore\" jsId=\"profilesstore\" ";
    $h .= "data=\"profilesstoredata\"></div>\n";
    $h .= i("Profile:") . " ";
    $h .= "<select dojoType=\"dijit.form.Select\" id=\"deployprofileid\" ";
    $h .= "onChange=\"deployProfileChanged();\" sortByLabel=\"true\"></select><br>\n";
    $h .= "<fieldset>\n";
    $h .= "<legend>" . i("Description:") . "</legend>\n";
    $h .= "<div id=\"deploydesc\"></div>\n";
    $h .= "</fieldset>\n";
    $cont = addContinuationsEntry('AJserverProfileData', array('mode' => 'checkout'));
    $h .= "<button dojoType=\"dijit.form.Button\" id=\"deployFetchProfilesBtn\">\n";
    $h .= "\t" . i("Apply Profile") . "\n";
    $h .= "\t<script type=\"dojo/method\" event=onClick>\n";
    $h .= "\t\tgetServerProfileData('{$cont}', 'deployprofileid', getServerProfileDataDeployCB);\n";
    $h .= "\t</script>\n";
    $h .= "</button>";
    $h .= "<br><br>\n";
    $h .= "<input type=\"hidden\" id=\"appliedprofileid\" value=\"0\">\n";
    $h .= "</span>\n";
    # deployprofileslist
    $h .= "<div id=\"deployprofilediv\">\n";
    # directions
    $h .= "<span id=\"nrdirections\">";
    $h .= i("Please select the environment you want to use from the list:");
    $h .= "<br></span>\n";
    # javascript for max duration and image store
    $maxTimes = getUserMaxTimes();
    $maximaging = $maxTimes['initial'];
    if ($imagingaccess && $maxTimes['initial'] < MAXINITIALIMAGINGTIME) {
        $maximaging = MAXINITIALIMAGINGTIME;
    }
    $h .= "<script type=\"text/javascript\">\n";
    $h .= "var defaultMaxTime = {$maxTimes['initial']};\n";
    $h .= "var maximaging = {$maximaging};\n";
    $h .= "var images = {identifier: 'id',\n";
    $h .= "label: 'name',\n";
    $h .= "items: [\n";
    $lines = array();
    foreach ($images as $id => $img) {
        $lines[] = "   {id: {$id}, name: '{$img['name']}', basic: {$img['basic']}, " . "imaging: {$img['imaging']}, server: {$img['server']}, " . "checkout: {$img['checkout']}, revisions: {$img['revisions']}, " . "maxinitialtime: {$img['maxinitialtime']}}";
    }
    $h .= implode(",\n", $lines);
    $h .= "\n]};\n";
    $h .= "var lastimageid = {$imageid};\n";
    $h .= "var imagingaccess = {$imagingaccess};\n";
    $h .= "</script>\n";
    $cdata['maxinitial'] = $maxTimes['initial'];
    # image
    $h .= "<span class=\"labeledform\">";
    $h .= resourceStore('image', 1, 'detailimagestore');
    $h .= "<div dojoType=\"dojo.data.ItemFileWriteStore\" data=\"images\" ";
    $h .= "jsId=\"imagestore\"></div>\n";
    $h .= "<select dojoType=\"dijit.form.FilteringSelect\" id=\"deployimage\" ";
    $h .= "style=\"width: 400px\" required=\"true\" store=\"imagestore\" ";
    $h .= "queryExpr=\"*\${0}*\" ";
    if ($forimaging) {
        $h .= "query=\"{imaging: 1}\" ";
    } else {
        $h .= "query=\"{basic: 1, checkout: 1}\" ";
    }
    $h .= "highlightMatch=\"all\" autoComplete=\"false\" ";
    $h .= "invalidMessage=\"Please select a valid environment\" ";
    $h .= "onChange=\"selectEnvironment();\" tabIndex=1></select>\n";
    $h .= "</span><br><br>\n";
    $imagenotes = getImageNotes($imageid);
    $desc = '';
    if (!preg_match('/^\\s*$/', $imagenotes['description'])) {
        $desc = preg_replace("/\n/", '<br>', $imagenotes['description']);
        $desc = preg_replace("/\r/", '', $desc);
        $desc = "<strong>" . i("Image Description") . "</strong>:<br>\n" . "{$desc}<br><br>\n";
    }
    $h .= "<div id=imgdesc>{$desc}</div>\n";
    # name
    $h .= "<div id=\"newreslabelfields\">\n";
    $h .= "<span id=\"nrnamespan\" class=\"hidden\">\n";
    $h .= "<label for=\"deployname\">" . i("Reservation Name:") . "</label>\n";
    $h .= "<span class=\"labeledform\">\n";
    $h .= "<input type=\"text\" id=\"deployname\" style=\"width: 400px\" ";
    $h .= "dojoType=\"dijit.form.ValidationTextBox\" ";
    $h .= "regExp=\"^([-a-zA-Z0-9_\\. ]){0,255}\$\" invalidMessage=\"";
    $h .= i('The reservation name can only contain letters, numbers, spaces, dashes(-), underscores(_), and periods(.) and can be up to 255 characters long');
    $h .= "\"></span><br></span>\n";
    $h .= "<span id=\"nrservergroupspan\" class=\"hidden\">";
    # admin group
    if ($user['showallgroups']) {
        $admingroups = getUserGroups();
    } else {
        $admingroups = getUserGroups(0, $user['affiliationid']);
    }
    $h .= "<label for=\"deployadmingroup\">";
    $h .= i("Admin User Group:") . "</label><span class=\"labeledform\">";
    if (USEFILTERINGSELECT && count($admingroups) < FILTERINGSELECTTHRESHOLD) {
        $h .= "<select dojoType=\"dijit.form.FilteringSelect\" id=\"deployadmingroup\" ";
        $h .= "style=\"width: 400px\" queryExpr=\"*\${0}*\" required=\"true\" ";
        $h .= "highlightMatch=\"all\" autoComplete=\"false\">\n";
    } else {
        $h .= "<select id=\"deployadmingroup\">\n";
    }
    $h .= "  <option value=\"0\">None</option>\n";
    foreach ($admingroups as $id => $group) {
        if ($group['name'] == 'None' || preg_match('/^None@.*$/', $group['name'])) {
            continue;
        }
        $h .= "  <option value=\"{$id}\">{$group['name']}</option>\n";
    }
    $h .= "</select></span><br>\n";
    $h .= "<div id=\"admingrpnote\" class=\"hidden\" ";
    $h .= "style=\"width: 400px; margin: 3px 0 3px 10.5em; padding: 1px; border: 1px solid;\">";
    $h .= i("Administrative access has been disabled for this image. Users in the Admin User Group will have control of the reservaion on the Reservations page but will not have administrative access within the reservation.");
    $h .= "</div>\n";
    # login group
    $logingroups = $admingroups;
    $h .= "<label for=\"deploylogingroup\">";
    $h .= i("Access User Group:") . "</label><span class=\"labeledform\">";
    if (USEFILTERINGSELECT && count($logingroups) < FILTERINGSELECTTHRESHOLD) {
        $h .= "<select dojoType=\"dijit.form.FilteringSelect\" id=\"deploylogingroup\" ";
        $h .= "style=\"width: 400px\" queryExpr=\"*\${0}*\" required=\"true\" ";
        $h .= "highlightMatch=\"all\" autoComplete=\"false\">\n";
    } else {
        $h .= "<select id=\"deploylogingroup\">\n";
    }
    $h .= "  <option value=\"0\">None</option>\n";
    foreach ($logingroups as $id => $group) {
        if ($group['name'] == 'None' || preg_match('/^None@.*$/', $group['name'])) {
            continue;
        }
        $h .= "  <option value=\"{$id}\">{$group['name']}</option>\n";
    }
    $h .= "</select></span><br></span>\n";
    # fixed MAC
    /*$h .= "<span id=\"nrmacaddrspan\">\n";
    	$h .= "<label for=\"deployfixedMAC\">";
    	$h .= i("Fixed MAC Address:") . "</label>\n";
    	$h .= "<span class=\"labeledform\">\n";
    	$h .= "<input type=\"text\" id=\"deployfixedMAC\" style=\"width: 200px\" ";
    	$h .= "dojoType=\"dijit.form.ValidationTextBox\" ";
    	$h .= "regExp=\"([0-9a-fA-F]{2}:){5}([0-9a-fA-F]{2})\">(optional)</span>";
    	$h .= "<br></span>\n";*/
    # monitored
    /*$h .= "<span id=\"nrmonitoredspan\">\n";
    	$h .= "<label for=\"deploymonitored\">" . i("Monitored:") . "</label>\n";
    	$h .= "<span class=\"labeledform\"><input type=\"checkbox\" ";
    	$h .= "id=\"deploymonitored\" dijit.form.CheckBox\"></span><br></span>\n";*/
    # fixed IP block
    $h .= "<div id=\"nrfixedipdiv2\" class=\"hidden\">\n";
    $h .= "<div id=\"nrfixedipdiv\">\n";
    # ip addr
    $regip1 = "(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)";
    $regip4 = "{$regip1}\\.{$regip1}\\.{$regip1}\\.{$regip1}";
    $h .= "<label for=\"deployfixedIP\">" . i("Fixed IP Address:") . "</label>\n";
    $h .= "<span class=\"labeledform\"><input type=\"text\" ";
    $h .= "id=\"deployfixedIP\" style=\"width: 180px\" ";
    $h .= "dojoType=\"dijit.form.ValidationTextBox\" regExp=\"{$regip4}\" ";
    $h .= "onKeyUp=\"checkFixedSet('deploy');\">" . i("(optional)") . "</span><br>\n";
    # netmask
    $h .= "<label for=\"deploynetmask\">" . i("Netmask:") . "</label>\n";
    $h .= "<span class=\"labeledform\"><input type=\"text\" ";
    $h .= "id=\"deploynetmask\" style=\"width: 180px\" ";
    $h .= "dojoType=\"dijit.form.ValidationTextBox\" regExp=\"{$regip4}\" ";
    $h .= "validator=\"validateNetmask\" onKeyUp=\"fetchRouterDNS('deploy');\" ";
    $h .= "disabled></span><br>\n";
    # router
    $h .= "<label for=\"deployrouter\">" . i("Router:") . "</label>\n";
    $h .= "<span class=\"labeledform\"><input type=\"text\" ";
    $h .= "id=\"deployrouter\" style=\"width: 180px\" ";
    $h .= "dojoType=\"dijit.form.ValidationTextBox\" regExp=\"{$regip4}\" ";
    $h .= "disabled></span><br>\n";
    # dns servers
    $h .= "<label for=\"deploydns\">" . i("DNS Server(s):") . "</label>\n";
    $h .= "<span class=\"labeledform\"><input type=\"text\" ";
    $h .= "id=\"deploydns\" style=\"width: 180px\" ";
    $h .= "dojoType=\"dijit.form.ValidationTextBox\" ";
    $h .= "regExp=\"({$regip4})(,{$regip4}){0,2}\" disabled></span><br>\n";
    $h .= "</div>\n";
    # nrfixedipdiv
    $h .= "<br><br>";
    $h .= "</div>\n";
    # nrfixedipdiv2
    $h .= "</div>\n";
    # newreslabelfields
    $h .= "<span id=\"nousercheckspan\"";
    if (!$nousercheck) {
        $h .= " class=\"hidden\"";
    }
    $h .= ">\n";
    if ($nousercheck) {
        $h .= labeledFormItem('nousercheck', i('Disable timeout for disconnected users'), 'check', '', '', '1');
    }
    $h .= "<br></span>";
    $h .= "<span id=\"whentitlebasic\">";
    $h .= i("When would you like to use the environment?");
    $h .= "</span>\n";
    $h .= "<span id=\"whentitleimaging\" class=\"hidden\">";
    $h .= i("When would you like to start the imaging process?");
    $h .= "</span>\n";
    $h .= "<span id=\"whentitleserver\" class=\"hidden\">";
    $h .= i("When would you like to deploy the server?");
    $h .= "</span>";
    $h .= "<br>\n";
    # duration radios
    $h .= "&nbsp;&nbsp;&nbsp;";
    $h .= "<input type=\"radio\" id=\"startnow\" name=\"deploystart\" ";
    $h .= "onclick=\"setStartNow();\" checked>\n";
    $h .= "<label for=\"startnow\">" . i("Now") . "</label><br>\n";
    $h .= "&nbsp;&nbsp;&nbsp;";
    $h .= "<input type=\"radio\" id=\"startlater\" name=\"deploystart\" ";
    $h .= "onclick=\"setStartLater();\">\n";
    $h .= "<label for=\"startlater\">" . i("Later:") . "</label>\n";
    # limited start
    $days = getReserveDayData();
    $h .= "<span id=\"limitstart\">\n";
    $h .= selectInputHTML('day', $days, 'deploystartday', "onChange='setStartLater();'");
    $h .= "&nbsp;" . i("At") . "&nbsp;\n";
    $tmpArr = array();
    for ($i = 1; $i < 13; $i++) {
        $tmpArr[$i] = $i;
    }
    $timestamp = unixFloor15(time() + 4500);
    $timeArr = explode(',', date('g,i,a', $timestamp));
    $h .= selectInputHTML('hour', $tmpArr, 'deployhour', "onChange='setStartLater();'", $timeArr[0]);
    $minutes = array("0" => "00", "15" => "15", "30" => "30", "45" => "45");
    $h .= selectInputHTML('minute', $minutes, 'deploymin', "onChange='setStartLater();'", $timeArr[1]);
    $h .= selectInputHTML('meridian', array("am" => "a.m.", "pm" => "p.m."), 'deploymeridian', "onChange='setStartLater();'", $timeArr[2]);
    $h .= "</span>\n";
    # any start
    $h .= "<span id=\"anystart\" class=\"hidden\">\n";
    $h .= "<div dojoType=\"dijit.form.DateTextBox\" ";
    $h .= "id=\"deploystartdate\" onChange=\"setStartLater();\" ";
    $h .= "style=\"width: 88px;\"></div>\n";
    $h .= "<div id=\"deploystarttime\" dojoType=\"dijit.form.TimeTextBox\" ";
    $h .= "style=\"width: 88px\" onChange=\"setStartLater();\"></div>\n";
    $h .= "</span>\n";
    $h .= "<small>(" . date('T') . ")</small><br><br>\n";
    $h .= "<span id=\"endlbl\"";
    if (!$openend) {
        $h .= " class=\"hidden\"";
    }
    $h .= ">" . i("Ending:") . "<br></span>\n";
    # ending by duration
    $h .= "<span id=\"durationend\">\n";
    $h .= "&nbsp;&nbsp;&nbsp;";
    if ($openend) {
        $h .= "<input type=\"radio\" id=\"endduration\" name=\"deployend\" ";
        $h .= "onclick=\"setEndDuration();\">\n";
        $h .= "<label for=\"endduration\">";
    }
    $h .= i("Duration");
    if ($openend) {
        $h .= ":&nbsp;</label>\n";
    }
    $maxtimes = getUserMaxTimes();
    if ($imaging && $maxtimes['initial'] < 720) {
        # make sure at least 12 hours available for imaging reservations
        $maxtimes['initial'] = 720;
    }
    $lengths = getReservationLengths($maxtimes['initial']);
    $h .= selectInputHTML('length', $lengths, 'reqlength', "onChange='updateWaitTime(0); setEndDuration(); durationChange();'", 60);
    $h .= "<br></span>\n";
    # ending is indefinite
    $h .= "<span id=\"indefiniteend\" class=\"hidden\">\n";
    if ($serveraccess) {
        $h .= "&nbsp;&nbsp;&nbsp;";
        $h .= "<input type=\"radio\" id=\"endindef\" name=\"deployend\" ";
        $h .= "onclick=\"setEndIndef();\">\n";
        $h .= "<label for=\"endindef\">" . i("Indefinite") . "</label><br>\n";
    }
    $h .= "</span>\n";
    # ending by date/time
    $h .= "<span id=\"specifyend\"";
    if (!$openend) {
        $h .= " class=\"hidden\"";
    }
    $h .= ">\n";
    if ($openend || $serveraccess) {
        $h .= "&nbsp;&nbsp;&nbsp;";
        $h .= "<input type=\"radio\" id=\"endat\" name=\"deployend\" ";
        $h .= "onclick=\"setEndAt();\">\n";
        $h .= "<label for=\"endat\">" . i("At this time:") . "</label>\n";
        $h .= "<div type=\"text\" dojoType=\"dijit.form.DateTextBox\" ";
        $h .= "id=\"deployenddate\" onChange=\"setEndAt();\" ";
        $h .= "style=\"width: 88px\"></div>\n";
        $h .= "<div type=\"text\" id=\"deployendtime\" dojoType=\"dijit.form.TimeTextBox\" ";
        $h .= "style=\"width: 88px\" onChange=\"setEndAt();\"></div>\n";
        $h .= "<small>(" . date('T') . ")</small><br>\n";
    }
    $h .= "</span><br>\n";
    $h .= "<div id=\"deployerr\" class=\"rederrormsg\"></div>\n";
    $h .= "<div id=\"waittime\"></div><br>\n";
    $h .= "</div>\n";
    # deployprofilediv
    $h .= "   </div>\n";
    $h .= "   <input type=\"hidden\" id=\"newrescont\">\n";
    $h .= "   <div align=\"center\">\n";
    /*$h .= "   <button id=\"newResDlgShowConfigBtn\" dojoType=\"dijit.form.Button\" ";
    	$h .= "class=\"hidden\">\n";
    	$h .= "    " . i("Configure System") . "\n";
    	$h .= "     <script type=\"dojo/method\" event=\"onClick\">\n";
    	$h .= "       showConfigureSystem();\n";
    	$h .= "     </script>\n";
    	$h .= "   </button>\n";*/
    $h .= dijitButton('newResDlgBtn', i("Create Reservation"), "submitNewReservation();");
    $h .= dijitButton('', i("Cancel"), "dijit.byId('newResDlg').hide();");
    $h .= "   </div>\n";
    $cont = addContinuationsEntry('AJnewRequest', $cdata, SECINDAY);
    $h .= "<input type=\"hidden\" id=\"deploycont\" value=\"{$cont}\">\n";
    if ($serveraccess) {
        $cont = addContinuationsEntry('AJfetchRouterDNS');
        $h .= "<input type=\"hidden\" id=\"fetchrouterdns\" value=\"{$cont}\">\n";
    }
    $cont = addContinuationsEntry('AJupdateWaitTime', $cdata);
    $h .= "<INPUT type=\"hidden\" id=\"waitcontinuation\" value=\"{$cont}\">\n";
    $h .= "</div>\n";
    return $h;
}
Ejemplo n.º 3
0
 function subimageDialogContent()
 {
     $imageid = getContinuationVar('imageid');
     $images = getImages(0);
     $image = $images[$imageid];
     $resources = getUserResources(array("imageAdmin"));
     if (empty($resources['image'])) {
         print i("You do not have access to add any subimages to this image.");
         return;
     }
     $h = "<h3>" . i("Add New Subimage") . "</h3>";
     $h .= "<select dojoType=\"dijit.form.FilteringSelect\" id=\"addsubimagesel\">";
     foreach ($resources['image'] as $id => $name) {
         if ($name == 'No Image') {
             continue;
         }
         $h .= "<option value={$id}>{$name}</option>";
     }
     $h .= "</select>";
     $h .= dijitButton('addbtn', i("Add Subimage"), "addSubimage();");
     $h .= "<br>";
     $h .= "<h3>" . i("Current Subimages") . "</h3>";
     $subimgcnt = 0;
     if (array_key_exists("subimages", $image) && count($image["subimages"])) {
         $subimages = array();
         foreach ($image["subimages"] as $imgid) {
             $subimages[] = array('id' => $imgid, 'name' => $images[$imgid]['prettyname']);
         }
         uasort($subimages, "sortKeepIndex");
         $h .= "<select id=\"cursubimagesel\" multiple size=\"10\">";
         foreach ($subimages as $img) {
             $h .= "<option value={$img['id']}>{$img['name']}</option>";
             $subimgcnt++;
         }
     } else {
         $h .= "<select id=\"cursubimagesel\" multiple size=\"10\" disabled>";
         $image['subimages'] = array();
         $h .= "<option value=\"none\">" . i("(None)") . "</option>";
     }
     $h .= "</select><br>";
     $h .= i("total subimages:") . " <span id=subimgcnt>{$subimgcnt}</span><br>";
     $h .= dijitButton('rembtn', i("Remove Selected Subimage(s)"), "remSubimages();");
     $h .= "<br>";
     $adminimages = getUserResources(array("imageAdmin"), array("administer"));
     $adminids = array_keys($adminimages["image"]);
     $cdata = $this->basecdata;
     $cdata['imageid'] = $imageid;
     $cdata['adminids'] = $adminids;
     $cdata['imagemetaid'] = $image['imagemetaid'];
     $cdata['userimageids'] = array_keys($resources['image']);
     $cdata['subimages'] = $image['subimages'];
     $cont = addContinuationsEntry('AJaddSubimage', $cdata, SECINDAY, 1, 0);
     $h .= "<INPUT type=\"hidden\" id=\"addsubimagecont\" value=\"{$cont}\">";
     $cont = addContinuationsEntry('AJremSubimage', $cdata, SECINDAY, 1, 0);
     $h .= "<INPUT type=\"hidden\" id=\"remsubimagecont\" value=\"{$cont}\">";
     $h .= "<div style=\"width: 320px;\">\n";
     $h .= i("NOTE: Subimage changes take effect immediately; you do <strong>not</strong> need to click \"Submit Changes\" to submit them.");
     $h .= "</div>\n";
     print $h;
 }
Ejemplo n.º 4
0
 function mapByMapToGroupHTML()
 {
     $tmp = getUserResources(array($this->maptype . "Admin"), array("manageMapping"), 1);
     $mapgroups = $tmp[$this->maptype];
     uasort($mapgroups, "sortKeepIndex");
     $tmp = getUserResources(array($this->restype . "Admin"), array("manageMapping"), 1);
     $groups = $tmp[$this->restype];
     uasort($groups, "sortKeepIndex");
     $h = '';
     if (!count($mapgroups) || !count($groups)) {
         $h .= "You don't have access to manage any mappings for this resource ";
         $h .= "type.<br>\n";
         return $h;
     }
     $h .= "<div id=\"mapbymaptogroupdiv\" dojoType=\"dijit.layout.ContentPane\" ";
     $h .= "title=\"" . i("Map By {$this->maptypename} Group") . "\">\n";
     $h .= "<div style=\"width: 410px;\">\n";
     $h .= i("Select an item from the drop-down box and click \"Get {$this->restypename} Groups\" to see all of the groups it maps to. Then, select a group it does not map to and click the Add button to map it to that group, or select a group it maps to and click the Remove button to unmap it from that group.");
     $h .= "</div><br>\n";
     $h .= i("{$this->maptypename} Group:") . "<select id=\"maptogroups\">\n";
     foreach ($mapgroups as $id => $group) {
         $h .= "<option value={$id}>{$group}</option>\n";
     }
     $h .= "</select>\n";
     $h .= dijitButton('', i("Get {$this->restypename} Groups"), "populateLists('maptogroups', 'inmaptogroups', 'inmaptogroupname', 'outmaptogroupname', 'mapbymaptogroupcont');");
     $h .= "<table><tbody><tr>\n";
     # select for groups mapped to
     $h .= "<td valign=top>\n";
     $h .= sprintf(i("{$this->restypename} Groups %s maps to:"), "<span style=\"font-weight: bold;\" id=\"inmaptogroupname\"></span>");
     $h .= "<br>\n";
     $h .= "<table dojoType=\"dojox.grid.DataGrid\" jsId=\"inmaptogroups\" ";
     $h .= "store=\"mapbymaptogroupstore\" style=\"width: 240px; height: 250px;\" query=\"{inout: 1}\" ";
     $h .= "selectionMode=\"extended\">\n";
     $h .= "<thead>\n";
     $h .= "<tr>\n";
     $h .= "<th field=\"name\" width=\"160px\"></th>\n";
     $h .= "</tr>\n";
     $h .= "</thead>\n";
     $h .= "</table>\n";
     $h .= "</td>\n";
     # transfer buttons
     $h .= "<td style=\"vertical-align: middle;\">\n";
     $h .= dijitButton('', "<div style=\"width: 50px;\">&lt;-" . i("Add") . "</div>", "resource.addRemItem('addmaptogrpcont', 'maptogroups', 'outmaptogroups');");
     $cdata = $this->basecdata;
     $cdata['mode'] = 'add';
     $cont = addContinuationsEntry('AJaddRemGroupMapTo', $cdata);
     $h .= "<input type=\"hidden\" id=\"addmaptogrpcont\" value=\"{$cont}\">\n";
     $h .= "<br><br><br>\n";
     $h .= dijitButton('', "<div style=\"width: 50px;\">" . i("Remove") . "-&gt;</div>", "resource.addRemItem('remmaptogrpcont', 'maptogroups', 'inmaptogroups');");
     $cdata['mode'] = 'remove';
     $cont = addContinuationsEntry('AJaddRemGroupMapTo', $cdata);
     $h .= "<input type=\"hidden\" id=\"remmaptogrpcont\" value=\"{$cont}\">\n";
     $h .= "</td>\n";
     # select for groups resource is not in
     $h .= "<td valign=top>\n";
     $h .= sprintf(i("{$this->restypename} Groups %s does not map to:"), "<span style=\"font-weight: bold;\" id=\"outmaptogroupname\"></span>");
     $h .= "<br>\n";
     $h .= "<table dojoType=\"dojox.grid.DataGrid\" jsId=\"outmaptogroups\" ";
     $h .= "store=\"mapbymaptogroupstore\" style=\"width: 240px; height: 250px;\" query=\"{inout: 1}\" ";
     $h .= "selectionMode=\"extended\">\n";
     $h .= "<thead>\n";
     $h .= "<tr>\n";
     $h .= "<th field=\"name\" width=\"160px\"></th>\n";
     $h .= "</tr>\n";
     $h .= "</thead>\n";
     $h .= "</table>\n";
     $h .= "</td>\n";
     $h .= "</tr></tbody></table>\n";
     $cdata = $this->basecdata;
     $cdata['store'] = 'mapbymaptogroupstore';
     $cdata['intitle'] = 'inmaptogroups';
     $cdata['outtitle'] = 'outmaptogroups';
     $cont = addContinuationsEntry('jsonResourceMappingGroups', $cdata);
     $h .= "<input type=hidden id=\"mapbymaptogroupcont\" value=\"{$cont}\">\n";
     $h .= "</div>\n";
     return $h;
 }
Ejemplo n.º 5
0
 function getHTML()
 {
     global $user;
     $val = getVariable($this->key, $this->defaultval);
     $h = "<div class=\"configwidget\" style=\"width: 100%;\">\n";
     $h .= "<h3>{$this->name}</h3>\n";
     $h .= "<span class=\"siteconfigdesc\">\n";
     $h .= $this->desc;
     $h .= "<br><br></span>\n";
     switch ($this->type) {
         case 'numeric':
             $extra = array('smallDelta' => 1, 'largeDelta' => 10);
             $h .= labeledFormItem($this->domidbase, $this->label, 'spinner', "{min:{$this->minval}, max:{$this->maxval}}", 1, $val, '', '', $extra);
             break;
         case 'boolean':
             $extra = array();
             if ($val == 1) {
                 $extra = array('checked' => 'checked');
             }
             $h .= labeledFormItem($this->domidbase, $this->label, 'check', '', 1, 1, '', '', $extra);
             break;
         case 'textarea':
             $h .= labeledFormItem($this->domidbase, $this->label, 'textarea', '', 1, $val, '', '', '', '120px');
             break;
         default:
             $h .= labeledFormItem($this->domidbase, $this->label, 'text', '', 1, $val);
             break;
     }
     $h .= "<div id=\"{$this->domidbase}msg\"></div>\n";
     $h .= dijitButton("{$this->domidbase}btn", i('Submit Changes'), "{$this->jsname}.saveSettings();", 1);
     $cdata = $this->basecdata;
     $cont = addContinuationsEntry('AJupdateAllSettings', $cdata);
     $h .= "<input type=\"hidden\" id=\"{$this->domidbase}cont\" value=\"{$cont}\">\n";
     $h .= "</div>\n";
     return $h;
 }
Ejemplo n.º 6
0
 function addEditDialogHTML($add = 0)
 {
     global $user;
     # dialog for on page editing
     $h = '';
     $h .= "<div dojoType=dijit.Dialog\n";
     $h .= "      id=\"addeditdlg\"\n";
     $h .= "      title=\"Edit {$this->restypename}\"\n";
     $h .= "      duration=250\n";
     $h .= "      draggable=true>\n";
     $h .= "<div id=\"addeditdlgcontent\">\n";
     $h .= "<div id=\"mgmtnodedlgcontent\">\n";
     $h .= "<div style=\"text-align: center;\">\n";
     $h .= "<small>* denotes required fields</small><br><br>\n";
     $h .= "</div>\n";
     # id
     $h .= "<input type=\"hidden\" id=\"editresid\">\n";
     #$h .= "<div style=\"width: 80%; margin-left: 10%;\">\n";
     # name
     $errmsg = i("Name can only contain letters, numbers, dashes(-), periods(.), and underscores(_). It can be from 1 to 50 characters long.");
     $h .= labeledFormItem('name', i('Name') . '*', 'text', '^([a-zA-Z0-9_][-a-zA-Z0-9_\\.]{1,49})$', 1, '', $errmsg);
     # owner
     $extra = array('onKeyPress' => 'setOwnerChecking');
     $h .= labeledFormItem('owner', i('Owner') . '*', 'text', '', 1, "{$user['unityid']}@{$user['affiliation']}", i('Unknown user'), 'checkOwner', $extra);
     $cont = addContinuationsEntry('AJvalidateUserid');
     $h .= "<input type=\"hidden\" id=\"valuseridcont\" value=\"{$cont}\">\n";
     # IP address
     $ipreg = '(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)';
     $ipreg1 = "^{$ipreg}\$";
     $errmsg = i("Invalid IP address specified - must be a valid IPV4 address");
     $h .= labeledFormItem('ipaddress', i('IP Address') . '*', 'text', $ipreg1, 1, '', $errmsg);
     # State
     $vals = array(2 => "available", 10 => "maintenance", 5 => "failed");
     $h .= labeledFormItem('stateid', i('State'), 'select', $vals);
     # sysadmin email
     $reg = '^([A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,4},)*([A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,4})$';
     $errmsg = i("Invalid email address(es) specified");
     $h .= labeledFormItem('sysadminemail', i("SysAdmin Email Address(es)"), 'text', $reg, 0, '', $errmsg, '', '', '', helpIcon('sysadminemailhelp'));
     # shared mailbox
     $reg = '^([A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,4})$';
     $errmsg = i("Invalid email address specified");
     $h .= labeledFormItem('sharedmailbox', i('Address for Shadow Emails'), 'text', $reg, 0, '', $errmsg, '', '', '', helpIcon('sharedmailboxhelp'));
     # checkininterval
     $extra = array('smallDelta' => 1, 'largeDelta' => 2);
     $h .= labeledFormItem('checkininterval', i('Check-in Interval (sec)'), 'spinner', '{min:5,max:30,places:0}', 1, '6', '', '', $extra, '', helpIcon('checkinhelp'));
     # installpath
     $reg = '^([-a-zA-Z0-9_\\.\\/]){2,100}$';
     $errmsg = i("Invalid install path specified");
     $h .= labeledFormItem('installpath', i('Install Path'), 'text', $reg, 0, '', $errmsg, '', '', '', helpIcon('installpathhelp'));
     # timeserver list
     $reg = '^(([a-zA-Z0-9_][-a-zA-Z0-9_\\.]{1,49})(,?)){1,5}$';
     $errmsg = i("Invalid time server(s) specified. Must be comman delimited list of hostnames or IP addresses, with up to 5 allowed");
     $val = getVariable('timesource|global');
     $h .= labeledFormItem('timeservers', i('Time Server(s)'), 'text', $reg, 0, $val, $errmsg, '', '', '', helpIcon('timeservershelp'));
     # keys
     $reg = '^([-a-zA-Z0-9_\\.\\/,]){2,1024}$';
     $errmsg = i("Invalid path to identity key files");
     $h .= labeledFormItem('keys', i('End Node SSH Identity Key Files'), 'text', $reg, 0, '', $errmsg, '', '', '', helpIcon('identityhelp'));
     # sshport
     $extra = array('smallDelta' => 1, 'largeDelta' => 2);
     $h .= labeledFormItem('sshport', i('SSH Port for this node'), 'spinner', '{min:1,max:65535,places:0}', 1, '22', '', '', $extra, '', helpIcon('sshporthelp'));
     # image library
     $h .= "<div class=\"boxedoptions\">\n";
     # imagelibenable
     $extra = array('onChange' => 'toggleImageLibrary();');
     $h .= labeledFormItem('imagelibenable', i('Enable Image Library'), 'check', '', '', '', '', '', $extra, '', helpIcon('imagelibhelp'));
     # imagelibgroupid
     $disabled = array('disabled' => 'true');
     $vals = getUserResources(array('mgmtNodeAdmin'), array("manageGroup"), 1);
     $h .= labeledFormItem('imagelibgroupid', i('Image Library Management Node Group'), 'select', $vals['managementnode'], '', '', '', '', $disabled, '', helpIcon('imagelibgrouphelp'));
     # imagelibuser
     $reg = '^([-a-zA-Z0-9_\\.\\/,]){2,20}$';
     $errmsg = i("Invalid image library user");
     $h .= labeledFormItem('imagelibuser', i('Image Library User'), 'text', $reg, 0, '', $errmsg, '', $disabled, '', helpIcon('imagelibuserhelp'));
     # imagelibkey
     $reg = '^([-a-zA-Z0-9_\\.\\/,]){2,100}$';
     $errmsg = i("Invalid image library identity key");
     $h .= labeledFormItem('imagelibkey', i('Image Library SSH Identity Key File'), 'text', $reg, 0, '', $errmsg, '', $disabled, '', helpIcon('imagelibkeyhelp'));
     $h .= "</div>\n";
     # image library
     # IP config method
     $h .= "<div class=\"boxedoptions\">\n";
     # publicIPconfig
     $extra = array('onChange' => 'togglePublic();');
     $vals = array('dynamicDHCP' => 'Dynamic DHCP', 'manualDHCP' => 'Manual DHCP', 'static' => 'Static');
     $h .= labeledFormItem('publicIPconfig', i('Public NIC configuration method'), 'select', $vals, '', '', '', '', $extra, '', helpIcon('ipconfighelp'));
     # netmask
     $errmsg = i("Invalid public netmask");
     $h .= labeledFormItem('publicnetmask', i('Public Netmask'), 'text', $ipreg1, 0, '', $errmsg, '', $disabled, '', helpIcon('netmaskhelp'));
     # gateway
     $reg = '^[a-zA-Z0-9_][-a-zA-Z0-9_\\.]{1,56}$';
     $errmsg = i("Invalid public gateway");
     $h .= labeledFormItem('publicgateway', i('Public Gateway'), 'text', $reg, 0, '', $errmsg, '', $disabled, '', helpIcon('gatewayhelp'));
     # dnsserver
     $reg = "^({$ipreg},)*({$ipreg})\$";
     $errmsg = i("Invalid public DNS server");
     $h .= labeledFormItem('publicdnsserver', i('Public DNS Server'), 'text', $reg, 0, '', $errmsg, '', $disabled, '', helpIcon('dnsserverhelp'));
     $h .= "</div>\n";
     # IP config method
     # available public networks
     $h .= labeledFormItem('availablenetworks', i('Available Public Networks'), 'textarea', '', 1, '', '', '', '', '', helpIcon('availnetshelp'));
     # federated auth
     $h .= labeledFormItem('federatedauth', i('Affiliations using Federated Authentication for Linux Images'), 'textarea', '', 1, '', '', '', '', '', helpIcon('federatedauthhelp'));
     # NAT Host
     $h .= "<div id=\"nathost\" class=\"boxedoptions\">\n";
     # use as NAT host
     $extra = array('onChange' => "toggleNAThost();");
     $h .= labeledFormItem('nathostenabled', i('Use as NAT Host'), 'check', '', '', '1', '', '', $extra);
     # public IP
     $errmsg = i("Invalid NAT Public IP address specified - must be a valid IPV4 address");
     $h .= labeledFormItem('natpublicipaddress', i('NAT Public IP Address'), 'text', $ipreg1, 1, '', $errmsg, '', '', '', helpIcon('natpubliciphelp'));
     # internal IP
     $errmsg = i("Invalid NAT Internal IP address specified - must be a valid IPV4 address");
     $h .= labeledFormItem('natinternalipaddress', i('NAT Internal IP Address'), 'text', $ipreg1, 1, '', $errmsg, '', '', '', helpIcon('natinternaliphelp'));
     $h .= "</div>\n";
     # NAT Host
     $h .= "</div>\n";
     # mgmtnodedlgcontent
     $h .= "</div>\n";
     # addeditdlgcontent
     $h .= "<div id=\"addeditdlgerrmsg\" class=\"nperrormsg\"></div>\n";
     $h .= "<div id=\"editdlgbtns\" align=\"center\">\n";
     $h .= dijitButton('addeditbtn', "Confirm", "saveResource();");
     $h .= dijitButton('', "Cancel", "dijit.byId('addeditdlg').hide();");
     $h .= "</div>\n";
     # editdlgbtns
     $h .= "</div>\n";
     # addeditdlg
     $h .= "<div dojoType=dijit.Dialog\n";
     $h .= "      id=\"groupingnote\"\n";
     $h .= "      title=\"Management Node Grouping\"\n";
     $h .= "      duration=250\n";
     $h .= "      draggable=true>\n";
     $h .= "Each managemente node needs to be a member of a<br>management node resource group. The following dialog<br>will allow you to add the new management node to a group.<br><br>\n";
     $h .= "<div align=\"center\">\n";
     $h .= dijitButton('', "Close", "dijit.byId('groupingnote').hide();");
     $h .= "</div>\n";
     # btn div
     $h .= "</div>\n";
     # groupingnote
     $h .= "<div dojoType=dijit.Dialog\n";
     $h .= "      id=\"groupdlg\"\n";
     $h .= "      title=\"Management Node Grouping\"\n";
     $h .= "      duration=250\n";
     $h .= "      draggable=true>\n";
     $h .= "<div id=\"groupdlgcontent\"></div>\n";
     $h .= "<div align=\"center\">\n";
     $script = "    dijit.byId('groupdlg').hide();\n";
     $script .= "    checkFirstAdd();\n";
     $h .= dijitButton('', "Close", $script);
     $h .= "</div>\n";
     # btn div
     $h .= "</div>\n";
     # groupdlg
     $h .= "<div id=\"tooltips\">\n";
     $h .= helpTooltip('sysadminemailhelp', i("Comma delimited list of email addresses for sysadmins who should receive error emails from this management node. Leave empty to disable this feature."));
     $h .= helpTooltip('sharedmailboxhelp', i("Single email address to which copies of all user emails should be sent. This is a high traffic set of emails. Leave empty to disable this feature."));
     $h .= helpTooltip('checkinhelp', i("the number of seconds that this management node will wait before checking the database for tasks."));
     $h .= helpTooltip('installpathhelp', i("path to parent directory of image repository directories (typically /install) - only needed with bare metal installs or VMWare with local disk"));
     $h .= helpTooltip('timeservershelp', i("comma delimited list of time servers for this management node"));
     $h .= helpTooltip('identityhelp', i("comma delimited list of full paths to ssh identity keys to try when connecting to end nodes (optional)"));
     $h .= helpTooltip('sshporthelp', i("SSH port this node is listening on for image file transfers"));
     $h .= helpTooltip('imagelibhelp', i("Enable sharing of images between management nodes. This allows a management node to attempt fetching files for a requested image from other management nodes if it does not have them."));
     $h .= helpTooltip('imagelibgrouphelp', i("This management node will try to get image files from other nodes in the selected group."));
     $h .= helpTooltip('imagelibuserhelp', i("userid to use for scp when copying image files from another management node"));
     $h .= helpTooltip('imagelibkeyhelp', i("path to ssh identity key file to use for scp when copying image files from another management node"));
     $h .= helpTooltip('ipconfighelp', i("Method by which public NIC on nodes controlled by this management node recive their network configuration <ul><li>Dynamic DHCP - nodes receive an address via DHCP from a pool of addresses</li><li>Manual DHCP - nodes always receive the same address via DHCP</li><li>Static - VCL will configure the public address of the node</li></ul>"));
     $h .= helpTooltip('netmaskhelp', i("Netmask for public NIC"));
     $h .= helpTooltip('gatewayhelp', i("IP address of gateway for public NIC"));
     $h .= helpTooltip('dnsserverhelp', i("comma delimited list of IP addresses of DNS servers for public network"));
     $h .= helpTooltip('availnetshelp', i("This is a list of IP networks, one per line, available to nodes deployed by this management node. Networks should be specified in x.x.x.x/yy form.  It is for deploying servers having a fixed IP address to ensure a node is selected that can actually be on the specified network."));
     $h .= helpTooltip('federatedauthhelp', i("Comma delimited list of affiliations for which user passwords are not set for Linux image reservations under this management node. Each Linux image is then required to have federated authentication set up so that users' passwords are passed along to the federated authentication system when a user attempts to log in. (for clarity, not set setting user passwords does not mean users have an empty password, but that a federated system must authenticate the users)"));
     $h .= helpTooltip('natpubliciphelp', i("message"));
     $h .= helpTooltip('natinternaliphelp', i("message 2"));
     $h .= "</div>\n";
     # tooltips
     return $h;
 }
Ejemplo n.º 7
0
 function addEditDialogHTML($add = 0)
 {
     global $user, $days;
     # dialog for on page editing
     $h = '';
     $h .= "<div dojoType=dijit.Dialog\n";
     $h .= "      id=\"addeditdlg\"\n";
     $h .= "      title=\"Edit {$this->restypename}\"\n";
     $h .= "      duration=250\n";
     $h .= "      style=\"width: 70%;\"\n";
     $h .= "      draggable=true>\n";
     $h .= "<div id=\"addeditdlgcontent\">\n";
     # id
     $h .= "<input type=\"hidden\" id=\"editresid\">\n";
     $h .= "<div style=\"text-align: center;\">\n";
     # name
     $errmsg = i("Name cannot contain single (') or double (&quot;) quotes, less than (&lt;), or greater than (&gt;) and can be from 2 to 30 characters long");
     $h .= labeledFormItem('name', i('Name'), 'text', '^([A-Za-z0-9-!@#$%^&\\*\\(\\)_=\\+\\[\\]{}\\\\|:;,\\./\\?~` ]){2,30}$', 1, '', $errmsg, '', '', '200px');
     # owner
     $extra = array('onKeyPress' => 'setOwnerChecking');
     $h .= labeledFormItem('owner', i('Owner'), 'text', '', 1, "{$user['unityid']}@{$user['affiliation']}", i('Unknown user'), 'checkOwner', $extra, '200px');
     #$h .= labeledFormItem('owner', i('Owner'), 'text', '{$user['unityid']}@{$user['affiliation']}',
     #                      1, '', i('Unknown user'), 'checkOwner', 'onKeyPress', 'setOwnerChecking');
     $cont = addContinuationsEntry('AJvalidateUserid');
     $h .= "<input type=\"hidden\" id=\"valuseridcont\" value=\"{$cont}\">\n";
     # table of times
     $h .= "<br>";
     $h .= "<span style=\"text-align: center;\"><h3>Schedule Times</h3></span>\n";
     $h .= "The start and end day/times are based on a week's time period with ";
     $h .= "the start/end point being 'Sunday 12:00&nbsp;am'. i.e. The earliest ";
     $h .= "start day/time is 'Sunday 12:00&nbsp;am' and the latest end day/";
     $h .= "time is 'Sunday 12:00&nbsp;am'<br><br>\n";
     $h .= "Start:";
     $h .= selectInputAutoDijitHTML('startday', $days, 'startday');
     $h .= "<input type=\"text\" id=\"starttime\" dojoType=\"dijit.form.TimeTextBox\" ";
     $h .= "required=\"true\" value=\"T00:00:00\"/>\n";
     $h .= "End:";
     $h .= selectInputAutoDijitHTML('endday', $days, 'endday');
     $h .= "<input type=\"text\" id=\"endtime\" dojoType=\"dijit.form.TimeTextBox\" ";
     $h .= "required=\"true\" value=\"T00:00:00\" />\n";
     $h .= dijitButton('addTimeBtn', "Add", "addTime();");
     $h .= "</div>\n";
     # text-align: center
     $h .= "<div dojoType=\"dojo.data.ItemFileWriteStore\" jsId=\"scheduleStore\" ";
     $h .= "data=\"scheduleTimeData\"></div>\n";
     $h .= "<table dojoType=\"dojox.grid.DataGrid\" jsId=\"scheduleGrid\" sortInfo=1 ";
     $h .= "store=\"scheduleStore\" style=\"width: 520px; height: 165px;\">\n";
     $h .= "<thead>\n";
     $h .= "<tr>\n";
     $h .= "<th field=\"startday\" width=\"94px\" formatter=\"formatDay\">Start Day</th>\n";
     $h .= "<th field=\"startday\" width=\"94px\" formatter=\"formatTime\">Start Time</th>\n";
     $h .= "<th field=\"endday\" width=\"94px\" formatter=\"formatDay\">End Day</th>\n";
     $h .= "<th field=\"endday\" width=\"94px\" formatter=\"formatTime\">End Time</th>\n";
     $h .= "<th field=\"remove\" width=\"80px\">Remove</th>\n";
     $h .= "</tr>\n";
     $h .= "</thead>\n";
     $h .= "</table>\n";
     $h .= "</div>\n";
     # addeditdlgcontent
     $h .= "<div id=\"addeditdlgerrmsg\" class=\"nperrormsg\"></div>\n";
     $h .= "<div id=\"editdlgbtns\" align=\"center\">\n";
     $h .= dijitButton('addeditbtn', "Confirm", "saveResource();");
     $h .= dijitButton('', "Cancel", "addEditDlgHide();");
     $h .= "</div>\n";
     # editdlgbtns
     $h .= "</div>\n";
     # addeditdlg
     $h .= "<div dojoType=dijit.Dialog\n";
     $h .= "      id=\"groupingnote\"\n";
     $h .= "      title=\"Schedule Grouping\"\n";
     $h .= "      duration=250\n";
     $h .= "      draggable=true>\n";
     $h .= "Each schedule should be a member of a schedule<br>resource group. The following dialog will allow you<br>to add the new schedule to a group.<br><br>\n";
     $h .= "<div align=\"center\">\n";
     $h .= dijitButton('', "Close", "dijit.byId('groupingnote').hide();");
     $h .= "</div>\n";
     # btn div
     $h .= "</div>\n";
     # groupingnote
     $h .= "<div dojoType=dijit.Dialog\n";
     $h .= "      id=\"groupdlg\"\n";
     $h .= "      title=\"Schedule Grouping\"\n";
     $h .= "      duration=250\n";
     $h .= "      draggable=true>\n";
     $h .= "<div id=\"groupdlgcontent\"></div>\n";
     $h .= "<div align=\"center\">\n";
     $script = "    dijit.byId('groupdlg').hide();\n";
     $script .= "    checkFirstAdd();\n";
     $h .= dijitButton('', "Close", $script);
     $h .= "</div>\n";
     # btn div
     $h .= "</div>\n";
     # groupdlg
     return $h;
 }