Subversion Repositories SvarDOS

Rev

Rev 1512 | Rev 1520 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1512 Rev 1513
Line 10... Line 10...
10
  $cats = json_decode(file_get_contents('../packages/_cats.json'), true);
10
  $cats = json_decode(file_get_contents('../packages/_cats.json'), true);
11
  sort($cats);
11
  sort($cats);
12
 
12
 
13
  $catfilter = '';
13
  $catfilter = '';
14
  if (!empty($_GET['cat'])) $catfilter = strtolower($_GET['cat']);
14
  if (!empty($_GET['cat'])) $catfilter = strtolower($_GET['cat']);
-
 
15
 
-
 
16
  // hw filter?
-
 
17
  $hw = array();
-
 
18
  if (!empty($_GET['hwcpu'])) $hw[] = strtolower($_GET['hwcpu']);
-
 
19
  if (!empty($_GET['hwvid'])) $hw[] = strtolower($_GET['hwvid']);
-
 
20
  if ((!empty($_GET['fpu'])) && ($_GET['fpu'] == 'yes')) $hw[] = 'fpu';
-
 
21
 
15
?>
22
?>
16
 
23
 
17
<form action="?" method="get">
24
<form action="?" method="get">
18
<br>
25
<br>
19
<p>Category filter:&nbsp;
26
<p>Filters:<br>
20
<input type="hidden" name="p" value="repo">
27
<input type="hidden" name="p" value="repo">
-
 
28
 
-
 
29
Target hardware:
-
 
30
 
-
 
31
<select name="hwcpu">
-
 
32
 
-
 
33
<?php
-
 
34
  // build form with list of CPUs + preselect the current CPU (if any)
-
 
35
  $cpus = array('586', '486', '186', '8086');
-
 
36
  foreach ($cpus as $cpu) {
-
 
37
    $sel = '';
-
 
38
    if (array_search($cpu, $hw) !== false) $sel = ' selected';
-
 
39
    echo "<option{$sel}>{$cpu}</option>\n";
-
 
40
  }
-
 
41
?>
-
 
42
</select>
-
 
43
 
-
 
44
<select name="hwfpu">
-
 
45
<?php
-
 
46
if (empty($_GET['hwfpu'])) {
-
 
47
  echo "<option selected value=\"\">no FPU</option>\n";
-
 
48
  echo "<option>FPU</option>\n";
-
 
49
} else {
-
 
50
  echo "<option value=\"\">no FPU</option>\n";
-
 
51
  echo "<option selected>FPU</option>\n";
-
 
52
}
-
 
53
?>
-
 
54
</select>
-
 
55
 
-
 
56
<select name="hwvid">
-
 
57
<?php
-
 
58
  // build form with list of CPUs + preselect the current CPU (if any)
-
 
59
  $vids = array('SVGA', 'VGA', 'MCGA', 'EGA', 'CGA', 'MDA', 'HGC');
-
 
60
  foreach ($vids as $v) {
-
 
61
    $sel = '';
-
 
62
    if (array_search(strtolower($v), $hw) !== false) $sel = ' selected';
-
 
63
    echo "<option{$sel}>{$v}</option>\n";
-
 
64
  }
-
 
65
?>
-
 
66
</select>
-
 
67
 
-
 
68
<br>
-
 
69
 
-
 
70
Category:
21
<select name="cat">
71
<select name="cat">
22
  <option value="">ALL</option>
72
  <option value="">ALL</option>
23
<?php
73
<?php
24
  foreach ($cats as $c) {
74
  foreach ($cats as $c) {
25
    $sel = '';
75
    $sel = '';
26
    if ($c == $catfilter) $sel = ' selected';
76
    if ($c == $catfilter) $sel = ' selected';
27
    echo '  <option value="' . $c . "\"{$sel}>" . $c . "</option>\n";
77
    echo '  <option value="' . $c . "\"{$sel}>" . $c . "</option>\n";
28
  }
78
  }
29
?>
79
?>
30
</select>
80
</select>
-
 
81
 
31
<input type="submit" value="refresh">
82
<input type="submit" value="apply">
32
</p>
83
</p>
33
</form>
84
</form>
34
 
85
 
35
 
86
 
36
<?php
87
<?php
37
 
88
 
38
// hw filter?
-
 
39
$hw = array();
-
 
