Skip to content

Commit 6aa983a

Browse files
author
mreishman
committed
logic changesfor array key gen for watchlist, also changed archive to dropdown
1 parent 7fd135a commit 6aa983a

File tree

8 files changed

+85
-100
lines changed

8 files changed

+85
-100
lines changed

core/html/changelog.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
<li>
1717
Fixed issue with errors not displaying correctly when poll fails.
1818
</li>
19+
<li>
20+
Changed archive to dropdown from button
21+
</li>
1922
</ul>
2023
</li>
2124
</ul>

core/js/watchlist.js

Lines changed: 32 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,5 @@
11
var urlForCurl = "./core/php/functions/sendCurl.php";
22

3-
function toggleArchive(currnetRow)
4-
{
5-
var archiveButton = document.getElementById("archiveButton"+currnetRow);
6-
if(archiveButton.innerHTML === "Archive")
7-
{
8-
//unarchive action (change to 1)
9-
document.getElementById("archiveInput"+currnetRow).value = "true";
10-
archiveButton.innerHTML = "Un-Archive";
11-
}
12-
else
13-
{
14-
//archive action (change to 0)
15-
document.getElementById("archiveInput"+currnetRow).value = "false";
16-
archiveButton.innerHTML = "Archive";
17-
}
18-
}
19-
203
function addRowFunction()
214
{
225
countOfWatchList++;
@@ -44,8 +27,10 @@ function addRowFunction()
4427
else if(arrayOfKeysNonEnc[i] === "Archive")
4528
{
4629
documentUpdateText += " <br> <span class='leftSpacingserverNames' > "+arrayOfKeysNonEnc[i]+": </span>";
47-
documentUpdateText += " <a id=\"archiveButton"+countOfWatchList+"\" onclick=\"toggleArchive("+countOfWatchList+");\" class=\"mainLinkClass\" >Archive</a>";
48-
documentUpdateText += "<input id=\"archiveInput"+countOfWatchList+"\" class='inputWidth300' type='hidden' name='watchListItem"+countOfWatchList+"-"+(i+1)+"' value='false'>";
30+
documentUpdateText += " <select class='inputWidth300' name='watchListItem" + countOfWatchList + "-" + (i+1) + "' >";
31+
documentUpdateText += " <option value=\"true\" >True</option>";
32+
documentUpdateText += " <option value=\"false\" selected >False</option>";
33+
documentUpdateText += " </select>";
4934
}
5035
else
5136
{
@@ -72,26 +57,7 @@ function deleteRowFunction(currentRow, decreaseCountWatchListNum)
7257
if(currentRow < newValue)
7358
{
7459
//this wasn't the last folder deleted, update others
75-
for(var i = currentRow + 1; i <= newValue; i++)
76-
{
77-
var updateItoIMinusOne = i - 1;
78-
var elementToUpdate = "rowNumber" + i;
79-
var documentUpdateText = "<li class='watchFolderGroups' id='rowNumber"+updateItoIMinusOne+"' ><span class='leftSpacingserverNames' > Name: </span> ";
80-
var watchListKeyIdFind = "watchListKey"+i;
81-
var previousElementNumIdentifierForKey = document.getElementsByName(watchListKeyIdFind);
82-
83-
documentUpdateText += "<input class='inputWidth300' type='text' name='watchListKey"+updateItoIMinusOne+"' value='"+previousElementNumIdentifierForKey[0].value+"'> ";
84-
for(var j = 0; j < numberOfSubRows; j++)
85-
{
86-
var watchListItemIdFind = "watchListItem"+i+"-"+(j+1);
87-
var previousElementNumIdentifierForItem = document.getElementsByName(watchListItemIdFind);
88-
documentUpdateText += "<br> <span class='leftSpacingserverNames' > "+arrayOfKeysNonEnc[j]+": </span> <input style='display: none;' type='text' name='watchListItem"+updateItoIMinusOne+"-"+(j+1)+"-Name' value="+arrayOfKeysNonEnc[j]+"> <input class='inputWidth300' type='text' name='watchListItem"+updateItoIMinusOne+"-"+(j+1)+"' value='"+previousElementNumIdentifierForItem[0].value+"'>";
89-
}
90-
documentUpdateText += '<br> <input style="display: none" type="text" name="watchListItem'+updateItoIMinusOne+'-0" value="'+numberOfSubRows+'"> ';
91-
documentUpdateText += '<span class="leftSpacingserverNames" ></span> <a class="mainLinkClass" onclick="deleteRowFunction('+updateItoIMinusOne+', true)">Remove</a><span> | </span><a class="mainLinkClass" onclick="testConnection(dataForWatchFolder'+updateItoIMinusOne+');" >Check Connection</a>';
92-
documentUpdateText += '</li>';
93-
document.getElementById(elementToUpdate).outerHTML = documentUpdateText;
94-
}
60+
updateLaterFolders(currentRow, newValue);
9561
}
9662
newValue--;
9763
if(countOfAddedFiles > 0)
@@ -100,7 +66,31 @@ function deleteRowFunction(currentRow, decreaseCountWatchListNum)
10066
countOfWatchList--;
10167
}
10268
document.getElementById('numberOfRows').value = newValue;
103-
}
69+
}
70+
71+
function updateLaterFolders(currentRow, newValue)
72+
{
73+
for(var i = currentRow + 1; i <= newValue; i++)
74+
{
75+
var updateItoIMinusOne = i - 1;
76+
var elementToUpdate = "rowNumber" + i;
77+
var documentUpdateText = "<li class='watchFolderGroups' id='rowNumber"+updateItoIMinusOne+"' ><span class='leftSpacingserverNames' > Name: </span> ";
78+
var watchListKeyIdFind = "watchListKey"+i;
79+
var previousElementNumIdentifierForKey = document.getElementsByName(watchListKeyIdFind);
80+
81+
documentUpdateText += "<input class='inputWidth300' type='text' name='watchListKey"+updateItoIMinusOne+"' value='"+previousElementNumIdentifierForKey[0].value+"'> ";
82+
for(var j = 0; j < numberOfSubRows; j++)
83+
{
84+
var watchListItemIdFind = "watchListItem"+i+"-"+(j+1);
85+
var previousElementNumIdentifierForItem = document.getElementsByName(watchListItemIdFind);
86+
documentUpdateText += "<br> <span class='leftSpacingserverNames' > "+arrayOfKeysNonEnc[j]+": </span> <input style='display: none;' type='text' name='watchListItem"+updateItoIMinusOne+"-"+(j+1)+"-Name' value="+arrayOfKeysNonEnc[j]+"> <input class='inputWidth300' type='text' name='watchListItem"+updateItoIMinusOne+"-"+(j+1)+"' value='"+previousElementNumIdentifierForItem[0].value+"'>";
87+
}
88+
documentUpdateText += '<br> <input style="display: none" type="text" name="watchListItem'+updateItoIMinusOne+'-0" value="'+numberOfSubRows+'"> ';
89+
documentUpdateText += '<span class="leftSpacingserverNames" ></span> <a class="mainLinkClass" onclick="deleteRowFunction('+updateItoIMinusOne+', true)">Remove</a><span> | </span><a class="mainLinkClass" onclick="testConnection(dataForWatchFolder'+updateItoIMinusOne+');" >Check Connection</a>';
90+
documentUpdateText += '</li>';
91+
document.getElementById(elementToUpdate).outerHTML = documentUpdateText;
92+
}
93+
}
10494

