Refactor wizard forms by NB-Core · Pull Request #13 · NB-Core/modules · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions systems/translationwizard/translationwizard/changescheme.php
9 changes: 5 additions & 4 deletions systems/translationwizard/translationwizard/deleteempty.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,20 @@
default: //if the user hits the button just to check for duplicates
$sql= "SELECT intext, language FROM ".db_prefix("untranslated")." WHERE namespace='' GROUP BY BINARY intext, language";
$result = db_query($sql);
rawoutput("<form action='runmodule.php?module=translationwizard&op=deleteempty&mode=delete' method='post'>");
tw_form_open("deleteempty&mode=delete");
addnav("", "runmodule.php?module=translationwizard&op=deleteempty&mode=delete");
rawoutput("<input type='hidden' name='op' value='check'>");
output("`n`n %s rows have been found with no namespace in your untranslated table.`n`n",db_num_rows($result));
if (db_num_rows($result)==0) //table is fine, no redundant rows
{
output("Congratulations! Your untranslated table does not have any rows with an empty namespace!");
rawoutput("</form");
tw_form_close();
break;
}
output("What do you want to do?`n`n`n`n");
rawoutput("<input type='submit' name='deleteall' value='". translate_inline("Delete multiple automatically") ."' class='button'>");
rawoutput("<input type='submit' name='listing' value='". translate_inline("Delete manually") ."' class='button'></form>");
rawoutput("<input type='submit' name='deleteall' value='". translate_inline("Delete multiple automatically") ."' class='button'>");
rawoutput("<input type='submit' name='listing' value='". translate_inline("Delete manually") ."' class='button'>");
tw_form_close();
output("`b`i`$ Attention, no additional confirmation`i`b`0");
break;
}
Expand Down
4 changes: 2 additions & 2 deletions systems/translationwizard/translationwizard/edit_single.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
declare(strict_types=1);
if ($from=="") $from="module=translationwizard&op=list";
rawoutput("<form action='runmodule.php?".$from."&mode=save&from=".rawurlencode($from)."' method='post'>");
tw_form_open($from."&mode=save&from=".rawurlencode($from));
addnav("", "runmodule.php?".$from."&mode=save&from=".rawurlencode($from));
$sql = "SELECT namespace,count(*) AS c FROM " . db_prefix("untranslated") . " WHERE language='".$languageschema."' GROUP BY namespace ORDER BY namespace ASC";
$result = db_query($sql);
Expand All @@ -23,5 +23,5 @@
rawoutput(translate_inline("Translation:"). "<br>");
rawoutput("<textarea name='outtext' class='input' cols='60' rows='5'>".htmlentities(stripslashes(httpget('outtext')),ENT_COMPAT,$coding)."</textarea><br/>");
rawoutput("<input type='submit' value='". translate_inline("Save") ."' class='button'>");
rawoutput("</form>");
tw_form_close();
?>
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@
}
output_notl("`n`n");
rawoutput("<input type='submit' name='multichecked' value='". translate_inline("Save") ."' class='button'>");
rawoutput("</form>");
tw_form_close();