40
if (!empty($_GET['hw'])) {
-
 
41
  $hw = explode(' ', strtolower($_GET['hw']));
89
// add all supported subsets of hardware (eg. VGA supports MDA, EGA and CGA modes)
42
  foreach ($hw as $h) {
90
foreach ($hw as $h) {
43
 
-
 
44
    // add all supported CPUs
-
 
45
    if ($h == '586') {
-
 
46
      $hw[] = '8086';
-
 
47
      $hw[] = '186';
-
 
48
      $hw[] = '286';
-
 
49
      $hw[] = '386';
-
 
50
      $hw[] = '486';
-
 
51
    }
-
 
52
    if ($h == '486') {
-
 
53
      $hw[] = '8086';
-
 
54
      $hw[] = '186';
-
 
55
      $hw[] = '286';
-
 
56
      $hw[] = '386';
-
 
57
    }
-
 
58
    if ($h == '386') {
-
 
59
      $hw[] = '8086';
-
 
60
      $hw[] = '186';
-
 
61
      $hw[] = '286';
-
 
62
    }
-
 
63
    if ($h == '286') {
-
 
64
      $hw[] = '8086';
-
 
65
      $hw[] = '186';
-
 
66
    }
-
 
67
    if ($h == '186') {
-
 
68
      $hw[] = '8086';
-
 
69
    }
-
 
70
 
91
 
71
    // add all supported graphic
92
  // add all supported CPUs
72
    if ($h == 'svga') {
93
  if ($h == '586') {
-
 
94
    $hw[] = '8086';
73
      $hw[] = 'vga';
95
    $hw[] = '186';
74
      $hw[] = 'ega';
96
    $hw[] = '286';
75
      $hw[] = 'cga';
97
    $hw[] = '386';
76
      $hw[] = 'mda';
98
    $hw[] = '486';
77
    }
99
  }
78
    if ($h == 'vga') {
100
  if ($h == '486') {
-
 
101
    $hw[] = '8086';
79
      $hw[] = 'ega';
102
    $hw[] = '186';
80
      $hw[] = 'cga';
103
    $hw[] = '286';
81
      $hw[] = 'mda';
104
    $hw[] = '386';
82
    }
105
  }
83
    if ($h == 'ega') {
106
  if ($h == '386') {
-
 
107
    $hw[] = '8086';
84
      $hw[] = 'cga';
108
    $hw[] = '186';
85
      $hw[] = 'mda';
109
    $hw[] = '286';
86
    }
110
  }
87
    if ($h == 'cga') {
111
  if ($h == '286') {
-
 
112
    $hw[] = '8086';
88
      $hw[] = 'mda';
113
    $hw[] = '186';
-
 
114
  }
-
 
115
  if ($h == '186') {
-
 
116
    $hw[] = '8086';
89
    }
117
  }
90
 
118
 
-
 
119
  // add all supported graphic
-
 
120
  if ($h == 'svga') {
-
 
121
    $hw[] = 'vga';
-
 
122
    $hw[] = 'ega';
-
 
123
    $hw[] = 'cga';
-
 
124
    $hw[] = 'mda';
-
 
125
  }
-
 
126
  if ($h == 'vga') {
-
 
127
    $hw[] = 'mcga';
-
 
128
    $hw[] = 'ega';
-
 
129
    $hw[] = 'cga';
-
 
130
    $hw[] = 'mda';
-
 
131
  }
-
 
132
  if ($h == 'mcga') {
-
 
133
    $hw[] = 'ega';
-
 
134
    $hw[] = 'cga';
-
 
135
    $hw[] = 'mda';
91
  }
136
  }
-
 
137
  if ($h == 'ega') {
-
 
138
    $hw[] = 'cga';
-
 
139
    $hw[] = 'mda';
-
 
140
  }
-
 
141
  if ($h == 'cga') {
-
 
142
    $hw[] = 'mda';
-
 
143
  }
-
 
144
  if ($h == 'hgc') {
-
 
145
    $hw[] = 'mda';
-
 
146
  }
-
 
147
 
92
}
148
}
93
 
149
 
-
 
150
 
94
$db = json_decode(file_get_contents('../packages/_index.json'), true);
151
$db = json_decode(file_get_contents('../packages/_index.json'), true);
95
 
152
 
96
echo "<table style=\"width: 100%;\">\n";
153
echo "<table style=\"width: 100%;\">\n";
97
 
154
 
98
echo "<thead><tr><th>PACKAGE</th><th>VERSION</th><th>DESCRIPTION</th></tr></thead>\n";
155
echo "<thead><tr><th>PACKAGE</th><th>VERSION</th><th>DESCRIPTION</th></tr></thead>\n";
Line 104... Line 161...
104
  $desc = $meta['desc'];
161
  $desc = $meta['desc'];
105
  check_next_ver:
162
  check_next_ver:
106
  $pref = array_shift($meta['versions']); // get first version (that's the preferred one)
163
  $pref = array_shift($meta['versions']); // get first version (that's the preferred one)
107
  if (empty($pref)) continue; // no more versions
164
  if (empty($pref)) continue; // no more versions
108
  $hwhint = '';
165
  $hwhint = '';
109
  if (!empty($pref['hwreq'])) {
166
  if (!empty($pref['hwreq']) && (!empty($hw))) {
110
    /* if hw filter present, make sure it fullfills package's requirements */
167
    /* if hw filter present, make sure it fullfills package's requirements */
111
    foreach (explode(' ', $pref['hwreq']) as $req) {
168
    foreach (explode(' ', $pref['hwreq']) as $req) {
112
      if (array_search($req, $hw, true) === false) goto check_next_ver;
169
      if (array_search($req, $hw, true) === false) goto check_next_ver;
113
    }
170
    }
114
 
171