Skip to content

Commit 26353ac

Browse files
author
mreishman
committed
possibly changed save to work? and other stuff with multi folder
1 parent ab0e359 commit 26353ac

File tree

6 files changed

+128
-12
lines changed

6 files changed

+128
-12
lines changed

core/conf/config.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
'locationForMonitor' => '',
4646
'locationForSearch' => '',
4747
'locationForStatus' => '',
48-
'locationOfTests' => '',
48+
'locationOfTests' => array( 'LocationOfTests1' => array('FileInformation' => '{}','FileType' => 'auto','Location' => '/var/www/html/Tests/Selenium/','Pattern' => '$','Recursive' => 'true')),
4949
'locationOfSelenium' => '',
5050
'logFileLocation' => '',
5151
'logFontColor' => '#FFFFFF',

core/js/settingsWatchlist.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -981,7 +981,6 @@ $( document ).ready(function()
981981
'scroll',
982982
function (event)
983983
{
984-
onScrollShowFixedMiniBar(["settingsMainWatch"]);
985984
moveFileFolderDropdown();
986985
},
987986
true

core/php/commonFunctions.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -321,23 +321,28 @@ function returnArrayOfGroups($file)
321321
return $arrayOfGroups;
322322
}
323323

324-
function scanDirForTests($dir, $showSubFolderTests)
324+
function scanDirForTests($dir, $showSubFolderTests, $fileInfo)
325325
{
326326
$stuffToReturn = "<ul style=\"list-style: none;\" >No Files Found In Directory";
327327
$files = array_diff(scandir($dir), array('..', '.'));
328328
if($files !== array())
329329
{
330330
$stuffToReturn = "<ul style=\"list-style: none;\" >";
331+
$stuffToReturn .= "<li>".$dir."</li>";
331332
foreach($files as $key => $value)
332333
{
333334
$path = realpath($dir.DIRECTORY_SEPARATOR.$value);
335+
if(isset($fileInfo[$path]) && isset($fileInfo[$path]["Include"]) && $fileInfo[$path]["Include"] !== "true")
336+
{
337+
continue;
338+
}
334339
if(is_file($path) && returnArrayOfTests(file($path), $path) !== array())
335340
{
336341
$stuffToReturn .= "<li><input onchange=\"getFileList();\" type='checkbox' name=\"".$path."\">".$value."</li>";
337342
}
338343
elseif(is_dir($path) && $showSubFolderTests)
339344
{
340-
$stuffToReturn .= scanDirForTests($path, $showSubFolderTests);
345+
$stuffToReturn .= scanDirForTests($path, $showSubFolderTests, $fileInfo);
341346
}
342347
}
343348
}

core/php/loadVars.php

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,67 @@ function forEachAddVars($variable)
110110

111111
if($_SERVER['REQUEST_METHOD'] == 'POST')
112112
{
113+
114+
$arrayWatchList = "";
115+
if(isset($_POST['numberOfRows']))
116+
{
117+
$baseKeys = $defaultConfig["locationOfTests"]["LocationOfTests1"];
118+
$baseKeysCount = count($baseKeys);
119+
for($i = 1; $i <= $_POST['numberOfRows']; $i++ )
120+
{
121+
$arrayWatchList .= "'".$_POST['watchListKey'.$i]."' => array(";
122+
$baseKeyCounter = 0;
123+
foreach ($baseKeys as $key => $value)
124+
{
125+
$baseKeyCounter++;
126+
$arrayWatchList .= "'".$key."' => '".$_POST['watchListKey'.$i.$key]."'";
127+
if($baseKeyCounter !== $baseKeysCount)
128+
{
129+
$arrayWatchList .= ",";
130+
}
131+
}
132+
$arrayWatchList .= ")";
133+
if($i != $_POST['numberOfRows'])
134+
{
135+
$arrayWatchList .= ",";
136+
}
137+
}
138+
}
139+
else
140+
{
141+
$numberOfRows = count($locationOfTests);
142+
$i = 0;
143+
foreach ($locationOfTests as $key => $value)
144+
{
145+
$i++;
146+
if(is_array($value))
147+
{
148+
$arrayWatchList .= "'".$key."' => array(";
149+
$numberOfRows2 = count($value);
150+
$j = 0;
151+
foreach ($value as $key2 => $value2)
152+
{
153+
$j++;
154+
$arrayWatchList .= "'".$key2."' => '".$value2."'";
155+
if($j != $numberOfRows2)
156+
{
157+
$arrayWatchList .= ",";
158+
}
159+
}
160+
$arrayWatchList .= ")";
161+
}
162+
else
163+
{
164+
$arrayWatchList .= "'".$key."' => '".$value."'";
165+
}
166+
if($i != $numberOfRows)
167+
{
168+
$arrayWatchList .= ",";
169+
}
170+
}
171+
}
172+
$locationOfTests = $arrayWatchList;
173+
113174
$popupSettingsArraySave = "";
114175
if($popupWarnings == "all")
115176
{

core/php/saveCheck.php

Lines changed: 38 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,29 +50,61 @@ function forEachAddVars($variable)
5050
$arrayWatchList = "";
5151
if(isset($_POST['numberOfRows']))
5252
{
53+
$baseKeys = $defaultConfig["locationOfTests"]["LocationOfTests1"];
54+
$baseKeysCount = count($baseKeys);
5355
for($i = 1; $i <= $_POST['numberOfRows']; $i++ )
5456
{
55-
$arrayWatchList .= "'".$_POST['watchListKey'.$i]."' => '".$_POST['watchListItem'.$i]."'";
57+
$arrayWatchList .= "'".$_POST['watchListKey'.$i]."' => array(";
58+
$baseKeyCounter = 0;
59+
foreach ($baseKeys as $key => $value)
60+
{
61+
$baseKeyCounter++;
62+
$arrayWatchList .= "'".$key."' => '".$_POST['watchListKey'.$i.$key]."'";
63+
if($baseKeyCounter !== $baseKeysCount)
64+
{
65+
$arrayWatchList .= ",";
66+
}
67+
}
68+
$arrayWatchList .= ")";
5669
if($i != $_POST['numberOfRows'])
5770
{
5871
$arrayWatchList .= ",";
5972
}
6073
}
61-
$watchListSave = $arrayWatchList;
74+
$locationOfTestsSave = $arrayWatchList;
6275
$arrayWatchList = "";
6376

64-
$numberOfRows = count($config['watchList']);
77+
$numberOfRows = count($config['locationOfTests']);
6578
$i = 0;
66-
foreach ($config['watchList'] as $key => $value)
79+
foreach ($config['locationOfTests'] as $key => $value)
6780
{
6881
$i++;
69-
$arrayWatchList .= "'".$key."' => '".$value."'";
82+
if(is_array($value))
83+
{
84+
$arrayWatchList .= "'".$key."' => array(";
85+
$numberOfRows2 = count($value);
86+
$j = 0;
87+
foreach ($value as $key2 => $value2)
88+
{
89+
$j++;
90+
$arrayWatchList .= "'".$key2."' => '".$value2."'";
91+
if($j != $numberOfRows2)
92+
{
93+
$arrayWatchList .= ",";
94+
}
95+
}
96+
$arrayWatchList .= ")";
97+
}
98+
else
99+
{
100+
$arrayWatchList .= "'".$key."' => '".$value."'";
101+
}
70102
if($i != $numberOfRows)
71103
{
72104
$arrayWatchList .= ",";
73105
}
74106
}
75-
$watchList = $arrayWatchList;
107+
$locationOfTests = $arrayWatchList;
76108
}
77109

78110
if(isset($_POST['saveSettings']))

run/index.php

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,28 @@
9595
<div class="newTestPartOne">
9696
<h1 class="title">1.</h1>
9797
<br>
98-
<?php if(is_dir($locationOfTests) && !isDirRmpty($locationOfTests)):?>
98+
<?php
99+
$listToEcho = "";
100+
foreach($locationOfTests as $key => $values)
101+
{
102+
$location = $values["Location"];
103+
$pattern = $values["Pattern"];
104+
if(!file_exists($location))
105+
{
106+
$listToEcho .= "<ul style=\"list-style: none;\" ><li style=\"color: red;\" > Could not find file or dir: ".$location."</li></ul>";
107+
}
108+
elseif(is_dir($location))
109+
{
110+
$listToEcho .= scanDirForTests($location, $values["Recursive"], json_decode($values["FileInformation"], true));
111+
}
112+
elseif(is_file($location))
113+
{
114+
$listToEcho .= "<ul style=\"list-style: none;\" ><li><input onchange=\"getFileList();\" type='checkbox' name=\"".$location."\">".$location."</li></ul>";
115+
}
116+
}
117+
if($listToEcho):?>
99118
<form id="fileSelectListForm" >
100-
<?php echo scanDirForTests($locationOfTests, $showSubFolderTests); ?>
119+
<?php echo $listToEcho; ?>
101120
</form>
102121
<?php else: ?>
103122
Please specifiy a directory of where test are located on the settings page

0 commit comments

Comments
 (0)