Exemplo n.º 1
0
function newReservationConfigHTML()
{
    $h = '';
    $h = "<div dojoType=dijit.Dialog\n";
    $h .= "      id=\"newResConfigDlg\"\n";
    $h .= "      title=\"" . i("Configure System") . "\"\n";
    $h .= "      duration=250\n";
    $h .= "      draggable=true>\n";
    $cont = addContinuationsEntry('AJconfigSystem');
    $h .= "   <input type=\"hidden\" id=\"configcont\" value=\"{$cont}\">\n";
    $h .= "<div id=\"newResConfigDlgContent\">\n";
    # cluster tree
    $h .= "<div id=\"clusterdiv\" class=\"hidden\">\n";
    $h .= "<b>Cluster</b>:<br>\n";
    $h .= "(select an image to configure any associated configs)<br>\n";
    $h .= "<div dojoType=\"dijit.layout.ContentPane\" ";
    $h .= "style=\"height: 150px; overflow: auto;\">\n";
    # TODO edit CSS to set icons for tree nodes
    $h .= "<span id=\"treeparent\"></span>\n";
    $h .= "</div>\n";
    $h .= "<hr>\n";
    $h .= "</div>\n";
    # clusterdiv
    # configs
    $h .= "Add config for this reservation:<br>\n";
    $h .= resourceStore('config', 1, 'configdetailstore', 1);
    $h .= "<select dojoType=\"dijit.form.FilteringSelect\" id=\"addconfigsel\" ";
    $h .= "style=\"width: 200px\" searchAttr=\"name\" ";
    $h .= "query=\"{deleted: 0, cluster: 0}\" ";
    $h .= "highlightMatch=\"all\" autoComplete=\"false\" ";
    $h .= "queryExpr=\".*\${0}.*\" ";
    $h .= "store=\"configdetailstore\" ";
    $h .= "required=\"false\">\n";
    $h .= "</select>\n";
    $h .= "<button dojoType=\"dijit.form.Button\">\n";
    $h .= "  " . i("Add") . "\n";
    $h .= "  <script type=\"dojo/method\" event=\"onClick\">\n";
    $h .= "    addReservationConfig();\n";
    $h .= "  </script>\n";
    $h .= "</button><br>\n";
    $h .= "<table summary=\"\">\n";
    $h .= "<tr>\n";
    $h .= "<td>\n";
    # list of configs
    $h .= "Configs mapped to system:<br>\n";
    $h .= "<div id=\"systemconfigdiv\">\n";
    $h .= "<table dojoType=\"dojox.grid.DataGrid\" jsId=\"configlist\" ";
    $h .= "style=\"width: 150px; height: 125px;\" ";
    $h .= "selectionMode=\"single\" ";
    $h .= "onSelected=\"configSelected\" ";
    $h .= "sortInfo=\"1\">\n";
    $h .= "<thead>\n";
    $h .= "<tr>\n";
    $h .= "<th field=\"config\" width=\"150px\"></th>\n";
    $h .= "</tr>\n";
    $h .= "</thead>\n";
    $h .= "</table>\n";
    $h .= "</div>\n";
    $h .= "</td>\n";
    # end list of configs
    $h .= "<td>\n";
    # config variables
    $h .= i("Type:") . " <span id=\"configtype\"></span><br>\n";
    $h .= i("Apply this config:") . " <input type=\"checkbox\" id=\"configapplychk\" ";
    $h .= "disabled=\"true\" onClick=\"setApplyConfig();\"/><br>\n";
    $h .= "<div id=\"configdatadiv\" class=\"hidden\">\n";
    $h .= "<div id=\"viewconfigdatabtn\" dojoType=\"dijit.form.DropDownButton\" ";
    $h .= "onClick=\"showConfigData();\" disabled=\"true\">\n";
    $h .= "  <span>" . i("View Config Data") . "</span>\n";
    $h .= "  <div dojoType=\"dijit.TooltipDialog\" id=\"configdatadlg\" ";
    $h .= "style=\"width: 30em;\"></div>\n";
    $h .= "</div><br>\n";
    # variables
    $h .= "<div id=\"configvariablediv\">\n";
    $h .= i("Config variables:") . "<br>\n";
    # select
    $h .= "<select dojoType=\"dijit.form.Select\" id=\"configvariables\" ";
    $h .= "style=\"width: 150px\" queryExpr=\"*\${0}*\" ";
    $h .= "highlightMatch=\"all\" autoComplete=\"false\" ";
    $h .= "onChange=\"selectConfigVariable();\" disabled=\"true\"></select><br>\n";
    # key
    $h .= i("Key:") . " <span id=\"configkey\"></span><br>\n";
    $h .= i("Value:");
    # bool
    $h .= "<span id=\"configvalbool\" class=\"hidden\">\n";
    $h .= selectInputAutoDijitHTML('', array('true', 'false'), 'configvaluebool', 'onChange="saveSelectedConfigVar();"');
    $h .= "</span>\n";
    # int
    $h .= "<span id=\"configvalint\" class=\"hidden\"><input id=\"configvalueint\" ";
    $h .= "style=\"width: 70px;\" dojoType=\"dijit.form.NumberSpinner\" ";
    $h .= "intermediateChanges=\"true\" onChange=\"saveSelectedConfigVar();\" ";
    $h .= "constraints=\"{places:0}\">";
    $h .= "</span>\n";
    # float
    $h .= "<span id=\"configvalfloat\" class=\"hidden\"><input id=\"configvaluefloat\" ";
    $h .= "style=\"width: 70px;\" dojoType=\"dijit.form.NumberSpinner\" ";
    $h .= "intermediateChanges=\"true\" onChange=\"saveSelectedConfigVar();\">";
    $h .= "</span>\n";
    # string
    $h .= "<span id=\"configvalstring\" class=\"hidden\"><input type=\"text\" ";
    $h .= "id=\"configvaluestring\" style=\"width: 160px\" ";
    $h .= "dojoType=\"dijit.form.ValidationTextBox\" ";
    $h .= "invalidMessage=\"Value can only contain letters, numbers, ";
    # TODO determine constraints, if any
    $h .= "spaces, dashes(-), parenthesis, <br>slashes(/), and periods(.) and can be from 3 to 255 characters long\" ";
    $h .= "regExp=\"^([-a-zA-Z0-9\\. \\(\\)/]){3,255}\$\" onChange=\"saveSelectedConfigVar();\">";
    $h .= "</span>\n";
    # text
    $h .= "<span id=\"configvaltext\" class=\"hidden\">";
    $h .= "<div dojoType=\"dijit.form.Textarea\" ";
    $h .= "id=\"configvaluetext\" style=\"width: 240px\" ";
    # TODO determine constraints, if any
    $h .= "onKeyUp=\"saveSelectedConfigVar\"></div></span>\n";
    $h .= "<br>\n";
    $h .= i("Required:") . " <span id=\"configrequired\"></span><br>\n";
    $h .= "</div>\n";
    # configvariablediv
    $h .= "</div>\n";
    # configdatadiv
    $h .= "</td>\n";
    # end config variables
    $h .= "</tr>\n";
    $h .= "</table>\n";
    $h .= "</div>\n";
    $h .= "   <div align=\"center\">\n";
    $h .= "   <button dojoType=\"dijit.form.Button\">\n";
    $h .= "     " . i("Close") . "\n";
    $h .= "     <script type=\"dojo/method\" event=\"onClick\">\n";
    $h .= "       closeConfigureSystem();\n";
    $h .= "     </script>\n";
    $h .= "   </button>\n";
    $h .= "   </div>\n";
    $h .= "</div>\n";
    return $h;
}
Exemplo n.º 2
0
 function editConfigMap()
 {
     $h = '';
     $h = "<h2>Config Mapping</h2>\n";
     $cont = addContinuationsEntry('AJeditConfigMapping', $this->basecdata);
     $h .= "<input type=\"hidden\" id=\"editcfgmapcont\" value=\"{$cont}\">\n";
     $cdata = $this->basecdata;
     $cdata['add'] = 1;
     $cont = addContinuationsEntry('AJsaveConfigMapping', $cdata);
     $h .= "<input type=\"hidden\" id=\"addcfgmapcont\" value=\"{$cont}\">\n";
     $h .= "<input type=\"hidden\" id=\"savecfgmapcont\">\n";
     $cont = addContinuationsEntry('AJdeleteConfigMapping', $this->basecdata);
     $h .= "<input type=\"hidden\" id=\"deletecfgmapcont\" value=\"{$cont}\">\n";
     $h .= "<button dojoType=\"dijit.form.Button\">\n";
     $h .= "  Add New Config Mapping\n";
     $h .= "  <script type=\"dojo/method\" event=\"onClick\">\n";
     $h .= "    addConfigMapping();\n";
     $h .= "  </script>\n";
     $h .= "</button>\n";
     # filters
     $h .= "<div dojoType=\"dijit.TitlePane\" title=\"Filters (click to expand)\" ";
     $h .= "open=\"false\">\n";
     $h .= "<strong>Config Name</strong>:\n";
     $h .= "<div dojoType=\"dijit.form.TextBox\" id=\"confignamefilter\" length=\"80\">";
     $h .= "  <script type=\"dojo/connect\" event=\"onKeyUp\" args=\"event\">\n";
     $h .= "    if(event.keyCode == 13) configmapGridFilter();\n";
     $h .= "  </script>\n";
     $h .= "</div>\n";
     $h .= "<button dojoType=\"dijit.form.Button\">\n";
     $h .= "  Apply Name Filter\n";
     $h .= "  <script type=\"dojo/method\" event=\"onClick\">\n";
     $h .= "    configmapGridFilter();\n";
     $h .= "  </script>\n";
     $h .= "</button><br>\n";
     $h .= "<strong>Displayed Fields</strong>:<br>\n";
     $h .= "<input type=\"checkbox\" id=\"chkmtype\" checked onClick=\"toggleCmapFieldDisplay(this, 'configmaptype')\">";
     $h .= "<label for=\"chkmtype\">Map Type</label><br>\n";
     $h .= "<input type=\"checkbox\" id=\"chkname\" checked onClick=\"toggleCmapFieldDisplay(this, 'configname')\">";
     $h .= "<label for=\"chkname\">Config Name</label><br>\n";
     $h .= "<input type=\"checkbox\" id=\"chkctype\" checked onClick=\"toggleCmapFieldDisplay(this, 'configtype')\">";
     $h .= "<label for=\"chkctype\">Config Type</label><br>\n";
     $h .= "<input type=\"checkbox\" id=\"chkmto\" checked onClick=\"toggleCmapFieldDisplay(this, 'mapto')\">";
     $h .= "<label for=\"chkmto\">Map To</label><br>\n";
     $h .= "<input type=\"checkbox\" id=\"chkaffil\" onClick=\"toggleCmapFieldDisplay(this, 'affiliation')\">";
     $h .= "<label for=\"chkaffil\">Affiliation</label><br>\n";
     $h .= "<input type=\"checkbox\" id=\"chkdisabled\" onClick=\"toggleCmapFieldDisplay(this, 'disabled')\">";
     $h .= "<label for=\"chkdisabled\">Disabled</label><br>\n";
     $h .= "<input type=\"checkbox\" id=\"chkstage\" onClick=\"toggleCmapFieldDisplay(this, 'configstage')\">";
     $h .= "<label for=\"chkstage\">Stage</label><br>\n";
     /*$h .= "<strong>Owner</strong>:\n";
     		$h .= "<select dojoType=\"dijit.form.Select\" id=\"ownerfilter\" ";
     		$h .= "onChange=\"usergroupGridFilter();\" maxHeight=\"250\"></select><br>\n";
     		if($showusergrouptype) {
     			$h .= "<strong>Type</strong>:\n";
     			$h .= "<label for=\"shownormal\">Normal</label>\n";
     			$h .= "<input type=\"checkbox\" dojoType=\"dijit.form.CheckBox\" ";
     			$h .= "id=\"shownormal\" onChange=\"usergroupGridFilter();\" ";
     			$h .= "checked=\"checked\"> | \n";
     			$h .= "<label for=\"showfederated\">Federated</label>\n";
     			$h .= "<input type=\"checkbox\" dojoType=\"dijit.form.CheckBox\" ";
     			$h .= "id=\"showfederated\" onChange=\"usergroupGridFilter();\" ";
     			$h .= "checked=\"checked\"> | \n";
     			$h .= "<label for=\"showcourseroll\">Course Roll</label>\n";
     			$h .= "<input type=\"checkbox\" dojoType=\"dijit.form.CheckBox\" ";
     			$h .= "id=\"showcourseroll\" onChange=\"usergroupGridFilter();\" ";
     			$h .= "checked=\"checked\"><br>\n";
     		}
     		$h .= "<strong>Editable by</strong>:\n";
     		$h .= "<select dojoType=\"dijit.form.Select\" id=\"editgroupfilter\" ";
     		$h .= "onChange=\"usergroupGridFilter();\" maxHeight=\"250\"></select><br>\n";*/
     $h .= "</div>\n";
     $cont = addContinuationsEntry('jsonConfigMapStore', $this->basecdata);
     $h .= "<div dojoType=\"dojo.data.ItemFileWriteStore\" url=\"" . BASEURL;
     $h .= SCRIPT . "?continuation={$cont}\" jsid=\"configmapstore\"></div>\n";
     $h .= "<div id=\"gridcontainer\">\n";
     $h .= "<table dojoType=\"dojox.grid.DataGrid\" jsId=\"configmapgrid\" ";
     $h .= "sortInfo=3 store=\"configmapstore\" autoWidth=\"true\" style=\"";
     #$h .= "height: 580px;\" query=\"{type: new RegExp('normal|federated|courseroll')}\">\n";
     $h .= "height: 580px;\">\n";
     $h .= "<thead>\n";
     $h .= "<tr>\n";
     if (preg_match('/MSIE/i', $_SERVER['HTTP_USER_AGENT'])) {
         $w = array('64px', '38px', '70px', '170px', '80px', '120px', '100px', '59px', '85px');
     } else {
         $w = array('5em', '3em', '6em', '14em', '7em', '11em', '9em', '5em', '7.2em');
     }
     $h .= "<th field=\"id\" width=\"{$w[0]}\" formatter=\"fmtConfigMapDeleteBtn\">&nbsp;</th>\n";
     $h .= "<th field=\"id\" width=\"{$w[1]}\" formatter=\"fmtConfigMapEditBtn\">&nbsp;</th>\n";
     $h .= "<th field=\"configmaptype\" width=\"{$w[2]}\">Map Type</th>\n";
     $h .= "<th field=\"configname\" width=\"{$w[3]}\">Config Name</th>\n";
     $h .= "<th field=\"configtype\" width=\"{$w[4]}\">Config Type</th>\n";
     $h .= "<th field=\"mapto\" width=\"{$w[5]}\">Map To</th>\n";
     $h .= "<th field=\"affiliation\" width=\"{$w[6]}\" hidden=\"true\">Affiliation</th>\n";
     $h .= "<th field=\"disabled\" width=\"{$w[7]}\" hidden=\"true\">Disabled</th>\n";
     $h .= "<th field=\"configstage\" width=\"{$w[8]}\" hidden=\"true\">Stage</th>\n";
     $h .= "</tr>\n";
     $h .= "</thead>\n";
     $h .= "</table>\n";
     $h .= "</div>\n";
     # add/edit dialog
     $configs = $this->_getData();
     $maptypes = getConfigMapTypes(1);
     $h .= "<div dojoType=dijit.Dialog\n";
     $h .= "      id=\"addeditcfgmapdlg\"\n";
     $h .= "      title=\"Add Config Mapping\"\n";
     $h .= "      duration=250\n";
     $h .= "      draggable=true>\n";
     $h .= "<div id=\"addeditcfgmapdlgcontent\">\n";
     $h .= "<input type=\"hidden\" id=\"editcfgmapid\" />\n";
     # config
     $cont = addContinuationsEntry('jsonResourceStore', $this->basecdata);
     $h .= "<div dojoType=\"dojo.data.ItemFileReadStore\" url=\"" . BASEURL;
     $h .= SCRIPT . "?continuation={$cont}\" jsid=\"mapconfigliststore\"></div>\n";
     $h .= "<label for=\"config\">Config:</label>\n";
     # TODO may want to present configs with config types
     if (USEFILTERINGSELECT && count($configs) < FILTERINGSELECTTHRESHOLD) {
         $dtype = 'dijit.form.FilteringSelect';
     } else {
         $dtype = 'dijit.form.Select';
     }
     $h .= "<select id=\"config\" dojoType=\"{$dtype}\" ";
     $h .= "onChange=\"configMapSetConfig();\" store=\"mapconfigliststore\" ";
     $h .= "fetchProperties=\"{sort: [{attribute: 'name'}]}\" ";
     # TODO ignore case
     $h .= "query=\"{deleted: '0'}\" queryExpr=\"*\${0}*\">\n";
     $h .= "</select>\n";
     $h .= "<br>\n";
     # type
     $h .= "Type: <span id=\"mapconfigtype\"></span><br><br>\n";
     # maps to
     $h .= "<strong><big>Maps to:</big></strong><br>\n";
     # map type
     $h .= "<script>\n";
     $h .= "var maptypedata = {identifier: 'id', label: 'name', items: [\n";
     $types = array();
     foreach ($maptypes as $id => $name) {
         $t = "  {id: '{$id}', name: '{$name}', ";
         if ($name == 'Image' || $name == 'Subimage') {
             $t .= "clusterok: '1'}";
         } else {
             $t .= "clusterok: '0'}";
         }
         $types[] = $t;
     }
     $h .= implode(",\n", $types);
     $h .= "\n]}\n";
     $h .= "</script>\n";
     $h .= "<div dojoType=\"dojo.data.ItemFileReadStore\" data=\"maptypedata\" ";
     $h .= "jsid=\"maptypestore\"></div>\n";
     $h .= "<br>Map type: ";
     $h .= "<select id=\"maptype\" dojoType=\"dijit.form.Select\" store=\"maptypestore\" ";
     $h .= "onChange=\"editConfigMapSetMapType();\" query=\"{id: '*'}\"></select>\n";
     # image
     $h .= "<div id=\"imagetypediv\" class=\"hidden\">\n";
     $tmp = getUserResources(array("imageAdmin"), array("administer"));
     # TODO is this the criteria we want for which images can be selected?
     $images = $tmp['image'];
     $h .= "<label for=\"image\">Image:</label>\n";
     $h .= selectInputAutoDijitHTML('', $images, 'image');
     $h .= "</div>\n";
     # imagetypediv
     # os type
     $ostypes = getOStypes();
     $h .= "<div id=\"ostypediv\" class=\"hidden\">\n";
     $h .= "<label for=\"ostype\">OS Type:</label>\n";
     $h .= selectInputAutoDijitHTML('', $ostypes, 'ostype');
     $h .= "</div>\n";
     # ostypediv
     # os
     $oses = getOSList();
     $h .= "<div id=\"osdiv\" class=\"hidden\">\n";
     $h .= "<label for=\"os\">OS:</label>\n";
     $h .= selectInputAutoDijitHTML('', $oses, 'os');
     $h .= "</div>\n";
     # osdiv
     # config
     $tmp = getUserResources(array("configAdmin"), array("administer"));
     # TODO is this the criteria we want for which configs can be selected?
     $configs = $this->getUserConfigsNoCluster($tmp['config']);
     $h .= "<div id=\"configdiv\" class=\"hidden\">\n";
     $h .= "<label for=\"mapconfig\">Config:</label>\n";
     $h .= selectInputAutoDijitHTML('', $configs, 'mapconfig');
     $h .= "</div>\n";
     # configdiv
     # configsubimage
     $configsubimages = getConfigSubimages($tmp['config']);
     $h .= "<div id=\"configsubimagediv\" class=\"hidden\">\n";
     $h .= "<label for=\"configsubimage\">Cluster:</label>\n";
     $h .= selectInputAutoDijitHTML('', $configsubimages, 'configsubimage');
     $h .= "</div>\n";
     # configsubimagediv
     # managementnode
     $managementnodes = getManagementNodes();
     $h .= "<div id=\"managementnodediv\" class=\"hidden\">\n";
     $h .= "<label for=\"managementnode\">Management Node:</label>\n";
     $h .= selectInputAutoDijitHTML('', $managementnodes, 'managementnode');
     $h .= "</div>\n";
     # managementnodediv
     $h .= "<br><strong><big>Additional options:</big></strong><br>\n";
     # affiliation
     $affils = getAffiliations();
     $h .= "<br><label for=\"affil\">Affiliation:</label>\n";
     $h .= selectInputAutoDijitHTML('', $affils, 'affil');
     # stage
     $stages = $this->getConfigMapStages();
     $h .= "<div id=\"stagediv\" class=\"hidden\">\n";
     $h .= "<label for=\"stage\">Stage:</label>\n";
     $h .= selectInputAutoDijitHTML('', $stages, 'stage');
     $h .= "</div>\n";
     # stagediv
     $h .= "</div>\n";
     # addeditcfgmapdlgcontent
     $h .= "<div id=\"addeditcfgmapdlgerrmsg\" class=\"nperrormsg\"></div>\n";
     $h .= "<div id=\"editdlgbtns\" align=\"center\">\n";
     $h .= "<button dojoType=\"dijit.form.Button\" id=\"addeditcfgmapbtn\">\n";
     $h .= "  Confirm\n";
     $h .= "  <script type=\"dojo/method\" event=\"onClick\">\n";
     $h .= "    saveConfigMapping();\n";
     $h .= "  </script>\n";
     $h .= "</button>\n";
     $h .= "<button dojoType=\"dijit.form.Button\">\n";
     $h .= "  Cancel\n";
     $h .= "  <script type=\"dojo/method\" event=\"onClick\">\n";
     $h .= "    dijit.byId('addeditcfgmapdlg').hide();\n";
     $h .= "    resetConfigMappingFields();\n";
     $h .= "  </script>\n";
     $h .= "</button>\n";
     $h .= "</div>\n";
     # editdlgbtns
     $h .= "</div>\n";
     # delete dialog
     $h .= "<div dojoType=dijit.Dialog\n";
     $h .= "      id=\"delcfgmapdlg\"\n";
     $h .= "      title=\"Delete Config Mapping\"\n";
     $h .= "      duration=250\n";
     $h .= "      draggable=true>\n";
     $h .= "<div id=\"delcfgmapdlgcontent\"></div><br>\n";
     $h .= "<input type=\"hidden\" id=\"submitdeletecfgmapcont\">\n";
     $h .= "<div id=\"delcfgmapdlgerrmsg\" class=\"nperrormsg\"></div>\n";
     $h .= "<div id=\"delcfgmapdlgbtns\" align=\"center\">\n";
     $h .= "<button dojoType=\"dijit.form.Button\" id=\"delcfgmapbtn\">\n";
     $h .= "  Delete Mapping\n";
     $h .= "  <script type=\"dojo/method\" event=\"onClick\">\n";
     $h .= "    submitDeleteConfigMapping();\n";
     $h .= "  </script>\n";
     $h .= "</button>\n";
     $h .= "<button dojoType=\"dijit.form.Button\">\n";
     $h .= "  Cancel\n";
     $h .= "  <script type=\"dojo/method\" event=\"onClick\">\n";
     $h .= "    dijit.byId('delcfgmapdlg').hide();\n";
     $h .= "    dojo.byId('delcfgmapdlgcontent').innerHTML = '';\n";
     $h .= "    dojo.byId('delcfgmapdlgerrmsg').innerHTML = '';\n";
     $h .= "  </script>\n";
     $h .= "</button>\n";
     $h .= "</div>\n";
     # delcfgmapdlgbtns
     $h .= "</div>\n";
     print $h;
 }
