<?php // BEGIN the tabContent class // this makes a fixed height box with scrolling for overflow echo "<div class='tabContent'>"; // BEGIN add resources tab echo "<div id='addresources'>"; //print "<h2>Manage Resource Specifications (RSpecs)</h2>\n"; //print "<p><button onClick=\"window.location='rspecs.php'\">" // . "View Available RSpecs</button> \n"; //print "<button onClick=\"window.location='rspecupload.php'\">" // . "Upload New RSpec</button></p>\n"; print "<h2>Add Resources</h2>\n"; print "<p>To add resources you need to draw or choose a Resource Specification (RSpec).</p>"; $slice_ams = array(); $all_rspecs = fetchRSpecMetaData($user); // JACKS-APP STUFF // include "jacks-editor-app.php"; setup_jacks_editor_slice_context(); $AM_STATUS_LOCATION = "/etc/geni-ch/am-status.json"; $am_status = array("fake_urn" => "fake_status"); if (file_exists($AM_STATUS_LOCATION)) { $am_status = json_decode(file_get_contents($AM_STATUS_LOCATION)); } ?> <link rel="stylesheet" type="text/css" href="jacks-editor-app.css" /> <link rel="stylesheet" type="text/css" href="slice-add-resources-jacks.css" /> <script src="<?php echo $jacks_stable_url; ?>
function show_rspec_chooser($user) { $all_rmd = fetchRSpecMetaData($user); usort($all_rmd, "cmp2"); print "<select name=\"rspec_id\" id=\"rspec_select\"" . " onchange=\"rspec_onchange()\"" . ">\n"; echo '<option value="" title="Choose RSpec" selected="selected" bound="0" stitch="0">Choose RSpec...</option>'; echo '<option value="PRIVATE" disabled>---Private RSpecs---</option>'; foreach ($all_rmd as $rmd) { if ($rmd['visibility'] === "private") { $rid = $rmd['id']; $rname = $rmd['name']; $rdesc = $rmd['description']; // error_log("BOUND = " . $rmd['bound']); $bound = 0; $stitch = 0; if ($rmd['bound'] == 't') { $bound = 1; } if ($rmd['stitch'] == 't') { $stitch = 1; } // error_log("BOUND = " . $enable_agg_chooser); print "<option value='{$rid}' title='{$rdesc}' bound='{$bound}' stitch='{$stitch}'>{$rname}</option>\n"; } } echo '<option value="PUBLIC" disabled>---Public RSpecs---</option>'; foreach ($all_rmd as $rmd) { if ($rmd['visibility'] === "public") { $rid = $rmd['id']; $rname = $rmd['name']; $rdesc = $rmd['description']; // error_log("BOUND = " . $rmd['bound']); $bound = 0; $stitch = 0; if ($rmd['bound'] == 't') { $bound = 1; } if ($rmd['stitch'] == 't') { $stitch = 1; } // error_log("BOUND = " . $enable_agg_chooser); print "<option value='{$rid}' title='{$rdesc}' bound='{$bound}' stitch='{$stitch}'>{$rname}</option>\n"; } } // print "<option value=\"paste\" title=\"Paste your own RSpec\">Paste</option>\n"; // print "<option value=\"upload\" title=\"Upload an RSpec\">Upload</option>\n"; print "</select>\n"; // print "<br>or <a href=\"rspecupload.php\">upload your own RSpec to the above list</a>."; // print " or <button onClick=\"window.location='rspecupload.php'\">"; // print "upload your own RSpec</button>."; // RSpec entry area print '<span id="paste_rspec" style="display:none;vertical-align:top;">' . PHP_EOL; print '<label for="paste_rspec2">Resource Specification (RSpec):</label>' . PHP_EOL; print "<textarea id=\"paste_rspec2\" name=\"rspec\" rows=\"10\" cols=\"40\"" . "></textarea>\n"; print '</span>' . PHP_EOL; // RSpec upload print '<span id="upload_rspec" style="display:none;">' . PHP_EOL; print '<label for="rspec_file">Resource Specification (RSpec) File:</label>' . PHP_EOL; print '<input type="file" name="rspec_file" id="rspec_file" />' . PHP_EOL; print '</span>' . PHP_EOL; //print "</p>"; }