10595
function testConnection(currentRowInformation)
10696
{
@@ -117,8 +107,8 @@ function testConnection(currentRowInformation)
117107
popupHtml += "<div style=\"width:100%;text-align:center; line-height: 50px;\"> <img id=\"connectionCheckMainLoad\" src=\"core/img/loading.gif\" height=\"50\" width=\"50\"> <img style=\"display: none;\" id=\"connectionCheckMainGreen\" src=\"core/img/greenCheck.png\" height=\"50\" width=\"50\"> <img style=\"display: none;\" id=\"connectionCheckMainRed\" src=\"core/img/redWarning.png\" height=\"50\" width=\"50\">Website";
118108
popupHtml += "<img id=\"connectionCheckStatusLoad\" src=\"core/img/loading.gif\" height=\"50\" width=\"50\"> <img style=\"display: none;\" id=\"connectionCheckStatusGreen\" src=\"core/img/greenCheck.png\" height=\"50\" width=\"50\"> <img style=\"display: none;\" id=\"connectionCheckStatusRed\" src=\"core/img/redWarning.png\" height=\"50\" width=\"50\"> Status </div>";
119109
document.getElementById('popupContentInnerHTMLDiv').innerHTML = popupHtml;
120-
121-
110+
111+
122112
//send check requests
123113
checkWebsiteInGeneral(currentRowInformation['WebsiteBase']);
124114
checkWebsiteStatus(sendUrlHere);

core/php/functions/watchlistFunctions.php

Whitespace-only changes.

core/php/templateFiles/watchList.php

Lines changed: 21 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -26,20 +26,19 @@
2626
<br>
2727
<span class="leftSpacingserverNames" > Git Repo:</span> <input disabled="true" class='inputWidth300' type='text' value='Name of your github repo: username/repo'>
2828
<br>
29-
<span class="leftSpacingserverNames" > Group Info:</span> <input disabled="true" class='inputWidth300' type='text' value='Name of group'>
30-
<br>
31-
<span class="leftSpacingserverNames" > URL Hit:</span> <input disabled="true" class='inputWidth300' type='text' value='Location of file hit, blank = default'>
32-
<br>
29+
<span class="leftSpacingserverNames" > Branch List:</span> <input disabled="true" class='inputWidth300' type='text' value='Compare branches list example: master , develop'>
30+
<br>
3331
<span class="leftSpacingserverNames" > Git Type:</span>
3432
<select disabled="true" class='inputWidth300' >
3533
<option value="local" >github</option>
3634
<option value="external" >gitlab</option>
3735
</select>
3836
<br>
39-
<span class="leftSpacingserverNames" > Branch List:</span> <input disabled="true" class='inputWidth300' type='text' value='Compare branches list example: master , develop'>
40-
<br>
4137
<span class="leftSpacingserverNames" > Custom Git:</span> <input disabled="true" class='inputWidth300' type='text' value='Custom url for git. Empty = default'>
42-
38+
<br>
39+
<span class="leftSpacingserverNames" > Group Info:</span> <input disabled="true" class='inputWidth300' type='text' value='Name of group'>
40+
<br>
41+
<span class="leftSpacingserverNames" > URL Hit:</span> <input disabled="true" class='inputWidth300' type='text' value='Location of file hit, blank = default'>
4342
</li>
4443
<?php
4544

@@ -99,11 +98,13 @@
9998
);
10099