Exemplo n.º 3
0
function labeledFormItem($id, $label, $type, $constraints = '', $required = 1, $value = '', $errmsg = '', $validator = '', $extra = array(), $width = '', $help = '', $addbr = 1)
{
    if ($extra == '') {
        $extra = array();
    }
    $h = '';
    if ($required) {
        $required = 'true';
    } else {
        $required = 'false';
    }
    switch ($type) {
        case 'text':
            if ($width == '') {
                $width = '300px';
            }
            $h .= "<label for=\"{$id}\">{$label}:</label>\n";
            $h .= "<span class=\"labeledform\">\n";
            $h .= "<input type=\"text\" ";
            $h .= "dojoType=\"dijit.form.ValidationTextBox\" ";
            $h .= "required=\"{$required}\" ";
            if ($constraints != '') {
                $h .= "regExp=\"{$constraints}\" ";
            }
            if ($errmsg != '') {
                $h .= "invalidMessage=\"{$errmsg}\" ";
            }
            $h .= "style=\"width: {$width}\" ";
            if ($validator != '') {
                $h .= "validator=\"{$validator}\" ";
            }
            if ($value != '') {
                $h .= "value=\"{$value}\" ";
            }
            foreach ($extra as $key => $val) {
                $h .= "{$key}=\"{$val}\" ";
            }
            $h .= "id=\"{$id}\">";
            if ($help != '') {
                $h .= $help;
            }
            $h .= "</span>";
            if ($addbr) {
                $h .= "<br>";
            }
            $h .= "\n";
            break;
        case 'textarea':
            if ($width == '') {
                $width = '300px';
            }
            $h .= "<label for=\"{$id}\">{$label}:</label>\n";
            $h .= "<span class=\"labeledform\">\n";
            $h .= "<textarea ";
            $h .= "dojoType=\"dijit.form.Textarea\" ";
            $h .= "style=\"width: {$width}; text-align: left;\" ";
            foreach ($extra as $key => $val) {
                $h .= "{$key}=\"{$val}\" ";
            }
            $h .= "id=\"{$id}\">";
            $h .= $value;
            $h .= "</textarea>\n";
            if ($help != '') {
                $h .= $help;
            }
            $h .= "</span>";
            if ($addbr) {
                $h .= "<br>";
            }
            $h .= "\n";
            break;
        case 'spinner':
            if ($width == '') {
                $width = '70px';
            }
            $h .= "<label for=\"{$id}\">{$label}:</label>\n";
            $h .= "<span class=\"labeledform\">\n";
            $h .= "<input dojoType=\"dijit.form.NumberSpinner\" ";
            $h .= "required=\"{$required}\" ";
            $h .= "style=\"width: {$width}\" ";
            if ($value !== '') {
                $h .= "value=\"{$value}\" ";
            }
            if ($constraints != '') {
                $h .= "constraints=\"{$constraints}\" ";
            }
            foreach ($extra as $key => $val) {
                $h .= "{$key}=\"{$val}\" ";
            }
            $h .= "id=\"{$id}\">";
            if ($help != '') {
                $h .= $help;
            }
            $h .= "</span>";
            if ($addbr) {
                $h .= "<br>";
            }
            $h .= "\n";
            break;
        case 'select':
        case 'selectonly':
            if ($value == '') {
                $value = -1;
            }
            $h .= "<label for=\"{$id}\">{$label}:</label>\n";
            $h .= "<span class=\"labeledform\">\n";
            $flat = '';
            foreach ($extra as $key => $val) {
                $flat .= "{$key}=\"{$val}\" ";
            }
            if ($type == 'selectonly') {
                $h .= selectInputHTML('', $constraints, $id, "dojoType=\"dijit.form.Select\" maxHeight=\"250\" {$flat}", $value);
            } else {
                $h .= selectInputAutoDijitHTML('', $constraints, $id, $flat, $value);
            }
            if ($help != '') {
                $h .= $help;
            }
            $h .= "</span>";
            if ($addbr) {
                $h .= "<br>";
            }
            $h .= "\n";
            break;
        case 'check':
            $h .= "<label for=\"{$id}\">{$label}:</label>\n";
            $h .= "<span class=\"labeledform\">\n";
            $h .= "<input dojoType=\"dijit.form.CheckBox\" ";
            if ($value !== '') {
                $h .= "value=\"{$value}\" ";
            }
            foreach ($extra as $key => $val) {
                $h .= "{$key}=\"{$val}\" ";
            }
            $h .= "id=\"{$id}\">";
            if ($help != '') {
                $h .= $help;
            }
            $h .= "</span>";
            if ($addbr) {
                $h .= "<br>";
            }
            $h .= "\n";
            break;
    }
    return $h;
}
Exemplo n.º 4
0
 function AJcompStateChange()
 {
     $newstateid = processInputVar('stateid', ARG_NUMERIC);
     $states = getContinuationVar('states');
     if (!array_key_exists($newstateid, $states)) {
         $ret = array('status' => 'noaction');
         sendJSON($ret);
         return;
     }
     $cdata = $this->basecdata;
     $cdata['newstateid'] = $newstateid;
     $tmp = getUserResources(array($this->restype . "Admin"), array("administer"), 0, 1);
     $computers = $tmp['computer'];
     $msg = '';
     $complist = '';
     $compids = $this->validateCompIDs();
     if ($newstateid == 2) {
         $msg .= "You are about to place the following computers into the ";
         $msg .= "available state:<br><br>\n";
         foreach ($compids as $compid) {
             $complist .= $computers[$compid] . "<br>\n";
         }
         $complist .= "<br>\n";
         $cdata['compids'] = $compids;
     } elseif ($newstateid == 10) {
         $msg .= "Please enter a reason you are changing the following computers to ";
         $msg .= "the maintenance state:<br><br>\n";
         $msg .= "<textarea ";
         $msg .= "dojoType=\"dijit.form.Textarea\" ";
         $msg .= "style=\"width: 30em; text-align: left;\" ";
         $msg .= "_destroyOnRemove=\"true\" ";
         $msg .= "id=\"utilnotes\">";
         $msg .= "</textarea><br><br>\n";
         $msg .= "These computers will be placed into the maintenance state:<br><br>\n";
         foreach ($compids as $compid) {
             $complist .= $computers[$compid] . "<br>\n";
         }
         $complist .= "<br>\n";
         $cdata['compids'] = $compids;
     } elseif ($newstateid == 20) {
         $profiles = getVMProfiles();
         $cdata['profiles'] = $profiles;
         $msg .= "Select a VM Host Profile to use on the selected computers:";
         $msg .= "<br><br>\n";
         $msg .= selectInputAutoDijitHTML('', $profiles, 'profileid');
         $msg .= "<br><br>\n";
         $msg .= "These computers will be deployed as VM Hosts:<br><br>\n";
         foreach ($compids as $compid) {
             $complist .= $computers[$compid] . "<br>\n";
         }
         $complist .= "<br>\n";
         $cdata['compids'] = $compids;
     } elseif ($newstateid == 23) {
         $msg .= "These computers will be placed into the hpc state:<br><br>\n";
         foreach ($compids as $compid) {
             $complist .= $computers[$compid] . "<br>\n";
         }
         $complist .= "<br>\n";
         $cdata['compids'] = $compids;
     }
     $cont = addContinuationsEntry('AJsubmitCompStateChange', $cdata, SECINDAY, 1, 0);
     $ret = array('status' => 'success', 'title' => "State Change", 'btntxt' => 'Submit State Change', 'cont' => $cont, 'actionmsg' => $msg, 'complist' => $complist);
     sendJSON($ret);
 }
Exemplo n.º 5
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;
 }