Skip to content

Commit 7e8c979

Browse files
author
mreishman
committed
added groups to watchlist block settings
1 parent 122625a commit 7e8c979

File tree

3 files changed

+163
-106
lines changed

3 files changed

+163
-106
lines changed

core/php/functions/watchlistFunctions.php

Lines changed: 116 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -18,121 +18,135 @@ function generateWatchlistBlock($defaultArray, $arrayKeys, $key = "{{key}}", $it
1818
<span class=\"leftSpacingserverNames\" > Name: </span>
1919
<input class='inputWidth300' type='text' name='watchListKey" . $i . "' value='" . $key . "'>";
2020
$j = 0;
21-
foreach($defaultArray as $key2 => $item2)
21+
foreach($defaultArray as $groupName => $groupData)
2222
{
23-
$varValue = "REPLACE";
24-
if(!empty($item))
23+
if($groupName !== "")
2524
{
26-
$varValue = "";
27-
if(isset($item[$key2]))
25+
$stringToReturn .= "<div style=\"border-bottom: 1px solid black; margin-bottom: 5px;\">
26+
<h4 style=\"margin: 5px;\">".$groupName."</h4>
27+
</div>";
28+
}
29+
$brCount = 0;
30+
foreach($groupData as $key2 => $item2)
31+
{
32+
$varValue = "REPLACE";
33+
if(!empty($item))
2834
{
29-
$varValue = $item[$key2];
35+
$varValue = "";
36+
if(isset($item[$key2]))
37+
{
38+
$varValue = $item[$key2];
39+
}
3040
}
31-
}
32-
$j++;
33-
$stringToReturn .= "
34-
<br>
35-
<span class=\"leftSpacingserverNames\" >" . $arrayKeys[$key2] . ": </span>
36-
<input style=\"display: none;\" type=\"text\" name='watchListItem" . $i . "-" . $j . "-Name' value=\"" . $key2 . "\" >";
37-
if($key2 === "type")
38-
{
39-
$stringToReturn .= "
40-
<select class='inputWidth300' name='watchListItem" . $i . "-" . $j . "' >";
41-
if(!empty($item))
42-
{
43-
$stringToReturn .= "
44-
<option value=\"local\" ";
45-
if($varValue === "local")
46-
{
47-
$stringToReturn .= " selected ";
48-
}
49-
$stringToReturn .= " >Local</option>
50-
<option value=\"external\" ";
51-
if($varValue === "external")
52-
{
53-
$stringToReturn .= " selected ";
54-
}
55-
$stringToReturn .= ">External</option>";
56-
}
57-
else
58-
{
59-
$stringToReturn .= "{{" . $i . "-" . $j . "}}";
60-
}
61-
$stringToReturn .= "</select>";
62-
}
63-
elseif($key2 === "gitType")
64-
{
65-
$stringToReturn .= "
66-
<select class='inputWidth300' name='watchListItem" . $i . "-" . $j . "' >";
67-
if(!empty($item))
68-
{
69-
$stringToReturn .= "
70-
<option value=\"github\" ";
71-
if($varValue === "github")
72-
{
73-
$stringToReturn .= " selected ";
74-
}
75-
$stringToReturn .= " >GitHub</option>
76-
<option value=\"gitlab\" ";
77-
if($varValue === "gitlab")
78-
{
79-
$stringToReturn .= "selected";
80-
}
81-
$stringToReturn .= ">GitLab</option>";
41+
$j++;
42+
if($brCount !== 0)
43+
{
44+
$stringToReturn .= "<br>";
8245
}
83-
else
84-
{
85-
$stringToReturn .= "{{" . $i . "-" . $j . "}}";
86-
}
87-
$stringToReturn .= "</select>";
88-
}
89-
elseif($key2 === "Archive")
90-
{
46+
$brCount++;
9147
$stringToReturn .= "
92-
<select class='inputWidth300' name='watchListItem" . $i . "-" . $j . "' >";
93-
if(!empty($item))
94-
{
95-
$value = "false";
96-
if(isset($varValue))
97-
{
98-
$value = (string)$varValue;
99-
}
48+
<span class=\"leftSpacingserverNames\" >" . $arrayKeys[$key2] . ": </span>
49+
<input style=\"display: none;\" type=\"text\" name='watchListItem" . $i . "-" . $j . "-Name' value=\"" . $key2 . "\" >";
50+
if($key2 === "type")
51+
{
10052
$stringToReturn .= "
101-
<option value=\"true\" ";
102-
if($value === "true")
103-
{
104-
$stringToReturn .= " selected ";
105-
}
106-
$stringToReturn .= " >True</option>
107-
<option value=\"false\" ";
108-
if($value === "false")
109-
{
110-
$stringToReturn .= " selected ";
111-
}
112-
$stringToReturn .= " >False</option>";
53+
<select class='inputWidth300' name='watchListItem" . $i . "-" . $j . "' >";
54+
if(!empty($item))
55+
{
56+
$stringToReturn .= "
57+
<option value=\"local\" ";
58+
if($varValue === "local")
59+
{
60+
$stringToReturn .= " selected ";
61+
}
62+
$stringToReturn .= " >Local</option>
63+
<option value=\"external\" ";
64+
if($varValue === "external")
65+
{
66+
$stringToReturn .= " selected ";
67+
}
68+
$stringToReturn .= ">External</option>";
69+
}
70+
else
71+
{
72+
$stringToReturn .= "{{" . $i . "-" . $j . "}}";
73+
}
74+
$stringToReturn .= "</select>";
11375
}
114-
else
76+
elseif($key2 === "gitType")
11577
{
116-
$stringToReturn .= "{{" . $i . "-" . $j . "}}";
117-
}
118-
$stringToReturn .= "</select>";
119-
}
120-
else
121-
{
122-
$stringToReturn .= "
123-
<input class='inputWidth300' type='text' name='watchListItem" . $i . "-" . $j . "' value='";
124-
if(!empty($item))
125-
{
126-
if($varValue !== "")
127-
{
128-
$stringToReturn .= "$varValue";
78+
$stringToReturn .= "
79+
<select class='inputWidth300' name='watchListItem" . $i . "-" . $j . "' >";
80+
if(!empty($item))
81+
{
82+
$stringToReturn .= "
83+
<option value=\"github\" ";
84+
if($varValue === "github")
85+
{
86+
$stringToReturn .= " selected ";
87+
}
88+
$stringToReturn .= " >GitHub</option>
89+
<option value=\"gitlab\" ";
90+
if($varValue === "gitlab")
91+
{
92+
$stringToReturn .= "selected";
93+
}
94+
$stringToReturn .= ">GitLab</option>";
12995
}
96+
else
97+
{
98+
$stringToReturn .= "{{" . $i . "-" . $j . "}}";
99+
}
100+
$stringToReturn .= "</select>";
130101
}
131-
else
102+
elseif($key2 === "Archive")
132103
{
133-
$stringToReturn .= "{{" . $i . "-" . $j . "}}";
104+
$stringToReturn .= "
105+
<select class='inputWidth300' name='watchListItem" . $i . "-" . $j . "' >";
106+
if(!empty($item))
107+
{
108+
$value = "false";
109+
if(isset($varValue))
110+
{
111+
$value = (string)$varValue;
112+
}
113+
$stringToReturn .= "
114+
<option value=\"true\" ";
115+
if($value === "true")
116+
{
117+
$stringToReturn .= " selected ";
118+
}
119+
$stringToReturn .= " >True</option>
120+
<option value=\"false\" ";
121+
if($value === "false")
122+
{
123+
$stringToReturn .= " selected ";
124+
}
125+
$stringToReturn .= " >False</option>";
126+
}
127+
else
128+
{
129+
$stringToReturn .= "{{" . $i . "-" . $j . "}}";
130+
}
131+
$stringToReturn .= "</select>";
132+
}
133+
else
134+
{
135+
$stringToReturn .= "
136+
<input class='inputWidth300' type='text' name='watchListItem" . $i . "-" . $j . "' value='";
137+
if(!empty($item))
138+
{
139+
if($varValue !== "")
140+
{
141+
$stringToReturn .= "$varValue";
142+
}
143+
}
144+
else
145+
{
146+
$stringToReturn .= "{{" . $i . "-" . $j . "}}";
147+
}
148+
$stringToReturn .= "'>";
134149
}
135-
$stringToReturn .= "'>";
136150
}
137151
}
138152
$stringToReturn .= "

core/php/templateFiles/watchList.php

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,25 @@
6969
'Archive' => 'false'
7070
);
7171

72+
$groups = array(
73+
'General' => array(
74+
'WebsiteBase' => '',
75+
'Folder' => '',
76+
'Website' => ''
77+
),
78+
'Git' => array(
79+
'githubRepo' => '',
80+
'branchList' => 'master',
81+
'gitType' => 'github',
82+
'customGit' => ''
83+
),
84+
'Advanced' => array(
85+
'groupInfo' => '',
86+
'urlHit' => '',
87+
'Archive' => 'false'
88+
)
89+
);
90+
7291
elseif($pollType === "2"): ?>
7392
<li><h2>Example:</h2></li>
7493
<li class="watchFolderGroups">
@@ -96,6 +115,10 @@
96115
"Archive" => 'false'
97116
);
98117

118+
$groups = array(
119+
"" => $defaultArray
120+
);
121+
99122
endif; ?>
100123
<script type="text/javascript">
101124
var arrayOfKeysNonEnc = <?php echo json_encode(array_keys($defaultArray)); ?>;
@@ -108,14 +131,14 @@
108131
foreach($config['watchList'] as $key => $item)
109132
{
110133
$i++;
111-
echo generateWatchlistBlock($defaultArray, $arrayKeys, $key, $item, $i);
134+
echo generateWatchlistBlock($groups, $arrayKeys, $key, $item, $i);
112135
} ?>
113136
<div style="display: inline-block;" id="newRowLocationForWatchList"></div>
114137
</ul>
115138
</div>
116139
<div id="hidden" style="display: none">
117140
<span id="hiddenWatchlistFormBlank">
118-
<?php echo generateWatchlistBlock($defaultArray, $arrayKeys); ?>
141+
<?php echo generateWatchlistBlock($groups, $arrayKeys); ?>
119142
</span>
120143
<input id="numberOfRows" type="text" name="numberOfRows" value="<?php echo $i;?>">
121144
<input id="watchListNormal" type="text" name="watchListNormal" value="true" >

core/php/templateFiles/watchListServer.php

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,26 @@
7676
'type' => '',
7777
'Archive' => 'false'
7878
);
79+
80+
$groups = array(
81+
'General' => array(
82+
'WebsiteBase' => '',
83+
'Folder' => '',
84+
'Website' => ''
85+
),
86+
'Git' => array(
87+
'githubRepo' => '',
88+
'branchList' => 'master',
89+
'gitType' => 'github',
90+
'customGit' => ''
91+
),
92+
'Advanced' => array(
93+
'groupInfo' => '',
94+
'urlHit' => '',
95+
'type' => '',
96+
'Archive' => 'false'
97+
)
98+
);
7999
?>
80100
<script type="text/javascript">
81101
var arrayOfKeysNonEnc = <?php echo json_encode(array_keys($defaultArray)); ?>;
@@ -86,14 +106,14 @@
86106
$i = 0;
87107
foreach($config['serverWatchList'] as $key => $item){
88108
$i++;
89-
echo generateWatchlistBlock($defaultArray, $arrayKeys, $key, $item, $i);
109+
echo generateWatchlistBlock($groups, $arrayKeys, $key, $item, $i);
90110
} ?>
91111
<div style="display: inline-block;" id="newRowLocationForWatchList"></div>
92112
</ul>
93113
</div>
94114
<div id="hidden" style="display: none">
95115
<span id="hiddenWatchlistFormBlank">
96-
<?php echo generateWatchlistBlock($defaultArray, $arrayKeys); ?>
116+
<?php echo generateWatchlistBlock($groups, $arrayKeys); ?>
97117
</span>
98118
<input id="numberOfRows" type="text" name="numberOfRows" value="<?php echo $i;?>">
99119
<input id="watchListServer" type="text" name="watchListServer" value="true" >

0 commit comments

Comments
 (0)