Mutlilinguified Modules

This commit is contained in:
Nate Jones
2013-05-29 21:46:48 +00:00
parent 71998eff7b
commit 3fa4cbb720
4 changed files with 132 additions and 60 deletions

View File

@@ -34,6 +34,12 @@ else {
exit;
}
//add multi-lingual support
require_once "app_languages.php";
foreach($text as $key => $value) {
$text[$key] = $value[$_SESSION['domain']['language']['code']];
}
//determin the action add or update
if (isset($_REQUEST["id"])) {
$action = "update";
@@ -61,12 +67,12 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
}
//check for all required data
if (strlen($module_label) == 0) { $msg .= "Please provide: Label<br>\n"; }
if (strlen($module_name) == 0) { $msg .= "Please provide: Module Name<br>\n"; }
//if (strlen($module_description) == 0) { $msg .= "Please provide: Description<br>\n"; }
if (strlen($module_category) == 0) { $msg .= "Please provide: Module Category<br>\n"; }
if (strlen($module_enabled) == 0) { $msg .= "Please provide: Enabled<br>\n"; }
if (strlen($module_default_enabled) == 0) { $msg .= "Please provide: Default Enabled<br>\n"; }
if (strlen($module_label) == 0) { $msg .= $text['message-required'].$text['label-label']."<br>\n"; }
if (strlen($module_name) == 0) { $msg .= $text['message-required'].$text['label-module_name']."<br>\n"; }
//if (strlen($module_description) == 0) { $msg .= $text['message-required'].$text['label-description']."<br>\n"; }
if (strlen($module_category) == 0) { $msg .= $text['message-required'].$text['label-module_category']."<br>\n"; }
if (strlen($module_enabled) == 0) { $msg .= $text['message-required'].$text['label-enabled']."<br>\n"; }
if (strlen($module_default_enabled) == 0) { $msg .= $text['message-required'].$text['label-default_enabled']."<br>\n"; }
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
require_once "includes/header.php";
require_once "includes/persistformvar.php";
@@ -112,7 +118,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=modules.php\">\n";
echo "<div align='center'>\n";
echo "Add Complete\n";
echo $text['message-add']."\n";
echo "</div>\n";
require_once "includes/footer.php";
return;
@@ -135,7 +141,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=modules.php\">\n";
echo "<div align='center'>\n";
echo "Update Complete\n";
echo $text['message-update']."\n";
echo "</div>\n";
require_once "includes/footer.php";
return;
@@ -165,6 +171,12 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
//show the header
require_once "includes/header.php";
if ($action == "add") {
$page["title"] = $text['title-module_add'];
}
if ($action == "update") {
$page["title"] = $text['title-module_edit'];
}
//show the content
echo "<div align='center'>";
@@ -180,17 +192,17 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
echo "<tr>\n";
if ($action == "add") {
echo "<td align='left' width='30%' nowrap><b>Module Add</b></td>\n";
echo "<td align='left' width='30%' nowrap><b>".$text['header-module_add']."</b></td>\n";
}
if ($action == "update") {
echo "<td align='left' width='30%' nowrap><b>Module Update</b></td>\n";
echo "<td align='left' width='30%' nowrap><b>".$text['header-module_edit']."</b></td>\n";
}
echo "<td width='70%' align='right'><input type='button' class='btn' name='' alt='back' onclick=\"window.location='modules.php'\" value='Back'></td>\n";
echo "<td width='70%' align='right'><input type='button' class='btn' alt='".$text['button-back']."' onclick=\"window.location='modules.php'\" value='".$text['button-back']."'></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap>\n";
echo " Label:\n";
echo " ".$text['label-label'].":\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='module_label' maxlength='255' value=\"$module_label\">\n";
@@ -201,7 +213,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap>\n";
echo " Module Name:\n";
echo " ".$text['label-module_name'].":\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='module_name' maxlength='255' value=\"$module_name\">\n";
@@ -212,7 +224,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " Description:\n";
echo " ".$text['label-description'].":\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='module_description' maxlength='255' value=\"$module_description\">\n";
@@ -223,7 +235,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap>\n";
echo " Module Category:\n";
echo " ".$text['label-module_category'].":\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
$table_name = 'v_modules';$field_name = 'module_category';$sql_where_optional = "";$field_current_value = $module_category;
@@ -235,22 +247,22 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap>\n";
echo " Enabled:\n";
echo " ".$text['label-enabled'].":\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select class='formfld' name='module_enabled'>\n";
echo " <option value=''></option>\n";
if ($module_enabled == "true") {
echo " <option value='true' SELECTED >true</option>\n";
if ($module_enabled == "true") {
echo " <option value='true' SELECTED >".$text['option-true']."</option>\n";
}
else {
echo " <option value='true'>true</option>\n";
echo " <option value='true'>".$text['option-true']."</option>\n";
}
if ($module_enabled == "false") {
echo " <option value='false' SELECTED >false</option>\n";
if ($module_enabled == "false") {
echo " <option value='false' SELECTED >".$text['option-false']."</option>\n";
}
else {
echo " <option value='false'>false</option>\n";
echo " <option value='false'>".$text['option-false']."</option>\n";
}
echo " </select>\n";
echo "<br />\n";
@@ -260,22 +272,22 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap>\n";
echo " Default Enabled:\n";
echo " ".$text['label-default_enabled'].":\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select class='formfld' name='module_default_enabled'>\n";
echo " <option value=''></option>\n";
if ($module_default_enabled == "true") {
echo " <option value='true' SELECTED >true</option>\n";
if ($module_default_enabled == "true") {
echo " <option value='true' SELECTED >".$text['option-true']."</option>\n";
}
else {
echo " <option value='true'>true</option>\n";
echo " <option value='true'>".$text['option-true']."</option>\n";
}
if ($module_default_enabled == "false") {
echo " <option value='false' SELECTED >false</option>\n";
if ($module_default_enabled == "false") {
echo " <option value='false' SELECTED >".$text['option-false']."</option>\n";
}
else {
echo " <option value='false'>false</option>\n";
echo " <option value='false'>".$text['option-false']."</option>\n";
}
echo " </select>\n";
echo "<br />\n";
@@ -287,7 +299,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
if ($action == "update") {
echo " <input type='hidden' name='module_uuid' value='$module_uuid'>\n";
}
echo " <input type='submit' name='submit' class='btn' value='Save'>\n";
echo " <input type='submit' name='submit' class='btn' value='".$text['button-save']."'>\n";
echo " </td>\n";
echo " </tr>";
echo "</table>";