101100
endif; ?>
101+
<script type="text/javascript">
102+
var arrayOfKeysNonEnc = <?php echo json_encode(array_keys($defaultArray)); ?>
103+
</script>
102104
<li><h2>Your Watch List: </h2></li>
103105
<?php
104106
$i = 0;
105107
$numCount = 0;
106-
$arrayOfKeys = array();
107108
foreach($config['watchList'] as $key => $item): $i++;
108109
$type = "internal";
109110
if(isset($item["type"]) && $pollType === "2")
@@ -124,16 +125,8 @@
124125
$j++;
125126
?>
126127
<br>
127-
<?php if($key2 !== "Archive"): ?>
128-
<span class="leftSpacingserverNames" > <?php echo $approvedArrayKeys[$key2]; ?>: </span>
129-
<?php endif; ?>
128+
<span class="leftSpacingserverNames" > <?php echo $approvedArrayKeys[$key2]; ?>: </span>
130129
<input style="display: none;" type="text" name='watchListItem<?php echo $i; ?>-<?php echo $j; ?>-Name' value="<?php echo $key2;?>" >
131-
<?php
132-
if(!in_array($key2, $arrayOfKeys))
133-
{
134-
array_push($arrayOfKeys, $key2);
135-
}
136-
?>
137130
<?php
138131
if($key2 === "gitType"):
139132
$gitType = $item2;
@@ -147,12 +140,17 @@
147140
<option value="gitlab" <?php if($gitType === "gitlab"){echo "selected"; }?> >GitLab</option>
148141
</select>
149142
<?php elseif($key2 === "Archive"): ?>
150-
<input id="archiveInput<?php echo $i; ?>" class='inputWidth300' type='hidden' name='watchListItem<?php echo $i; ?>-<?php echo $j; ?>' value='<?php if(isset($item[$key2])){ echo $item[$key2]; }else{echo "false";}?>'>
151-
<?php if ($item[$key2] === "true"): ?>
152-
<a style="display: block;" id="archiveButton<?php echo $i; ?>" onclick="toggleArchive(<?php echo $i; ?>);" class="mainLinkClass" >Un-Archive</a>
153-
<?php else: ?>
154-
<a style="display: block;" id="archiveButton<?php echo $i; ?>" onclick="toggleArchive(<?php echo $i; ?>);" class="mainLinkClass" >Archive</a>
155-
<?php endif; ?>
143+
<?php
144+
$value = "false";
145+
if(isset($item[$key2]))
146+
{
147+
$value = (string)$item[$key2];
148+
}
149+
?>
150+
<select class='inputWidth300' name='watchListItem<?php echo $i; ?>-<?php echo $j; ?>' >
151+
<option value="true" <?php if($value === "true"){echo "selected"; }?> >True</option>
152+
<option value="false" <?php if($value === "false"){echo "selected"; }?> >False</option>
153+
</select>
156154
<?php else: ?>
157155
<input class='inputWidth300' type='text' name='watchListItem<?php echo $i; ?>-<?php echo $j; ?>' value='<?php if(isset($item[$key2])){ echo $item[$key2]; }?>'>
158156
<?php endif;

