This is an automated email from the ASF dual-hosted git repository.

jfthomps pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/vcl.git


The following commit(s) were added to refs/heads/develop by this push:
     new b65605a2 VCL-1143 - Block Allocation delete and view times dialog not 
always present
b65605a2 is described below

commit b65605a2f8e5b82d69b7040a0fff907b966eabe8
Author: Josh Thompson <[email protected]>
AuthorDate: Wed Feb 21 12:41:07 2024 -0500

    VCL-1143 - Block Allocation delete and view times dialog not always present
    
    blockallocations.php: modified getCurrentBlockHTML: changed code not to 
return early if no block allocations so it will still return dialogs for delete 
and view times
---
 web/.ht-inc/blockallocations.php | 112 ++++++++++++++++++++-------------------
 1 file changed, 57 insertions(+), 55 deletions(-)

diff --git a/web/.ht-inc/blockallocations.php b/web/.ht-inc/blockallocations.php
index 51e58bbb..8e7b3ca5 100644
--- a/web/.ht-inc/blockallocations.php
+++ b/web/.ht-inc/blockallocations.php
@@ -49,7 +49,7 @@ function blockAllocations() {
                print "<h2>" . i("Manage Block Allocations") . "</h2>\n";
                $cont = addContinuationsEntry('viewBlockAllocatedMachines');
                print "<a href=\"" . BASEURL . SCRIPT . 
"?continuation=$cont\">";
-               print i("View Block Allocated Machines") . "</a>\n";
+               print i("View Block Allocated Machines") . "</a><br><br>\n";
                print "<div id=\"blocklist\">\n";
                print getCurrentBlockHTML();
                print "</div>\n";
@@ -1180,6 +1180,7 @@ function getCurrentBlockHTML($listonly=0) {
        $query .=      "b.status = 'accepted' "
               . "ORDER BY b.name";
        $allblockids = array();
+       $blocks = array();
        $qh = doQuery($query, 101);
        while($row = mysqli_fetch_assoc($qh)) {
                if($row['group'] == '') {
@@ -1218,9 +1219,6 @@ function getCurrentBlockHTML($listonly=0) {
                        $blocks[$row['id']]['nextstartactive'] = 0;
                }
        }
-       if(empty($blocks)) {
-               return "There are currently no block allocations.<br>\n";
-       }
        foreach($blocks as $id => $request) {
                if($request['available'] == 'weekly') {
                        $query = "SELECT DATE_FORMAT(start, '%m/%d/%Y') AS 
swdate, "
@@ -1325,60 +1323,64 @@ function getCurrentBlockHTML($listonly=0) {
        }
        $rt = '';
        $rt .= "<input type=\"hidden\" id=\"timezone\" value=\"" . date('T') . 
"\">\n";
-       $rt .= "<table summary=\"lists current block allocations\">\n";
-       $rt .= "  <TR align=center>\n";
-       $rt .= "    <TD colspan=3></TD>\n";
-       $rt .= "    <TH>" . i("Name") . "</TH>\n";
-       $rt .= "    <TH>" . i("Environment") . "</TH>\n";
-       $rt .= "    <TH>" . i("Reserved<br>Machines") . "</TH>\n";
-       $rt .= "    <TH>" . i("Reserved<br>For") . "</TH>\n";
-       $rt .= "    <TH>" . i("Repeating") . "</TH>\n";
-       $rt .= "    <TH>" . i("Next Start Time") . "</TH>\n";
-       $rt .= "  </TR>\n";
-       foreach($blocks as $block) {
+       if(empty($blocks))
+               $rt .= "There are currently no block allocations.\n";
+       else {
+               $rt .= "<table summary=\"lists current block allocations\">\n";
                $rt .= "  <TR align=center>\n";
-               $rt .= "    <TD>\n";
-               $rt .= "      <button dojoType=\"dijit.form.Button\" 
type=\"button\">\n";
-               $rt .= i(      "Edit") . "\n";
-               $rt .= "        <script type=\"dojo/method\" 
event=\"onClick\">\n";
-               $cont = addContinuationsEntry('editBlockAllocation', 
array('blockid' => $block['id']));
-               $rt .= "          location.href = '" . BASEURL . SCRIPT . 
"?continuation=$cont';\n";
-               $rt .= "        </script>\n";
-               $rt .= "      </button>\n";
-               $rt .= "    </TD>\n";
-               $rt .= "    <TD>\n";
-               $rt .= "      <button dojoType=\"dijit.form.Button\" 
type=\"button\">\n";
-               $rt .= i(      "Delete") . "\n";
-               $rt .= "        <script type=\"dojo/method\" 
event=\"onClick\">\n";
-               $cont = addContinuationsEntry('AJdeleteBlockAllocationConfirm', 
$block, SECINDAY);
-               $rt .= "          deleteBlockConfirm('$cont');\n";
-               $rt .= "        </script>\n";
-               $rt .= "      </button>\n";
-               $rt .= "    </TD>\n";
-               $rt .= "    <TD>\n";
-               $rt .= "      <button dojoType=\"dijit.form.Button\" 
type=\"button\">\n";
-               $rt .= i(      "View Times") . "\n";
-               $rt .= "        <script type=\"dojo/method\" 
event=\"onClick\">\n";
-               $cont = addContinuationsEntry('AJviewBlockAllocationTimes', 
array('blockid' => $block['id']), SECINDAY);
-               $rt .= "          viewBlockTimes('$cont');\n";
-               $rt .= "        </script>\n";
-               $rt .= "      </button>\n";
-               $rt .= "    </TD>\n";
-               $rt .= "    <TD>{$block['blockname']}</TD>\n";
-               $rt .= "    <TD>{$block['image']}</TD>\n";
-               $rt .= "    <TD><a href=\"javascript:void(0)\" 
onclick=\"viewBlockUsage({$block['id']});\">{$block['machinecnt']}</a></TD>\n";
-               $rt .= "    <TD>{$block['group']}</TD>\n";
-               $rt .= "    <TD>" . i($block['available']) . "</TD>\n";
-               if($block['nextstartactive']) {
-                       $cont = addContinuationsEntry('viewBlockStatus', 
array('id' => $block['id']));
-                       $rt .= "    <TD><a href=\"" . BASEURL . SCRIPT . 
"?continuation=$cont\">";
-                       $rt .= "{$block['nextstart']}</a></TD>\n";
-               }
-               else
-                       $rt .= "    <TD>{$block['nextstart']}</TD>\n";
+               $rt .= "    <TD colspan=3></TD>\n";
+               $rt .= "    <TH>" . i("Name") . "</TH>\n";
+               $rt .= "    <TH>" . i("Environment") . "</TH>\n";
+               $rt .= "    <TH>" . i("Reserved<br>Machines") . "</TH>\n";
+               $rt .= "    <TH>" . i("Reserved<br>For") . "</TH>\n";
+               $rt .= "    <TH>" . i("Repeating") . "</TH>\n";
+               $rt .= "    <TH>" . i("Next Start Time") . "</TH>\n";
                $rt .= "  </TR>\n";
+               foreach($blocks as $block) {
+                       $rt .= "  <TR align=center>\n";
+                       $rt .= "    <TD>\n";
+                       $rt .= "      <button dojoType=\"dijit.form.Button\" 
type=\"button\">\n";
+                       $rt .= i(      "Edit") . "\n";
+                       $rt .= "        <script type=\"dojo/method\" 
event=\"onClick\">\n";
+                       $cont = addContinuationsEntry('editBlockAllocation', 
array('blockid' => $block['id']));
+                       $rt .= "          location.href = '" . BASEURL . SCRIPT 
. "?continuation=$cont';\n";
+                       $rt .= "        </script>\n";
+                       $rt .= "      </button>\n";
+                       $rt .= "    </TD>\n";
+                       $rt .= "    <TD>\n";
+                       $rt .= "      <button dojoType=\"dijit.form.Button\" 
type=\"button\">\n";
+                       $rt .= i(      "Delete") . "\n";
+                       $rt .= "        <script type=\"dojo/method\" 
event=\"onClick\">\n";
+                       $cont = 
addContinuationsEntry('AJdeleteBlockAllocationConfirm', $block, SECINDAY);
+                       $rt .= "          deleteBlockConfirm('$cont');\n";
+                       $rt .= "        </script>\n";
+                       $rt .= "      </button>\n";
+                       $rt .= "    </TD>\n";
+                       $rt .= "    <TD>\n";
+                       $rt .= "      <button dojoType=\"dijit.form.Button\" 
type=\"button\">\n";
+                       $rt .= i(      "View Times") . "\n";
+                       $rt .= "        <script type=\"dojo/method\" 
event=\"onClick\">\n";
+                       $cont = 
addContinuationsEntry('AJviewBlockAllocationTimes', array('blockid' => 
$block['id']), SECINDAY);
+                       $rt .= "          viewBlockTimes('$cont');\n";
+                       $rt .= "        </script>\n";
+                       $rt .= "      </button>\n";
+                       $rt .= "    </TD>\n";
+                       $rt .= "    <TD>{$block['blockname']}</TD>\n";
+                       $rt .= "    <TD>{$block['image']}</TD>\n";
+                       $rt .= "    <TD><a href=\"javascript:void(0)\" 
onclick=\"viewBlockUsage({$block['id']});\">{$block['machinecnt']}</a></TD>\n";
+                       $rt .= "    <TD>{$block['group']}</TD>\n";
+                       $rt .= "    <TD>" . i($block['available']) . "</TD>\n";
+                       if($block['nextstartactive']) {
+                               $cont = 
addContinuationsEntry('viewBlockStatus', array('id' => $block['id']));
+                               $rt .= "    <TD><a href=\"" . BASEURL . SCRIPT 
. "?continuation=$cont\">";
+                               $rt .= "{$block['nextstart']}</a></TD>\n";
+                       }
+                       else
+                               $rt .= "    <TD>{$block['nextstart']}</TD>\n";
+                       $rt .= "  </TR>\n";
+               }
+               $rt .= "</table>\n";
        }
-       $rt .= "</table>\n";
        if($listonly)
                return $rt;
 

Reply via email to