?>
4 changes: 2 additions & 2 deletions systems/translationwizard/translationwizard/fix.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
$result=db_query($sql);
if (db_num_rows($result)>0)
{
rawoutput("<form action='runmodule.php?module=translationwizard&op=fix&mode=fix' method='post'>");
tw_form_open("fix&mode=fix");
addnav("", "runmodule.php?module=translationwizard&op=fix&mode=fix");
output("`0There are %s entries who already have a translation in the translations table.`n`n",db_num_rows($result));
output("`0This operation will delete already translated parts from the untranslated table.`n`n`b`$ This operation can't be made undone!`b`0`n`n");
Expand All @@ -47,7 +47,7 @@
{
output("Congratulations! Your translation table does not have any redundant entries!");
}
rawoutput("</form>");
tw_form_close();
break;
}
?>
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@
output_notl("`n");
output("This may take some time.");
output_notl("`n`n");
rawoutput("<form action='runmodule.php?module=translationwizard&op=insert_central&mode=continue' method='post'>");
tw_form_open("insert_central&mode=continue");
addnav("", "runmodule.php?module=translationwizard&op=insert_central&mode=continue");
rawoutput("<input type='submit' name='continue' value='". translate_inline("Commence the process")."' class='button'>");
rawoutput("</form>");
tw_form_close();
} else {
output("The pulled translations is empty, there is nothing to do!");
}
Expand Down
14 changes: 7 additions & 7 deletions systems/translationwizard/translationwizard/known.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@
if ($central) output("`nSorry, all rows in the pulled translations table have no match in any intext in your translations table.");
break;
}
rawoutput("<form action='runmodule.php?module=translationwizard&op=known$redirect' method='post'>");
tw_form_open("known$redirect");
addnav("", "runmodule.php?module=translationwizard&op=known$redirect");
if (!httppost('quickinsert'))
{
Expand All @@ -157,7 +157,7 @@
rawoutput("<input type='submit' name='quickinsertexecute' value='". translate_inline("Quick Insert Execution") ."' class='button'>");
rawoutput("<input type='hidden' name='quickinsert' value='1' class='button'>");
}
rawoutput("</form>");
tw_form_close();
$fastinsert=$result; //use the full result for insert purposes if the user wishes for, related to button -quick insert-
$sql.=" LIMIT $start,$page;";
//debug("Start: $start and $page and $numberofallrows");
Expand Down Expand Up @@ -222,7 +222,7 @@
rawoutput("</table>");

} else if (db_num_rows($result)>0) {
rawoutput("<form action='runmodule.php?module=translationwizard&op=known&mode=radioinsert$redirect' method='post'>");
tw_form_open("known&mode=radioinsert$redirect");
addnav("", "runmodule.php?module=translationwizard&op=known&mode=radioinsert$redirect");
rawoutput("<table border='0' cellpadding='2' cellspacing='0'>");
rawoutput("<tr class='trhead'><td>". translate_inline("Language") ."</td><td>". translate_inline("Original") ."</td><td>".translate_inline("Module / Translation")."</td><td>".translate_inline("Author")."</td><td>".translate_inline("Actions")."</td><td></td></tr>");
Expand Down Expand Up @@ -265,10 +265,10 @@
//if ($i>$page) break; //would need previous/next page and one more if which needs too much time. better to get all now
}
}
rawoutput("</table>");
rawoutput("<input type='submit' value='". translate_inline("Insert checked translations") ."' class='button'>");
rawoutput("</form>");
}
rawoutput("</table>");
rawoutput("<input type='submit' value='". translate_inline("Insert checked translations") ."' class='button'>");
tw_form_close();
}

}
?>
2 changes: 1 addition & 1 deletion systems/translationwizard/translationwizard/list.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
require("./modules/translationwizard/deletechecked.php"); //if you want to delete the checked translations, this commences the deletion process
}
if (httppost("editchecked")) {
rawoutput("<form action='runmodule.php?module=translationwizard&op=list&ns=".rawurlencode($namespace)."' method='post'>");
tw_form_open("list&ns=".rawurlencode($namespace));
addnav("", "runmodule.php?module=translationwizard&op=list&ns=".rawurlencode($namespace));
$sql = "SELECT namespace,count(*) AS c FROM " . db_prefix("untranslated") . " WHERE language='".$languageschema."' GROUP BY namespace ORDER BY namespace ASC";
$result = db_query($sql);
Expand Down
4 changes: 2 additions & 2 deletions systems/translationwizard/translationwizard/push.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
output_notl("`n`n");
$sql = "SELECT uri,count(*) AS c FROM " . db_prefix("translations") . " WHERE language='".$selectedlanguage."' GROUP BY uri ORDER BY uri ASC";
$res=db_query($sql);
rawoutput("<form action='runmodule.php?module=translationwizard&op=push&mode=push' method='post'>");
tw_form_open("push&mode=push");
addnav("", "runmodule.php?module=translationwizard&op=push&mode=push");
rawoutput("<input type='hidden' name='op' value='push'>");
rawoutput("<input type='hidden' name='mode' value='push'>");
Expand All @@ -27,7 +27,7 @@
rawoutput("<option value=\"".htmlentities($row['uri'],ENT_COMPAT,$coding)."\"".((htmlentities($row['uri'],ENT_COMPAT,$coding) == $namespace) ? "selected" : "").">".htmlentities($row['uri'],ENT_COMPAT,$coding)." ({$row['c']})</option>");
}
rawoutput("</select>");
rawoutput("</form>");
tw_form_close();
output_notl("`n`n");
output_notl($currentdate." Verified "."Uploader:".$session['user']['login']." Time:".$currenttime);
$start="('";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
TranslationWizard::insertFile($transintext,$languageschema,true);
redirect('runmodule.php?module=translationwizard&op=scanmodules&error=1'); //back to the roots, no error but success
} else { //if edit button was pushed
rawoutput("<form action='runmodule.php?module=translationwizard&op=scanmodules&mode=saveedited' method='post'>");
tw_form_open("scanmodules&mode=saveedited");
addnav("", "runmodule.php?module=translationwizard&op=scanmodules&mode=saveedited");
//rawoutput("<input type='submit' class='button' value='". translate_inline("Show") ."'>"); //no longer necessary
require("./modules/translationwizard/editchecked.php"); //if you want to edit some translations at a time
Expand Down
8 changes: 4 additions & 4 deletions systems/translationwizard/translationwizard/searchandedit.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ function check() {
//end
if (db_num_rows($result)>1) rawoutput("<input type='button' onClick='this.value=check()' name='allcheck' value='". $all ."' class='button'>");
rawoutput("<input type='submit' name='deletechecked' value='". translate_inline("Delete selected") ."' class='button'>");
rawoutput("</form>");
tw_form_close();
break;

case "edit":
Expand All @@ -158,7 +158,7 @@ function check() {
output_notl(" ");
output("If you want to abort, just click abort (or any other navigation except 'save'.");
output_notl("`n`n");
rawoutput("<form action='runmodule.php?module=translationwizard&op=searchandedit&mode=save' method='post'>");
tw_form_open("searchandedit&mode=save");
addnav("", "runmodule.php?module=translationwizard&op=searchandedit&mode=save");
output("TID of the row:");
rawoutput("<input id='input' name='tid' width=5 maxlength=5 value='".$row['tid']."'>");
Expand Down Expand Up @@ -186,7 +186,7 @@ function check() {
rawoutput("<input type='submit' name='select' value='". translate_inline("Save")."' class='button'>");
output("`b`$ ATTENTION`b`0");
rawoutput("<input type='submit' name='abort' value='". translate_inline("Abort")."' class='button'>");
rawoutput("</form>");
tw_form_close();
break;

case "save":
Expand Down Expand Up @@ -252,7 +252,7 @@ function check() {
output_notl(" ");
output("If you don't want that, just hit the checkbox below. You may use ?,% or the like in the text.");
output_notl("`n`n");
rawoutput("<form action='runmodule.php?module=translationwizard&op=searchandedit&mode=select' method='post'>");
tw_form_open("searchandedit&mode=select");
addnav("", "runmodule.php?module=translationwizard&op=searchandedit&mode=select");
output("What do you want to search for (select enter one or more criteria):");
output_notl("`n`n");
Expand Down
12 changes: 6 additions & 6 deletions systems/translationwizard/translationwizard/searchandreplace.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ function check() {
//end
if (db_num_rows($result)>1) rawoutput("<input type='button' onClick='this.value=check()' name='allcheck' value='". $all ."' class='button'>");
rawoutput("<input type='submit' name='replacechecked' value='". translate_inline("Replace in selected") ."' class='button'>");
rawoutput("</form>");
tw_form_close();
break;

case "edit":
Expand All @@ -158,7 +158,7 @@ function check() {
output_notl(" ");
output("If you want to abort, just click abort (or any other navigation except 'save'.");
output_notl("`n`n");
rawoutput("<form action='runmodule.php?module=translationwizard&op=searchandreplace&mode=save' method='post'>");
tw_form_open("searchandreplace&mode=save");
addnav("", "runmodule.php?module=translationwizard&op=searchandreplace&mode=save");
output("TID of the row:");
rawoutput("<input id='input' name='tid' width=5 maxlength=5 value='".$row['tid']."'>");
Expand All @@ -184,7 +184,7 @@ function check() {
rawoutput("<input type='submit' name='select' value='". translate_inline("Save")."' class='button'>");
output("`b`$ ATTENTION`b`0");
rawoutput("<input type='submit' name='abort' value='". translate_inline("Abort")."' class='button'>");
rawoutput("</form>");
tw_form_close();
break;

case "save":
Expand Down Expand Up @@ -263,7 +263,7 @@ function check() {
output_notl(" ");
output("If you don't want that, just hit the checkbox below. You may use ?,% or the like in the text.");
output_notl("`n`n");
rawoutput("<form action='runmodule.php?module=translationwizard&op=searchandreplace&mode=select' method='post'>");
tw_form_open("searchandreplace&mode=select");
addnav("", "runmodule.php?module=translationwizard&op=searchandreplace&mode=select");
output("What do you want to search for (select enter one or more criteria):");
output_notl("`n`n");
Expand Down Expand Up @@ -339,7 +339,7 @@ function check() {
rawoutput("<input id='input' name='rversion' width=20 maxlength=50 value='".$query['rversion']."'>");
rawoutput("<input id='input' name='rversion2' width=20 maxlength=50 value='".$query['rversion2']."'>");

rawoutput("<input type='submit' name='select' value='". translate_inline("Preview")."' class='button'>");
rawoutput("</form>");
rawoutput("<input type='submit' name='select' value='". translate_inline("Preview")."' class='button'>");
tw_form_close();
}
?>
7 changes: 4 additions & 3 deletions systems/translationwizard/translationwizard/truncate.php