core/php/templateFiles/watchListServer.php

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,13 @@
7676
'type' => '',
7777
'Archive' => 'false'
7878
);
79-
79+
?>
80+
<script type="text/javascript">
81+
var arrayOfKeysNonEnc = <?php echo json_encode(array_keys($defaultArray)); ?>
82+
</script>
83+
<?php
8084
$i = 0;
8185
$numCount = 0;
82-
$arrayOfKeys = array();
8386
foreach($config['serverWatchList'] as $key => $item): $i++; ?>
8487
<script type="text/javascript">
8588
var dataForWatchFolder<?php echo $i?> = JSON.parse('<?php echo json_encode($item); ?>');
@@ -93,15 +96,9 @@
9396
$j++;
9497
?>
9598
<br>
96-
<?php if($key2 !== "Archive"): ?>
97-
<span class="leftSpacingserverNames" > <?php echo $arrayKeys[$key2]; ?>: </span>
98-
<?php endif; ?>
99+
<span class="leftSpacingserverNames" > <?php echo $arrayKeys[$key2]; ?>: </span>
99100
<input style="display: none;" type="text" name='watchListItem<?php echo $i; ?>-<?php echo $j; ?>-Name' value="<?php echo $key2;?>" >
100101
<?php
101-
if(!in_array($key2, $arrayOfKeys))
102-
{
103-
array_push($arrayOfKeys, $key2);
104-
}
105102
if($key2 === "type"):
106103
?>
107104
<select class='inputWidth300' name='watchListItem<?php echo $i; ?>-<?php echo $j; ?>' >
@@ -115,16 +112,19 @@
115112
<option value="github" <?php if($item[$key2] === "github"){echo "selected"; }?> >GitHub</option>
116113
<option value="gitlab" <?php if($item[$key2] === "gitlab"){echo "selected"; }?> >GitLab</option>
117114
</select>
118-
<?php
119-
elseif($key2 === "Archive"): ?>
120-
<input id="archiveInput<?php echo $i; ?>" class='inputWidth300' type='hidden' name='watchListItem<?php echo $i; ?>-<?php echo $j; ?>' value='<?php if (isset($item[$key2])){ echo $item[$key2]; }else{echo "false";} ?>'>
121-
<?php if ($item[$key2] === "true"): ?>
122-
<a style="display: block;" id="archiveButton<?php echo $i; ?>" onclick="toggleArchive(<?php echo $i; ?>);" class="mainLinkClass" >Un-Archive</a>
123-
<?php else: ?>
124-
<a style="display: block;" id="archiveButton<?php echo $i; ?>" onclick="toggleArchive(<?php echo $i; ?>);" class="mainLinkClass" >Archive</a>
125-
<?php endif; ?>
126-
<?php
127-
else: ?>
115+
<?php elseif($key2 === "Archive"): ?>
116+
<?php
117+
$value = "false";
118+
if(isset($item[$key2]))
119+
{
120+
$value = (string)$item[$key2];
121+
}
122+
?>
123+
<select class='inputWidth300' name='watchListItem<?php echo $i; ?>-<?php echo $j; ?>' >
124+
<option value="true" <?php if($value === "true"){echo "selected"; }?> >True</option>
125+
<option value="false" <?php if($value === "false"){echo "selected"; }?> >False</option>
126+
</select>
127+
<?php else: ?>
128128
<input class='inputWidth300' type='text' name='watchListItem<?php echo $i; ?>-<?php echo $j; ?>' value='<?php if (isset($item[$key2])){ echo $item[$key2]; } ?>'>
129129
<?php endif; ?>
130130
<?php endforeach;

