Ops: adjust and improve app management

- adjust manage_apps.php to use the same parameter and wording as manage_app_versions.php
- fix HTML and hide update buttons when in read-only ops
- hide app versions of deprecated apps in manage_app_versions.php too
This commit is contained in:
Christian Beer 2016-07-27 11:58:43 +02:00
parent 5a3c5c9542
commit 0a3f2625e4
2 changed files with 23 additions and 11 deletions

View File

@ -81,12 +81,17 @@ function show_form($all) {
// grey out deprecated versions
//
$f1=$f2='';
if ($av->deprecated) {
if ($av->deprecated == 1) {
$f1="<font color='GREY'>";
$f2="</font>";
}
$all_value = $all?1:0;
$app = $apps[$av->appid];
// ignore app versions of deprecated apps by default
if ($all_value == 0 && $app->deprecated == 1) {
continue;
}
echo "<tr class=row$i><form action=manage_app_versions.php?all=$all_value#av_$av->id method=POST>\n";
$i = 1-$i;
echo "<input type=hidden name=id value=$av->id>";
@ -116,7 +121,11 @@ function show_form($all) {
if ($av->deprecated) $v=' CHECKED ';
echo " <TD> <input name=deprecated type='checkbox' $v></TD>\n";
echo "<td><input class=\"btn btn-default\" name=submit type=submit value=Update>";
if (!in_rops()) {
echo "<td><input class=\"btn btn-default\" name=submit type=submit value=Update>";
} else {
echo "<td>&nbsp;</td>";
}
echo "</tr></form>";
}

View File

@ -76,19 +76,19 @@ function add_app() {
";
}
function show_form($show_deprecated) {
function show_form($all) {
echo "
<h2>Edit applications</h2>
";
$app_clause="deprecated=0";
$action_url="manage_apps.php";
if($show_deprecated) {
if($all) {
$app_clause = "";
$action_url="manage_apps.php?show_deprecated=1";
echo "<a href=\"manage_apps.php\">hide deprecated apps</a>";
$action_url="manage_apps.php?all=1";
echo "<a href=\"manage_apps.php\">Don't show deprecated applications</a>";
} else {
echo "<a href=\"manage_apps.php?show_deprecated=1\">show deprecated apps</a>";
echo "<a href=\"manage_apps.php?all=1\">Show deprecated applications</a>";
}
start_table();
@ -182,9 +182,9 @@ function show_form($show_deprecated) {
<input name='fraction_done_exact' type='checkbox' $v></TD>
";
if (!in_rops()) {
echo "<td><input class=\"btn btn-default\" type=submit name=submit value=Update>";
echo "<td><input class=\"btn btn-default\" type=submit name=submit value=Update></td>";
} else {
echo "<td>&nbsp;";
echo "<td>&nbsp;</td>";
}
echo "</tr></form>";
}
@ -194,6 +194,9 @@ function show_form($show_deprecated) {
// Entry form to create a new application
//
if (in_rops()) {
return;
}
echo"<P>
<h2>Add an application</h2>
@ -221,14 +224,14 @@ function show_form($show_deprecated) {
admin_page_head("Manage applications");
$show_deprecated = get_int('show_deprecated', true);
$all = get_int('all', true);
if (post_str('add_app', true)) {
add_app();
} else if (post_str('submit', true)) {
do_updates();
}
show_form($show_deprecated);
show_form($all);
admin_page_tail();
?>