settings-watchList.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88
require_once('local/layout.php');
99
$baseUrl .= $currentSelectedTheme."/";
1010
}
11-
require_once($baseUrl.'conf/config.php');
11+
require_once($baseUrl.'conf/config.php');
1212
require_once('core/conf/config.php');
13-
require_once('core/php/configStatic.php');
13+
require_once('core/php/configStatic.php');
1414
require_once('core/php/update/updateCheck.php');
15-
require_once('core/php/loadVars.php');
15+
require_once('core/php/loadVars.php');
1616
require_once('setup/setupProcessFile.php');
1717
?>
1818
<!doctype html>
@@ -27,7 +27,7 @@
2727
<script src="core/js/visibility.timers.js"></script>
2828
</head>
2929
<body>
30-
30+
3131
<?php require_once('core/php/templateFiles/sidebar.php'); ?>
3232
<?php require_once('core/php/templateFiles/header.php'); ?>
3333
<div id="main">
@@ -115,8 +115,6 @@ function saveWatchList(post)
115115
var countOfClicks = 0;
116116
var locationInsert = "newRowLocationForWatchList";
117117
var numberOfSubRows = <?php echo $numCount; ?>;
118-
var arrayOfKeysJsonEncoded = '<?php echo json_encode($arrayOfKeys); ?>';
119-
var arrayOfKeysNonEnc = JSON.parse(arrayOfKeysJsonEncoded);
120118
<?php
121119
echo "var currentVersion = '".$configStatic['version']."';";
122120
?>

settings-watchListServer.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88
require_once('local/layout.php');
99
$baseUrl .= $currentSelectedTheme."/";
1010
}
11-
require_once($baseUrl.'conf/config.php');
11+
require_once($baseUrl.'conf/config.php');
1212
require_once('core/conf/config.php');
13-
require_once('core/php/configStatic.php');
13+
require_once('core/php/configStatic.php');
1414
require_once('core/php/update/updateCheck.php');
15-
require_once('core/php/loadVars.php');
15+
require_once('core/php/loadVars.php');
1616
require_once('setup/setupProcessFile.php');
1717
?>
1818
<!doctype html>
@@ -27,7 +27,7 @@
2727
<script src="core/js/visibility.timers.js"></script>
2828
</head>
2929
<body>
30-
30+
3131
<?php require_once('core/php/templateFiles/sidebar.php'); ?>
3232
<?php require_once('core/php/templateFiles/header.php'); ?>
3333
<div id="main">
@@ -115,8 +115,6 @@ function saveWatchList(post)
115115
var countOfClicks = 0;
116116
var locationInsert = "newRowLocationForWatchList";
117117
var numberOfSubRows = <?php echo $numCount; ?>;
118-
var arrayOfKeysJsonEncoded = '<?php echo json_encode($arrayOfKeys); ?>';
119-
var arrayOfKeysNonEnc = JSON.parse(arrayOfKeysJsonEncoded);
120118
<?php
121119
echo "var currentVersion = '".$configStatic['version']."';";
122120
?>

setup/step3.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ function clean_url($url) {
1414
}
1515

1616

17-
require_once($baseUrl.'conf/config.php');
17+
require_once($baseUrl.'conf/config.php');
1818
require_once('setupProcessFile.php');
1919

2020
if($setupProcess != "step3")
@@ -49,7 +49,7 @@ function clean_url($url) {
4949
</style>
5050
</head>
5151
<body>
52-
<?php readfile('../core/html/popup.html') ?>
52+
<?php readfile('../core/html/popup.html') ?>
5353
<div class="firstBoxDev" style="width: 90%; margin: auto; margin-right: auto; margin-left: auto; display: block; height: auto; margin-top: 15px;" >
5454
<div class="devBoxTitle">
5555
<h1>Step 3 of <?php echo $counterSteps; ?></h1>
@@ -89,8 +89,6 @@ function customSettings()
8989
var countOfClicks = 0;
9090
var locationInsert = "newRowLocationForWatchList";
9191
var numberOfSubRows = <?php echo $numCount; ?>;
92-
var arrayOfKeysJsonEncoded = '<?php echo json_encode($arrayOfKeys); ?>';
93-
var arrayOfKeysNonEnc = JSON.parse(arrayOfKeysJsonEncoded);
9492

9593

9694
</script>

0 commit comments

Comments
 (0)