initializing git repo
4
.gitignore
vendored
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
config.php
|
||||
downloads/
|
||||
pictures/
|
||||
log/
|
||||
BIN
documentation/German/DeveloperGuide.odt
Executable file
BIN
documentation/German/DeveloperGuide.pdf
Executable file
31
includes/globals.php
Executable file
|
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
|
||||
$GlobalDebungMode = 1;
|
||||
|
||||
$GlobalLogfile = "";
|
||||
$GlobalLogfileMaxLength = 1000;
|
||||
|
||||
$GlobalTimeZone = "";
|
||||
$GlobalTimeFormat = "";
|
||||
|
||||
$GlobalRootPassword = "";
|
||||
|
||||
$GlobalTemplate = "";
|
||||
$GlobalLanguage = "";
|
||||
|
||||
$GlobalContent = "";
|
||||
|
||||
$GlobalMysqlHost = "";
|
||||
$GlobalMysqlUser = "";
|
||||
$GlobalMysqlPwd = "";
|
||||
$GlobalMysqlHandler = 0;
|
||||
$GlobalMysqlDatabase = "";
|
||||
|
||||
$GlobalLockAutoReleaseTime=3600;
|
||||
|
||||
$GlobalDownloadDir = "./downloads";
|
||||
$GlobalPictureDir = "./pictures";
|
||||
|
||||
$GlobalDecimalPoint="."
|
||||
|
||||
?>
|
||||
19
includes/java_scripts.php
Executable file
|
|
@ -0,0 +1,19 @@
|
|||
<script type="text/javascript" language="JavaScript">
|
||||
<!--
|
||||
function ToggleDisplayStyle(ElementId)
|
||||
{
|
||||
var Element=document.getElementById(ElementId);
|
||||
|
||||
if(!Element)
|
||||
return true;
|
||||
|
||||
if(Element.style.display=="none")
|
||||
Element.style.display="block";
|
||||
else
|
||||
Element.style.display="none";
|
||||
|
||||
return true;
|
||||
}
|
||||
//-->
|
||||
</script>
|
||||
|
||||
68
includes/language.php
Executable file
|
|
@ -0,0 +1,68 @@
|
|||
<?php
|
||||
|
||||
function LangStr2Html ( $String )
|
||||
{
|
||||
$String = nl2br(htmlspecialchars($String,ENT_QUOTES));
|
||||
|
||||
//umlauts
|
||||
$String = str_replace("ß","ß",$String);
|
||||
$String = str_replace("ä","ä",$String);
|
||||
$String = str_replace("ö","ö",$String);
|
||||
$String = str_replace("ü","ü",$String);
|
||||
$String = str_replace("Ä","Ä",$String);
|
||||
$String = str_replace("Ö","Ö",$String);
|
||||
$String = str_replace("Ü","Ü",$String);
|
||||
return $String;
|
||||
}
|
||||
|
||||
function LangSpellHtml ( $Sentence )
|
||||
{
|
||||
return LangStr2Html(LangSpell($Sentence));
|
||||
}
|
||||
|
||||
function LangSpell ( $Sentence )
|
||||
{
|
||||
global $GlobalLanguage;
|
||||
|
||||
$ReturnValue="";
|
||||
|
||||
if (file_exists("./languages/$GlobalLanguage.lng"))
|
||||
$Language = file ("./languages/$GlobalLanguage.lng");
|
||||
else
|
||||
{
|
||||
ErrorLog("[language.php] File \"./languages/$GlobalLanguage.lng\" not found!");
|
||||
}
|
||||
|
||||
foreach ( $Language as $i )
|
||||
{
|
||||
$FileSentence=explode("=",$i,2);
|
||||
if ( trim( $FileSentence[0] ) == $Sentence )
|
||||
{
|
||||
$ReturnValue=trim($FileSentence[1]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$ReturnValue)
|
||||
{
|
||||
ErrorLog("[$GlobalLanguage.lng] Sentence \"$Sentence\" not found!");
|
||||
$ReturnValue=$Sentence;
|
||||
}
|
||||
|
||||
return $ReturnValue;
|
||||
}
|
||||
|
||||
function LangGetAvailableLanguages ()
|
||||
{
|
||||
$ReturnValue=array();
|
||||
$DirList=scandir('./languages/');
|
||||
foreach ($DirList as $i)
|
||||
{
|
||||
$SplitString=explode(".",$i);
|
||||
if ($i[0]=="." || strtolower($SplitString[1])!="lng")
|
||||
continue;
|
||||
$ReturnValue[count($ReturnValue)]=$SplitString[0];
|
||||
}
|
||||
return $ReturnValue;
|
||||
}
|
||||
?>
|
||||
39
includes/load_config.php
Executable file
|
|
@ -0,0 +1,39 @@
|
|||
<?php
|
||||
|
||||
//load config to global vars
|
||||
include("./config.php");
|
||||
|
||||
if (strtolower($CfgSetDebugMode)=="true")
|
||||
{
|
||||
error_reporting(E_ALL);
|
||||
ini_set('display_errors', 1);
|
||||
global $GlobalDebungMode;
|
||||
$GlobalDebungMode = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
global $GlobalDebungMode;
|
||||
$GlobalDebungMode = 0;
|
||||
}
|
||||
|
||||
$GlobalLogfile = $CfgLogfile;
|
||||
$GlobalLogfileMaxLength = $CfgLogfileMaxLines;
|
||||
|
||||
$GlobalTimeZone = $CfgStdTimeZone;
|
||||
$GlobalTimeFormat = $CfgStdTimeFormat;
|
||||
|
||||
$GlobalRootPassword = $CfgRootPassword;
|
||||
|
||||
$GlobalTemplate = $CfgStdTemplate;
|
||||
$GlobalLanguage = $CfgStdLanguage;
|
||||
|
||||
$GlobalMysqlHost = $CfgMysqlHost;
|
||||
$GlobalMysqlUser = $CfgMysqlUser;
|
||||
$GlobalMysqlPwd = $CfgMysqlPwd;
|
||||
$GlobalMysqlDatabase = $CfgMysqlDatabase;
|
||||
|
||||
$GlobalUserTimeout = $CfgLoginTimeout;
|
||||
|
||||
$GlobalLockAutoReleaseTime = $CfgLockAutoReleaseTime;
|
||||
|
||||
?>
|
||||
65
includes/lock.php
Executable file
|
|
@ -0,0 +1,65 @@
|
|||
<?php
|
||||
|
||||
function LockIsActive($Table,$Id)
|
||||
{
|
||||
$Ret=1;
|
||||
global $GlobalMysqlHandler;
|
||||
global $GlobalLockAutoReleaseTime;
|
||||
|
||||
$LockQuery="SELECT `LockId`, `LockTime` FROM `$Table` WHERE `Id` = $Id";
|
||||
$LockQuery=mysqli_query($GlobalMysqlHandler, $LockQuery);
|
||||
|
||||
if ($LockQuery)
|
||||
{
|
||||
if (mysqli_num_rows($LockQuery))
|
||||
{
|
||||
$Lock = mysqli_fetch_array($LockQuery);
|
||||
if (!$Lock['LockId']
|
||||
|| ($Lock['LockId']==UserGetId())
|
||||
|| ($Lock['LockTime']<(time()-$GlobalLockAutoReleaseTime))
|
||||
)
|
||||
{ $Ret=0; }
|
||||
}
|
||||
else
|
||||
{ $Ret=0; }
|
||||
}
|
||||
else
|
||||
{ ErrorLog("[lock.php] Can not fetch lock fields in table \"$Table\" at id $Id"); }
|
||||
|
||||
return $Ret;
|
||||
}
|
||||
|
||||
function LockActivate($Table,$Id)
|
||||
{
|
||||
$Ret=0;
|
||||
global $GlobalMysqlHandler;
|
||||
|
||||
if (!LockIsActive($Table,$Id))
|
||||
{
|
||||
$LockQuery="UPDATE `$Table` SET `LockId` = '".UserGetId()."', `LockTime` = '".time()."' WHERE `Id` =$Id";
|
||||
if (mysqli_query($GlobalMysqlHandler, $LockQuery))
|
||||
{ $Ret=1; }
|
||||
else
|
||||
{ ErrorLog("[lock.php] Can not update lock fields in table \"$Table\" at id $Id"); }
|
||||
}
|
||||
|
||||
return $Ret;
|
||||
}
|
||||
|
||||
function LockRelease($Table,$Id)
|
||||
{
|
||||
$Ret=0;
|
||||
global $GlobalMysqlHandler;
|
||||
|
||||
if (!LockIsActive($Table,$Id))
|
||||
{
|
||||
$LockQuery="UPDATE `$Table` SET `LockId` = '0', `LockTime` = '0' WHERE `Id` =$Id";
|
||||
if (mysqli_query($GlobalMysqlHandler, $LockQuery))
|
||||
{ $Ret=1; }
|
||||
else
|
||||
{ ErrorLog("[lock.php] Can not update lock fields in table \"$Table\" at id $Id"); }
|
||||
}
|
||||
|
||||
return $Ret;
|
||||
}
|
||||
?>
|
||||
60
includes/log.php
Executable file
|
|
@ -0,0 +1,60 @@
|
|||
<?php
|
||||
|
||||
$LogLineArray = array();
|
||||
$LogFirstLineWritten = 0;
|
||||
|
||||
function ErrorLog ($Msg)
|
||||
{
|
||||
global $LogLineArray;
|
||||
global $LogFirstLineWritten;
|
||||
$LogFirstLineWritten = 1;
|
||||
$LogLineArray[count($LogLineArray)]=LogFormatMessage($Msg);
|
||||
$Dbg=debug_backtrace();
|
||||
for ($i=0; $i<count($Dbg);$i++) $LogLineArray[count($LogLineArray)]= " - (Callstack $i) ".$Dbg[$i]['file'].":".$Dbg[$i]['line']."\n";
|
||||
}
|
||||
|
||||
function LogWriteToFile ()
|
||||
{
|
||||
global $LogLineArray;
|
||||
global $GlobalLogfile;
|
||||
global $LogFirstLineWritten;
|
||||
global $GlobalLogfileMaxLength;
|
||||
|
||||
if ($GlobalLogfile && $LogFirstLineWritten)
|
||||
{
|
||||
//read existing file
|
||||
$ExistingFileArray=array();
|
||||
if (file_exists($GlobalLogfile))
|
||||
$ExistingFileArray=file($GlobalLogfile);
|
||||
|
||||
//merge both line arrays
|
||||
$ExistingFileArray[count($ExistingFileArray)]="\n";
|
||||
foreach ($LogLineArray as $x)
|
||||
$ExistingFileArray[count($ExistingFileArray)]=$x;
|
||||
|
||||
//save to file
|
||||
$FileHandler=fopen($GlobalLogfile,'w');
|
||||
$Length=count($ExistingFileArray);
|
||||
for ($i= (($Length>$GlobalLogfileMaxLength) ? $Length-$GlobalLogfileMaxLength:0); $i<$Length;$i++)
|
||||
fputs($FileHandler,$ExistingFileArray[$i]);
|
||||
fclose($FileHandler);
|
||||
}
|
||||
}
|
||||
|
||||
function LogClose ()
|
||||
{
|
||||
LogWriteToFile();
|
||||
}
|
||||
|
||||
function LogFormatMessage ($Msg)
|
||||
{
|
||||
global $GlobalTimeZone;
|
||||
global $GlobalTimeFormat;
|
||||
date_default_timezone_set($GlobalTimeZone);
|
||||
$NewMsg = "";
|
||||
$NewMsg .= "[".date($GlobalTimeFormat,time())."]";
|
||||
$NewMsg .= $Msg . "\n";
|
||||
return $NewMsg;
|
||||
}
|
||||
|
||||
?>
|
||||
41
includes/message.php
Executable file
|
|
@ -0,0 +1,41 @@
|
|||
<?php
|
||||
$MessageErrorMsg="";
|
||||
$MessageWarningMsg="";
|
||||
$MessageSuccessMsg="";
|
||||
|
||||
function MessageError($Msg)
|
||||
{
|
||||
global $MessageErrorMsg;
|
||||
$MessageErrorMsg.=$Msg."\n";
|
||||
}
|
||||
|
||||
function MessageWarning($Msg)
|
||||
{
|
||||
global $MessageWarningMsg;
|
||||
$MessageWarningMsg.=$Msg."\n";
|
||||
}
|
||||
|
||||
function MessageSuccess($Msg)
|
||||
{
|
||||
global $MessageSuccessMsg;
|
||||
$MessageSuccessMsg.=$Msg."\n";
|
||||
}
|
||||
|
||||
function MessageGetErrors()
|
||||
{
|
||||
global $MessageErrorMsg;
|
||||
return $MessageErrorMsg;
|
||||
}
|
||||
|
||||
function MessageGetWarnings()
|
||||
{
|
||||
global $MessageWarningMsg;
|
||||
return $MessageWarningMsg;
|
||||
}
|
||||
|
||||
function MessageGetSuccess()
|
||||
{
|
||||
global $MessageSuccessMsg;
|
||||
return $MessageSuccessMsg;
|
||||
}
|
||||
?>
|
||||
28
includes/mysql.php
Executable file
|
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
|
||||
$MysqlErrorsArePresent = 0;
|
||||
$GlobalMysqlHandler=mysqli_connect($GlobalMysqlHost,$GlobalMysqlUser,$GlobalMysqlPwd);
|
||||
|
||||
if (!$GlobalMysqlHandler)
|
||||
{
|
||||
ErrorLog("[mysql.php] Can not connect to mysql database \"$GlobalMysqlHost\" as \"$GlobalMysqlUser\"!");
|
||||
$MysqlErrorsArePresent = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!mysqli_select_db($GlobalMysqlHandler, $GlobalMysqlDatabase))
|
||||
{
|
||||
ErrorLog("[mysql.php] Can not select mysql database \"$GlobalMysqlDatabase\"!");
|
||||
$MysqlErrorsArePresent = 2;
|
||||
}
|
||||
}
|
||||
|
||||
if ($MysqlErrorsArePresent)
|
||||
MessageError(LangSpellHtml('SentenceDatabaseError'));
|
||||
|
||||
function MysqlCloseDb ()
|
||||
{
|
||||
global $GlobalMysqlHandler;
|
||||
mysqli_close($GlobalMysqlHandler);
|
||||
}
|
||||
?>
|
||||
173
includes/nested_list_functions.php
Executable file
|
|
@ -0,0 +1,173 @@
|
|||
<?php
|
||||
|
||||
///////////
|
||||
//logistics
|
||||
function NestedListGetParentId($Id, $TableName)
|
||||
{
|
||||
if (!$TableName || !$Id) return 0;
|
||||
$ReturnValue=0;
|
||||
global $GlobalMysqlHandler;
|
||||
|
||||
$Query = "SELECT `ParentId` FROM `$TableName` WHERE `Id` =$Id";
|
||||
$Query = mysqli_query($GlobalMysqlHandler, $Query);
|
||||
|
||||
if (mysqli_num_rows($Query))
|
||||
{
|
||||
$Data=mysqli_fetch_array($Query);
|
||||
$ReturnValue=$Data['ParentId'];
|
||||
}
|
||||
else
|
||||
{
|
||||
ErrorLog("[nested_list_functions.php] No table element found at id $Id in table \"$Table\"!");
|
||||
}
|
||||
|
||||
return $ReturnValue;
|
||||
}
|
||||
|
||||
function NestedListGetName($Id, $TableName)
|
||||
{
|
||||
if (!$TableName || !$Id) return "";
|
||||
$ReturnValue="";
|
||||
global $GlobalMysqlHandler;
|
||||
|
||||
$Query = "SELECT `Name` FROM `$TableName` WHERE `Id` =$Id";
|
||||
$Query = mysqli_query($GlobalMysqlHandler, $Query);
|
||||
|
||||
if (mysqli_num_rows($Query))
|
||||
{
|
||||
$Data=mysqli_fetch_array($Query);
|
||||
$ReturnValue=$Data['Name'];
|
||||
}
|
||||
else
|
||||
{
|
||||
ErrorLog("[nested_list_functions.php] No table element found at id $Id in table \"$Table\"!");
|
||||
}
|
||||
|
||||
return $ReturnValue;
|
||||
}
|
||||
|
||||
|
||||
function NestedLisGetSubelements ($ParentId, $TableName)
|
||||
{
|
||||
if (!$TableName) return 0;
|
||||
$ReturnValue=array();
|
||||
global $GlobalMysqlHandler;
|
||||
|
||||
$Query = "SELECT `Id`,`Name` FROM `$TableName` WHERE `ParentId` = $ParentId";
|
||||
$Query = mysqli_query($Query,$GlobalMysqlHandler);
|
||||
while ($Item = mysqli_fetch_row($Query))
|
||||
{
|
||||
$counter=count($ReturnValue);
|
||||
$ReturnValue[$counter][0] = $Item[0];
|
||||
$ReturnValue[$counter][1] = $Item[1];
|
||||
}
|
||||
|
||||
return $ReturnValue;
|
||||
}
|
||||
|
||||
/////////////
|
||||
// statistics
|
||||
|
||||
function NestedListCountSubElements($ParentId, $TableName)
|
||||
{
|
||||
if (!$TableName) return 0;
|
||||
$ReturnValue=1;
|
||||
global $GlobalMysqlHandler;
|
||||
|
||||
$Query = "SELECT * FROM `$TableName` WHERE `ParentId` =$ParentId";
|
||||
$Query = mysqli_query($GlobalMysqlHandler, $Query);
|
||||
|
||||
$ReturnValue=mysqli_num_rows($Query);
|
||||
|
||||
return $ReturnValue;
|
||||
}
|
||||
|
||||
///////////////////////////
|
||||
//list-visibility functions
|
||||
|
||||
function NestedListVisibilityToggle ($Id, $ListIdentifier)
|
||||
{
|
||||
if (!$Id || !$ListIdentifier) return;
|
||||
if (!isset($_SESSION[$ListIdentifier]))
|
||||
{
|
||||
$EmptyArray = array();
|
||||
$_SESSION[$ListIdentifier] = $EmptyArray;
|
||||
}
|
||||
|
||||
$IdArray = $_SESSION[$ListIdentifier];
|
||||
if (NestedListVisibilityIsSet($Id, $ListIdentifier)) $IdArray[$Id] = "False";
|
||||
else $IdArray[$Id] = "True";
|
||||
$_SESSION[$ListIdentifier]=$IdArray;
|
||||
}
|
||||
|
||||
function NestedListVisibilitySetAllParents ($Id, $ListIdentifier, $TableName)
|
||||
{
|
||||
global $GlobalMysqlHandler;
|
||||
while ($Id)
|
||||
{
|
||||
$Query="SELECT `ParentId` FROM `$TableName` WHERE `Id` = $Id";
|
||||
$Query=mysqli_query($GlobalMysqlHandler, $Query);
|
||||
if (mysqli_num_rows($Query))
|
||||
{
|
||||
$Item=mysqli_fetch_array($Query);
|
||||
$Id=$Item['ParentId'];
|
||||
NestedListVisibilitySet ($Id,$ListIdentifier);
|
||||
}
|
||||
else
|
||||
{
|
||||
ErrorLog("[nested_list_functions.php] No id '$Id' found in table '$TableName'!");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function NestedListVisibilitySet ($Id, $ListIdentifier)
|
||||
{
|
||||
if (!NestedListVisibilityIsSet($Id, $ListIdentifier)) NestedListVisibilityToggle ($Id, $ListIdentifier);
|
||||
}
|
||||
|
||||
function NestedListVisibilityUnset ($Id, $ListIdentifier)
|
||||
{
|
||||
if (NestedListVisibilityIsSet($Id, $ListIdentifier)) NestedListVisibilityToggle ($Id, $ListIdentifier);
|
||||
}
|
||||
|
||||
function NestedListVisibilityIsSet ($Id, $ListIdentifier)
|
||||
{
|
||||
if (!$Id || !$ListIdentifier || !isset($_SESSION[$ListIdentifier])) return 0;
|
||||
$IdArray = $_SESSION[$ListIdentifier];
|
||||
//$Ret = ((count($IdArray)>=$Id) && (strtolower($IdArray[$Id])=="true")) ? 1:0;
|
||||
$Ret = (isset($IdArray[$Id]) && (strtolower($IdArray[$Id])=="true")) ? 1:0;
|
||||
return $Ret;
|
||||
}
|
||||
|
||||
function NestedListVisibilityUnsetAllSubelements ($ParentId, $ListIdentifier, $TableName)
|
||||
{
|
||||
if (!$TableName) return 0;
|
||||
$ReturnValue=1;
|
||||
global $GlobalMysqlHandler;
|
||||
|
||||
$Query = "SELECT * FROM `$TableName` WHERE `ParentId` =$ParentId";
|
||||
$Query = mysqli_query($GlobalMysqlHandler, $Query);
|
||||
while ($Item = mysqli_fetch_array($Query))
|
||||
{
|
||||
NestedListVisibilityUnset ($Item['Id'], $ListIdentifier);
|
||||
}
|
||||
|
||||
return $ReturnValue;
|
||||
}
|
||||
|
||||
function NestedListVisibilityUnsetAllElements ($ListIdentifier)
|
||||
{
|
||||
if (!$ListIdentifier) return;
|
||||
if (!isset($_SESSION[$ListIdentifier]))
|
||||
{
|
||||
$EmptyArray = array();
|
||||
$_SESSION[$ListIdentifier] = $EmptyArray;
|
||||
}
|
||||
|
||||
$IdArray = $_SESSION[$ListIdentifier];
|
||||
for ($i=0; $i < count($IdArray); $i++) $IdArray[$i] = "False";
|
||||
$_SESSION[$ListIdentifier]=$IdArray;
|
||||
}
|
||||
|
||||
?>
|
||||
132
includes/other_functions.php
Executable file
|
|
@ -0,0 +1,132 @@
|
|||
<?php
|
||||
|
||||
function OtherGetAvailableTemplates ()
|
||||
{
|
||||
$ReturnValue=array();
|
||||
$DirList=scandir('./templates/');
|
||||
foreach ($DirList as $i)
|
||||
{
|
||||
if (!is_dir('./templates/'.$i) || (substr($i,0,1)=="."))
|
||||
continue;
|
||||
$ReturnValue[count($ReturnValue)]=$i;
|
||||
}
|
||||
return $ReturnValue;
|
||||
}
|
||||
|
||||
function OtherFormatPrice ($PriceString)
|
||||
{
|
||||
global $GlobalDecimalPoint;
|
||||
return str_replace(".",$GlobalDecimalPoint,sprintf("%.3f",OtherConvertToFloat($PriceString)));
|
||||
}
|
||||
|
||||
function OtherConvertToFloat ($Value)
|
||||
{
|
||||
global $GlobalDecimalPoint;
|
||||
$Value=trim($Value);
|
||||
for ($i=0;$i<(strlen($Value)-1);$i++)
|
||||
{
|
||||
//replace first non-decimal position with decimal-point
|
||||
if ( ! ($Value[$i]=="0"
|
||||
|| $Value[$i]=="1"
|
||||
|| $Value[$i]=="2"
|
||||
|| $Value[$i]=="3"
|
||||
|| $Value[$i]=="4"
|
||||
|| $Value[$i]=="5"
|
||||
|| $Value[$i]=="6"
|
||||
|| $Value[$i]=="7"
|
||||
|| $Value[$i]=="8"
|
||||
|| $Value[$i]=="9"
|
||||
))
|
||||
{
|
||||
$Value[$i]=$GlobalDecimalPoint;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return (float) $Value;
|
||||
}
|
||||
|
||||
function OtherSiPrefixToFloat ($String)
|
||||
{
|
||||
$String=trim($String);
|
||||
if (substr($String,strlen($String)-1,1)=="E")
|
||||
return OtherConvertToFloat($String)*1000000000000000000;
|
||||
if (substr($String,strlen($String)-1,1)=="P")
|
||||
return OtherConvertToFloat($String)*1000000000000000;
|
||||
if (substr($String,strlen($String)-1,1)=="T")
|
||||
return OtherConvertToFloat($String)*1000000000000;
|
||||
if (substr($String,strlen($String)-1,1)=="G")
|
||||
return OtherConvertToFloat($String)*1000000000;
|
||||
if (substr($String,strlen($String)-1,1)=="M")
|
||||
return OtherConvertToFloat($String)*1000000;
|
||||
if (substr($String,strlen($String)-1,1)=="k")
|
||||
return OtherConvertToFloat($String)*1000;
|
||||
if (substr($String,strlen($String)-1,1)=="m")
|
||||
return OtherConvertToFloat($String)/1000;
|
||||
if (substr($String,strlen($String)-1,1)=="µ")
|
||||
return OtherConvertToFloat($String)/1000000;
|
||||
if (substr($String,strlen($String)-1,1)=="u")
|
||||
return OtherConvertToFloat($String)/1000000;
|
||||
if (substr($String,strlen($String)-1,1)=="n")
|
||||
return OtherConvertToFloat($String)/1000000000;
|
||||
if (substr($String,strlen($String)-1,1)=="p")
|
||||
return OtherConvertToFloat($String)/1000000000000;
|
||||
if (substr($String,strlen($String)-1,1)=="f")
|
||||
return OtherConvertToFloat($String)/1000000000000000;
|
||||
if (substr($String,strlen($String)-1,1)=="a")
|
||||
return OtherConvertToFloat($String)/1000000000000000000;
|
||||
else
|
||||
return OtherConvertToFloat($String);
|
||||
}
|
||||
|
||||
function OtherFloatToSiPrefix ($Integer)
|
||||
{
|
||||
$Integer = trim(sprintf("%E",$Integer));
|
||||
$Exponent=0;
|
||||
for ($i=(strlen($Integer)-1); $i>=0; $i--)
|
||||
{
|
||||
if ($Integer[$i]=="E") break;
|
||||
$Exponent = $Integer[$i] . $Exponent;
|
||||
}
|
||||
$Exponent = substr($Exponent,0,strlen($Exponent)-1);
|
||||
//set si prefix
|
||||
if ($Exponent>=18) return ($Integer/1000000000000000000)." E";
|
||||
if ($Exponent>=15) return ($Integer/1000000000000000)." P";
|
||||
if ($Exponent>=12) return ($Integer/1000000000000)." T";
|
||||
if ($Exponent>=9) return ($Integer/1000000000)." G";
|
||||
if ($Exponent>=6) return ($Integer/1000000)." M";
|
||||
if ($Exponent>=3) return ($Integer/1000)." k";
|
||||
if ($Exponent<3 && $Exponent>=0) return ($Integer/1)." ";
|
||||
if ($Exponent<-15) return ($Integer*1000000000000000)." a";
|
||||
if ($Exponent<-12) return ($Integer*1000000000000000)." f";
|
||||
if ($Exponent<-9) return ($Integer*1000000000000)." p";
|
||||
if ($Exponent<-6) return ($Integer*1000000000)." n";
|
||||
if ($Exponent<-3) return ($Integer*1000000)." µ";
|
||||
if ($Exponent<0) return ($Integer*1000)." m";
|
||||
}
|
||||
|
||||
function OtherGetIcon ($IconName,$CssClass)
|
||||
{
|
||||
global $GlobalTemplate;
|
||||
$IconDirectory='./templates/'.$GlobalTemplate.'/icons/';
|
||||
$Error = 0;
|
||||
$RetVal = "";
|
||||
|
||||
if (file_exists($IconDirectory.$IconName.".png")) $IconFile=$IconName.".png";
|
||||
elseif (file_exists($IconDirectory.$IconName.".jpg")) $IconFile=$IconName.".jpg";
|
||||
elseif (file_exists($IconDirectory.$IconName.".gif")) $IconFile=$IconName.".gif";
|
||||
else
|
||||
{
|
||||
$Error = 1;
|
||||
//log if template directory is existing - if not, anyone else will report this
|
||||
if (file_exists("./templates/".$GlobalTemplate)) ErrorLog("Icon '$IconName' +[.png|.jpg|.gif] not found!");
|
||||
}
|
||||
|
||||
if (!$Error)
|
||||
{
|
||||
$RetVal = "<img src=\"$IconDirectory$IconFile\"".(($CssClass)? " class=\"$CssClass\"":"").">";
|
||||
}
|
||||
|
||||
return $RetVal;
|
||||
}
|
||||
|
||||
?>
|
||||
158
includes/prepare_template.php
Executable file
|
|
@ -0,0 +1,158 @@
|
|||
<?php
|
||||
function GetPathToGuide($Guide)
|
||||
{
|
||||
global $GlobalLanguage;
|
||||
include "config.php";
|
||||
$Path="";
|
||||
$PathUserLanguage = "./documentation/$GlobalLanguage/$Guide.pdf";
|
||||
$PathConfigLanguage = "./documentation/$GlobalLanguage/$CfgStdLanguage.pdf";
|
||||
if (file_exists($PathUserLanguage))
|
||||
{
|
||||
$Path=$PathUserLanguage;
|
||||
}
|
||||
elseif (file_exists($PathConfigLanguage))
|
||||
{
|
||||
$Path=$PathConfigLanguage;
|
||||
}
|
||||
elseif (file_exists("./documentation"))
|
||||
{
|
||||
$Dir=scandir("./documentation");
|
||||
foreach ($Dir as $x)
|
||||
{
|
||||
if ($x=="." || $x=="..") continue;
|
||||
if (!is_dir("./documentation/$x")) continue;
|
||||
if (file_exists("./documentation/$x/$Guide.pdf"))
|
||||
{
|
||||
$Path="./documentation/$x/$Guide.pdf";
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $Path;
|
||||
}
|
||||
|
||||
|
||||
$TemplateMainMenu ="";
|
||||
|
||||
$TemplateMainMenu .= ' <div id="MainMenu">'."\n";
|
||||
$TemplateMainMenu .= ' <ul>'."\n";
|
||||
$TemplateMainMenu .= ' <li><a href="index.php" target="_top" title="'.LangSpellHtml('MenuHome').'">'.OtherGetIcon('Home',0).LangSpellHtml('MenuHome').'</a></li>'."\n";
|
||||
$TemplateMainMenu .= ' <li><a title="'.LangSpellHtml('MenuParts').'">'.OtherGetIcon('Parts',0).LangSpellHtml('MenuParts').'</a>'."\n";
|
||||
$TemplateMainMenu .= ' <ul>'."\n";
|
||||
$TemplateMainMenu .= ' <li><a href="index.php?Page=PartsByType" title="'.LangSpellHtml('MenuPartsByType').'">'.OtherGetIcon('Types',0).LangSpellHtml('MenuPartsByType').'</a></li>'."\n";
|
||||
$TemplateMainMenu .= ' <li><a href="index.php?Page=PartsByStore" title="'.LangSpellHtml('MenuPartsByStore').'">'.OtherGetIcon('Stores',0).LangSpellHtml('MenuPartsByStore').'</a></li>'."\n";
|
||||
if (UserHasRight('EditParts'))
|
||||
$TemplateMainMenu .= ' <li><a href="index.php?Page=AddPart" title="'.LangSpellHtml('MenuPartsAddNewPart').'">'.OtherGetIcon('New',0).LangSpellHtml('MenuPartsAddNewPart').'</a></li>'."\n";
|
||||
$TemplateMainMenu .= ' </ul>'."\n";
|
||||
$TemplateMainMenu .= ' </li>'."\n";
|
||||
|
||||
if (UserHasRight('EditStores') || UserHasRight('EditTypes') || UserHasRight('EditPackages') || UserHasRight('EditVendors')
|
||||
|| UserGetLogin()=="root"
|
||||
|| UserHasRight('ViewSTPV'))
|
||||
{
|
||||
$TemplateMainMenu .= ' <li><a title="'.LangSpellHtml('MenuAdmin').'">'.LangSpellHtml('MenuAdmin').'</a>'."\n";
|
||||
$TemplateMainMenu .= ' <ul>'."\n";
|
||||
if (UserHasRight('EditStores') || UserHasRight('ViewSTPV'))
|
||||
$TemplateMainMenu .= ' <li><a href="index.php?Page=EditStores" title="'.LangSpellHtml('MenuAdminStores').'">'.OtherGetIcon('Stores',0).LangSpellHtml('MenuAdminStores').'</a></li>'."\n";
|
||||
if (UserHasRight('EditTypes') || UserHasRight('ViewSTPV'))
|
||||
$TemplateMainMenu .= ' <li><a href="index.php?Page=EditTypes" title="'.LangSpellHtml('MenuAdminTypes').'">'.OtherGetIcon('Types',0).LangSpellHtml('MenuAdminTypes').'</a></li>'."\n";
|
||||
if (UserHasRight('EditPackages') || UserHasRight('ViewSTPV'))
|
||||
$TemplateMainMenu .= ' <li><a href="index.php?Page=EditPackages" title="'.LangSpellHtml('MenuAdminPacks').'">'.OtherGetIcon('Packages',0).LangSpellHtml('MenuAdminPacks').'</a></li>'."\n";
|
||||
if (UserHasRight('EditVendors') || UserHasRight('ViewSTPV'))
|
||||
$TemplateMainMenu .= ' <li><a href="index.php?Page=EditVendors" title="'.LangSpellHtml('MenuAdminVendors').'">'.OtherGetIcon('Vendors',0).LangSpellHtml('MenuAdminVendors').'</a></li>'."\n";
|
||||
if (UserGetLogin()=="root")
|
||||
{
|
||||
$TemplateMainMenu .= ' <li><a href="index.php?Page=EditUsers" title="'.LangSpellHtml('MenuAdminUsers').'">'.OtherGetIcon('UserAdmin',0).LangSpellHtml('MenuAdminUsers').'</a></li>'."\n";
|
||||
$TemplateMainMenu .= ' <li><a href="index.php?Page=EditConfig" title="'.LangSpellHtml('MenuAdminConfig').'">'.OtherGetIcon('Config',0).LangSpellHtml('MenuAdminConfig').'</a></li>'."\n";
|
||||
}
|
||||
$TemplateMainMenu .= ' </ul>'."\n";
|
||||
$TemplateMainMenu .= ' </li>'."\n";
|
||||
}
|
||||
|
||||
$TemplateMainMenu .= ' <li><a title="'.LangSpellHtml('MenuTools').'">'.OtherGetIcon('Tools',0).LangSpellHtml('MenuTools').'</a>'."\n";
|
||||
$TemplateMainMenu .= ' <ul>'."\n";
|
||||
$TemplateMainMenu .= ' <li><a href="index.php?Page=RepeatOrder" title="'.LangSpellHtml('MenuToolsRepOrder').'">'.OtherGetIcon('RepeatOrder',0).LangSpellHtml('MenuToolsRepOrder').'</a></li>'."\n";
|
||||
$TemplateMainMenu .= ' <li><a title="'.LangSpellHtml('MenuToolsPartStat').'">'.OtherGetIcon('PartStatistic',0).LangSpellHtml('MenuToolsPartStat').'</a></li>'."\n";
|
||||
if (UserHasRight('ConsistencyCheck') || UserGetLogin()=="root")
|
||||
$TemplateMainMenu .= ' <li><a href="index.php?Page=ConsistencyCheck" title="'.LangSpellHtml('MenuToolsConsCheck').'">'.OtherGetIcon('ConsistencyCheck',0).LangSpellHtml('MenuToolsConsCheck').'</a></li>'."\n";
|
||||
$TemplateMainMenu .= ' </ul>'."\n";
|
||||
$TemplateMainMenu .= ' </li>'."\n";
|
||||
$TemplateMainMenu .= ' <li><a title="'.LangSpellHtml('MenuHelp').'">'.OtherGetIcon('Help',0).LangSpellHtml('MenuHelp').'</a>'."\n";
|
||||
$TemplateMainMenu .= ' <ul>'."\n";
|
||||
if ($UserGuide=GetPathToGuide('UserGuide'))
|
||||
$TemplateMainMenu .= ' <li><a href="'.$UserGuide.'" title="'.LangSpellHtml('MenuHelpUserGuide').'">'.OtherGetIcon('UserGuide',0).LangSpellHtml('MenuHelpUserGuide').'</a></li>'."\n";
|
||||
if ($AdminGuide=GetPathToGuide('AdminGuide'))
|
||||
$TemplateMainMenu .= ' <li><a href="'.$AdminGuide.'" title="'.LangSpellHtml('MenuHelpAdminGuide').'">'.OtherGetIcon('AdminGuide',0).LangSpellHtml('MenuHelpAdminGuide').'</a></li>'."\n";
|
||||
if ($DeveloperGuide=GetPathToGuide('DeveloperGuide'))
|
||||
$TemplateMainMenu .= ' <li><a href="'.$DeveloperGuide.'" title="'.LangSpellHtml('MenuHelpDeveloperGuide').'">'.OtherGetIcon('DeveloperGuide',0).LangSpellHtml('MenuHelpDeveloperGuide').'</a></li>'."\n";
|
||||
$TemplateMainMenu .= ' <li><a href="index.php?Page=VersionHistory" title="'.LangSpellHtml('MenuHelpVersionHistory').'">'.OtherGetIcon('VersionHistory',0).LangSpellHtml('MenuHelpVersionHistory').'</a></li>'."\n";
|
||||
$TemplateMainMenu .= ' <li><a title="'.LangSpellHtml('MenuHelpAbout').'">'.OtherGetIcon('About',0).LangSpellHtml('MenuHelpAbout').'</a>'."\n";
|
||||
$TemplateMainMenu .= ' </li>'."\n";
|
||||
$TemplateMainMenu .= ' </ul>'."\n";
|
||||
$TemplateMainMenu .= ' </li>'."\n";
|
||||
if (UserIsLoggedIn())
|
||||
{
|
||||
$TemplateMainMenu .= ' <li><a title="'.UserGetLogin().'">'.OtherGetIcon('Login',0).UserGetLogin().'</a>'."\n";
|
||||
$TemplateMainMenu .= ' <ul>'."\n";
|
||||
if (UserGetLogin()!=="root")
|
||||
{
|
||||
$TemplateMainMenu .= ' <li><a href="index.php?Page=UserSettings" title="'.LangSpellHtml('MenuUserSettings').'">'.OtherGetIcon('UserSettings',0).LangSpellHtml('MenuUserSettings').'</a></li>'."\n";
|
||||
}
|
||||
$TemplateMainMenu .= ' <li><a href="index.php?ToDo=Logout" target="_top" title="'.LangSpellHtml('MenuUserLogout').'">'.OtherGetIcon('Logout',0).LangSpellHtml('MenuUserLogout').'</a></li>'."\n";
|
||||
$TemplateMainMenu .= ' </li>'."\n";
|
||||
$TemplateMainMenu .= ' </ul>'."\n";
|
||||
$TemplateMainMenu .= ' </li>'."\n";
|
||||
}
|
||||
$TemplateMainMenu .= ' </ul>'."\n";
|
||||
$TemplateMainMenu .= ' </div>'."\n";
|
||||
$TemplateMainMenu .= "\n";
|
||||
|
||||
$TemplateLogin = "";
|
||||
$TemplateLogin .= ' <div id="Login">'."\n";
|
||||
if (!UserIsLoggedIn())
|
||||
{
|
||||
$TemplateLogin .= ' <form action="index.php?ToDo=Login" method="post" id="LoginForm">'."\n";
|
||||
$TemplateLogin .= ' <input type="text" name="Login" title="'.LangSpellHtml('MenuLoginName').'">'."\n";
|
||||
$TemplateLogin .= ' <input type="password" name="Password" title="'.LangSpellHtml('MenuLoginPassword').'">'."\n";
|
||||
$TemplateLogin .= ' <input type="submit" value="'.LangSpellHtml('MenuLogin').'" title="'.LangSpellHtml('MenuLogin').'">'."\n";
|
||||
$TemplateLogin .= ' </form>'."\n";
|
||||
}
|
||||
$TemplateLogin .= ' </div>'."\n";
|
||||
|
||||
/**********
|
||||
messages
|
||||
***********/
|
||||
$ShowMessageError = (MessageGetErrors()) ? 1:0;
|
||||
$ShowMessageWarning = (MessageGetWarnings()) ? 1:0;
|
||||
$ShowMessageSuccess = (MessageGetSuccess()) ? 1:0;
|
||||
|
||||
$TemplateMessage = "";
|
||||
if ($ShowMessageError || $ShowMessageWarning || $ShowMessageSuccess)
|
||||
{
|
||||
$TemplateMessage .= '<div id="Message">';
|
||||
if ($ShowMessageError)
|
||||
$TemplateMessage .= '<div id="Error">'.nl2br(htmlentities(MessageGetErrors())).'</div>';
|
||||
if ($ShowMessageWarning)
|
||||
$TemplateMessage .= '<div id="Warning">'.nl2br(htmlentities(MessageGetWarnings())).'</div>';
|
||||
if ($ShowMessageSuccess)
|
||||
$TemplateMessage .= '<div id="Success">'.nl2br(htmlentities(MessageGetSuccess())).'</div>';
|
||||
$TemplateMessage .= '</div>';
|
||||
}
|
||||
|
||||
/***********************
|
||||
include java scripts
|
||||
************************/
|
||||
$JSInclude = "";
|
||||
$JSFileArray = file ("./includes/java_scripts.php");
|
||||
foreach ($JSFileArray as $JSFileArrayLine)
|
||||
$JSInclude .= $JSFileArrayLine;
|
||||
$GlobalContent = $JSInclude.$GlobalContent;
|
||||
|
||||
|
||||
/**********
|
||||
Content
|
||||
***********/
|
||||
$TemplateBody='<div id="Body">'."\n".$GlobalContent.'</div>';
|
||||
|
||||
?>
|
||||
175
includes/user.php
Executable file
|
|
@ -0,0 +1,175 @@
|
|||
<?php
|
||||
session_start();
|
||||
|
||||
//login
|
||||
if ($ToDo=="Login")
|
||||
{
|
||||
$Login = (isset($_POST['Login'])) ? $_POST['Login'] :"";
|
||||
$Password = (isset($_POST['Password'])) ? md5($_POST['Password']):"";
|
||||
|
||||
if ($Login=="root")
|
||||
{
|
||||
global $CfgRootPassword;
|
||||
|
||||
if ($Password==$CfgRootPassword)
|
||||
{
|
||||
MessageSuccess(LangSpell('ScentenceLoginSucceeded')."\n");
|
||||
$_SESSION['Id']=0;
|
||||
$_SESSION['Login']=$Login;
|
||||
$_SESSION['Time']=time();
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageError(LangSpell('ScentenceLoginFailed')."\n");
|
||||
$_SESSION['Id']=0;
|
||||
$_SESSION['Login']="";
|
||||
$_SESSION['Time']=0;
|
||||
}
|
||||
}
|
||||
else if ($Login)
|
||||
{
|
||||
global $GlobalMysqlHandler;
|
||||
|
||||
$query="SELECT * FROM `User` WHERE `Login` = '$Login' LIMIT 0 , 1";
|
||||
$query=mysqli_query($GlobalMysqlHandler, $query);
|
||||
$data=mysqli_fetch_array($query);
|
||||
|
||||
if ($Password==$data['Password'])
|
||||
{
|
||||
MessageSuccess(LangSpell('ScentenceLoginSucceeded')."\n");
|
||||
$_SESSION['Id']=$data['Id'];
|
||||
$_SESSION['Login']=$Login;
|
||||
$_SESSION['Time']=time();
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageError(LangSpell('ScentenceLoginFailed')."\n");
|
||||
$_SESSION['Id']=0;
|
||||
$_SESSION['Login']="";
|
||||
$_SESSION['Time']=0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageError(LangSpell('ScentenceNoLoginSpecified')."\n");
|
||||
$_SESSION['Id']=0;
|
||||
$_SESSION['Login']="";
|
||||
$_SESSION['Time']=0;
|
||||
}
|
||||
}
|
||||
//logout
|
||||
else if ($ToDo=="Logout")
|
||||
{
|
||||
$_SESSION['Id']=0;
|
||||
$_SESSION['Login']="";
|
||||
$_SESSION['Time']=0;
|
||||
}
|
||||
//load login from session
|
||||
else
|
||||
{
|
||||
$Id = (isset($_SESSION['Id'])) ? $_SESSION['Id']:"";
|
||||
$Login = (isset($_SESSION['Login'])) ? $_SESSION['Login']:"";
|
||||
$Time = (isset($_SESSION['Time'])) ? $_SESSION['Time']:0;
|
||||
if ($Login && ((time()-$GlobalUserTimeout)<=$Time))
|
||||
{
|
||||
$_SESSION['Time']=time();
|
||||
}
|
||||
elseif ($Login)
|
||||
{
|
||||
MessageWarning(LangSpell('ScentenceLoginTimeoutExpired'));
|
||||
$_SESSION['Id']=0;
|
||||
$_SESSION['Login']="";
|
||||
$_SESSION['Time']=0;
|
||||
}
|
||||
}
|
||||
|
||||
//login messages
|
||||
if (isset($_SESSION['Login']) && $_SESSION['Login']=="root")
|
||||
MessageWarning(LangSpell('ScentenceLoggedAsRoot'));
|
||||
|
||||
//load user settings
|
||||
UserLoadSettings();
|
||||
|
||||
|
||||
/************
|
||||
functions
|
||||
*************/
|
||||
function UserLogout()
|
||||
{
|
||||
$_SESSION['Id']=0;
|
||||
$_SESSION['Login']="";
|
||||
$_SESSION['Time']=0;
|
||||
}
|
||||
|
||||
function UserIsLoggedIn()
|
||||
{
|
||||
$ReturnValue=0;
|
||||
if (isset($_SESSION['Login']) && $_SESSION['Login'])
|
||||
$ReturnValue=1;
|
||||
else
|
||||
$ReturnValue=0;
|
||||
return $ReturnValue;
|
||||
}
|
||||
|
||||
function UserGetLogin()
|
||||
{
|
||||
return ((isset($_SESSION['Login']))? $_SESSION['Login']:"");
|
||||
}
|
||||
|
||||
function UserGetId()
|
||||
{
|
||||
return ((isset($_SESSION['Id']))? $_SESSION['Id']:0);
|
||||
}
|
||||
|
||||
function UserHasRight($Right)
|
||||
{
|
||||
$Ret=0;
|
||||
if (isset($_SESSION['Id']) && $_SESSION['Id']>0)
|
||||
{
|
||||
global $GlobalMysqlHandler;
|
||||
$RightsQuery = "SELECT `$Right` FROM `UserRights` WHERE `Id` =".$_SESSION['Id'];
|
||||
$RightsQuery = mysqli_query($GlobalMysqlHandler, $RightsQuery);
|
||||
if ($RightsQuery && mysqli_num_rows($RightsQuery))
|
||||
{
|
||||
$RightData = mysqli_fetch_array($RightsQuery);
|
||||
$Ret=(strtolower($RightData[$Right])=="true")? 1:0;
|
||||
}
|
||||
else
|
||||
{
|
||||
ErrorLog("[user.php] User with id '".$_SESSION['Id']."' not found in table 'UserRights' while asking for right '$Right'!");
|
||||
}
|
||||
}
|
||||
return ($Ret);
|
||||
}
|
||||
|
||||
function UserLoadSettings()
|
||||
{
|
||||
$Ret=0;
|
||||
global $GlobalMysqlHandler;
|
||||
|
||||
global $GlobalTemplate;
|
||||
global $CfgStdTemplate;
|
||||
|
||||
global $GlobalLanguage;
|
||||
global $CfgStdLanguage;
|
||||
|
||||
if (isset($_SESSION['Id']) && $_SESSION['Id']>0)
|
||||
{
|
||||
$LoadQuery="SELECT `Template` , `Language` FROM `User` WHERE `Id` =".$_SESSION['Id'];
|
||||
$LoadQuery=mysqli_query($GlobalMysqlHandler, $LoadQuery);
|
||||
if ($LoadQuery)
|
||||
{
|
||||
$LoadValue=mysqli_fetch_array($LoadQuery);
|
||||
$GlobalTemplate=($LoadValue['Template'])? $LoadValue['Template']:$CfgStdTemplate;
|
||||
$GlobalLanguage=($LoadValue['Language'])? $LoadValue['Language']:$CfgStdLanguage;
|
||||
$Ret=1;
|
||||
}
|
||||
else
|
||||
{
|
||||
ErrorLog("[user.php] Not able to load vars for user with id = ".$_SESSION['Id']."!");
|
||||
}
|
||||
}
|
||||
return $Ret;
|
||||
}
|
||||
|
||||
?>
|
||||
110
index.php
Executable file
|
|
@ -0,0 +1,110 @@
|
|||
<?php
|
||||
$StartTime=time()+microtime();
|
||||
|
||||
//set ToDo var
|
||||
if (isset($_GET['ToDo']))
|
||||
$ToDo=$_GET['ToDo'];
|
||||
else
|
||||
$ToDo="";
|
||||
|
||||
//main include code
|
||||
include ("./includes/globals.php");
|
||||
include ("./includes/load_config.php");
|
||||
include ("./includes/log.php");
|
||||
include ("./includes/message.php");
|
||||
include ("./includes/language.php");
|
||||
include ("./includes/mysql.php");
|
||||
include ("./includes/user.php");
|
||||
include ("./includes/lock.php");
|
||||
include ("./includes/other_functions.php");
|
||||
|
||||
//special includes
|
||||
include ("./includes/nested_list_functions.php");
|
||||
|
||||
//select page to include
|
||||
$Page = (isset($_GET['Page']))? $_GET['Page']:"";
|
||||
switch ($Page)
|
||||
{
|
||||
case 'RepeatOrder':
|
||||
$Page="./pages/repeat_order.php";
|
||||
break;
|
||||
case 'ConsistencyCheck':
|
||||
$Page="./pages/consistency_check.php";
|
||||
break;
|
||||
case 'ShowPart':
|
||||
$Page="./pages/show_part.php";
|
||||
break;
|
||||
case 'PartsByType':
|
||||
$Page="./pages/parts_by_type.php";
|
||||
break;
|
||||
case 'PartsByStore':
|
||||
$Page="./pages/parts_by_store.php";
|
||||
break;
|
||||
case 'AddPart':
|
||||
$Page="./pages/add_part.php";
|
||||
break;
|
||||
case 'EditTypes':
|
||||
$Page="./pages/edit_types.php";
|
||||
break;
|
||||
case 'EditPackages':
|
||||
$Page="./pages/edit_packages.php";
|
||||
break;
|
||||
case 'EditStores':
|
||||
$Page="./pages/edit_stores.php";
|
||||
break;
|
||||
case 'EditVendors':
|
||||
$Page="./pages/edit_vendors.php";
|
||||
break;
|
||||
case 'EditConfig':
|
||||
$Page="./pages/edit_config.php";
|
||||
break;
|
||||
case 'EditUsers':
|
||||
$Page="./pages/edit_users.php";
|
||||
break;
|
||||
case 'UserSettings':
|
||||
$Page="./pages/user_settings.php";
|
||||
break;
|
||||
case 'VersionHistory':
|
||||
$Page="./pages/version_history.php";
|
||||
break;
|
||||
case '':
|
||||
$Page="./pages/home.php";
|
||||
break;
|
||||
default:
|
||||
MessageError(LangSpell("SentencePageNotFound"));
|
||||
ErrorLog("[index.php] Page \"$Page\" not Found.");
|
||||
$Page="./pages/home.php";
|
||||
}
|
||||
|
||||
//include page
|
||||
if (file_exists($Page)) include ($Page);
|
||||
else ErrorLog("[index.php] Page-include \"$Page\" not found!");
|
||||
|
||||
//include template
|
||||
include ( "./includes/prepare_template.php" );
|
||||
if (file_exists("./templates/$GlobalTemplate/template.php"))
|
||||
include ( "./templates/$GlobalTemplate/template.php" );
|
||||
else
|
||||
{
|
||||
ErrorLog("[index.php] Template \"$GlobalTemplate\" damaged!");
|
||||
MessageError(LangSpell('SentenceTemplateNotFound'));
|
||||
echo $TemplateMainMenu.$TemplateLogin.$TemplateMessage.$GlobalContent;
|
||||
}
|
||||
|
||||
//Final Code
|
||||
LogClose();
|
||||
MysqlCloseDb();
|
||||
|
||||
if ($GlobalDebungMode)
|
||||
{
|
||||
$StopTime=time()+microtime();
|
||||
$TimeSpan=ceil(($StopTime-$StartTime)*1000);
|
||||
if ($TimeSpan<0)
|
||||
{
|
||||
ErrorLog("Execution time negative, start: '$StartTime' stop: '$StopTime' timespan: '$TimeSpan'!");
|
||||
echo "Start time: <strong>$StartTime s</strong><br>\n";
|
||||
echo "Stop time: <strong>$StopTime s</strong><br>\n";
|
||||
}
|
||||
echo "Script execution time: <strong>$TimeSpan ms</strong><br>\n";
|
||||
}
|
||||
?>
|
||||
158
languages/English.lng
Executable file
|
|
@ -0,0 +1,158 @@
|
|||
MenuHome = Home
|
||||
|
||||
MenuParts = Parts
|
||||
MenuPartsByType = Party By Type
|
||||
MenuPartsByStore = Parts By Store
|
||||
MenuPartsAddNewPart = Add New Part
|
||||
|
||||
MenuAdmin = Administration
|
||||
MenuAdminStores = Stores
|
||||
MenuAdminTypes = Types
|
||||
MenuAdminPacks = Packages
|
||||
MenuAdminVendors = Vendors
|
||||
MenuAdminUsers = Users
|
||||
MenuAdminConfig = Config
|
||||
|
||||
MenuTools = Tools
|
||||
MenuToolsRepOrder = Repeat Order
|
||||
MenuToolsPartStat = Part Statistic
|
||||
MenuToolsConsCheck = Consistency Check
|
||||
|
||||
MenuHelp = Help
|
||||
MenuHelpUserGuide = User Guide
|
||||
MenuHelpAdminGuide = Admin Guide
|
||||
MenuHelpDeveloperGuide = Developer Guide
|
||||
MenuHelpVersionHistory = Version History
|
||||
MenuHelpAbout = About
|
||||
|
||||
MenuUserSettings = User Settings
|
||||
MenuUserLogout = Logout
|
||||
|
||||
MenuLogin = Login
|
||||
MenuLoginName = Login Name
|
||||
MenuLoginPassword = Password
|
||||
|
||||
ScentenceNoLoginSpecified = No login specified!
|
||||
ScentenceLoggedAsRoot = Logged as root user.
|
||||
ScentenceLoginFailed = Login failed!
|
||||
ScentenceLoginTimeoutExpired = Login Timeout expired!
|
||||
ScentenceLoginSucceeded = Login successfull.
|
||||
ScentenceNoUserRights = You have not the required rights for this!
|
||||
SentencePageNotFound = Page not found!
|
||||
SentenceLoginForbidden = This login was not allowed!
|
||||
SentencePasswordForbidden = This password was not allowed!
|
||||
SentenceDatabaseError = Databse error!
|
||||
SentenceNewUserAdded = New user has been added.
|
||||
SentenceUserUpdated = User entry has been updated.
|
||||
SentenceUserDeleted = User has been deleted.
|
||||
SentencePasswordChangedWarning = User password has been changed!
|
||||
SentenceTemplateNotFound = Template not found!
|
||||
SentenceLockIsActive = Item is locked by another user.
|
||||
SentenceUnknownError = Unkown error!
|
||||
SentenceNestedListMoved = Element was moved.
|
||||
SentencePleaseSelectPartType = Please select the type of the part.
|
||||
SentencePleaseSelectPartStorage = Please select the store of the part.
|
||||
SentencePleaseSelectPackage = Please select the package of the part.
|
||||
SentencePleaseSpecifyPartValues = Please specify the values of the part.
|
||||
SentenceNoNameOrValueOrDescriptionGiven = No name, value or description given!
|
||||
SentenceNewPartAdded = New part was added to database.
|
||||
SentencePartHasBeenUpdated = Part has been updated.
|
||||
SentenceNoFileGiven = No file given!
|
||||
SentenceNotEnoughDiskSpace = There is not enough free disk space!
|
||||
SentenceFileAlreadyExist = File already exist!
|
||||
SentenceCanNotCopyFile = Can not copy file!
|
||||
SentenceFileHasBeenUploaded = File has been uploaded.
|
||||
SentenceDownloadEdited = Download has been edited.
|
||||
SentenceDownloadDeleted = Download deleted.
|
||||
SentenceShureToDeletePart = Are you shure to remove the part from the database?
|
||||
SentencePartDeleted = Part was removed from database.
|
||||
|
||||
TagTitleEditUserLogin = Edit this users login name.
|
||||
TagTitleEditUserPassword = Edit this users password or leave untouched to keep the old.
|
||||
TagTitleEditUserRight = Check or uncheck to set or reset this users right.
|
||||
TagTitleDeleteUser = Delete this user.
|
||||
TagTitleDeleteEntry = Delete Item
|
||||
TagTitleEdit = Edit Item
|
||||
TagTitleDelete = Delete Item
|
||||
TagTitleCancel = Cancel
|
||||
TagTitleMove = Move Item
|
||||
TagTitleMoveUp = Move Item Up
|
||||
|
||||
ButtonEdit = Edit
|
||||
ButtonSave = Save
|
||||
ButtonNew = New
|
||||
ButtonProceed = Proceed
|
||||
ButtonUpload = Upload
|
||||
|
||||
UserSettingsTableHead = user settings
|
||||
UserSettingsSetNewPassword = set new password
|
||||
UserSettingsConfirmNewPassword = confirm new password
|
||||
UserSettingsLanguage = language
|
||||
UserSettingsTemplate = template
|
||||
UserSettingsDefault = default
|
||||
|
||||
EditVendorsId = id
|
||||
EditVendorsName = vendor
|
||||
EditVendorsHomepage = homepage
|
||||
EditVendorsMinBill = minimum bill
|
||||
EditVendorsShippingCost = shipping cost
|
||||
EditVendorsEdit = Edit
|
||||
EditVendorsSentenceVendorNameRequired = Name of the Vendor is required!
|
||||
EditVendorsSentenceVendorNewAdded = New vendor added.
|
||||
EditVendorsSentenceVendorDeleted = Vendor deleted.
|
||||
EditVendorsSentenceVendorUpated = Vendor updated.
|
||||
|
||||
EditStoresNoStoreNameGiven = You need to give a name for the store!
|
||||
EditStoresNewStoreAdded = New store added.
|
||||
EditStoresStoreDeleted = Store deleted.
|
||||
|
||||
EditPackagesNoPackageNameGiven = You need to give a name for the package!
|
||||
EditPackagesNewPackageAdded = New package added.
|
||||
EditPackagesPackageDeleted = Package deleted.
|
||||
|
||||
EditTypesNoTypeNameGiven = You need to give a name for the type!
|
||||
EditTypesNewTypeAdded = New type added.
|
||||
EditTypesTypeDeleted = Type deleted.
|
||||
EditTypesName = Name
|
||||
EditTypesShortName = Abbr.
|
||||
EditTypesNameValue1 = Value1
|
||||
EditTypesNameValue2 = Value2
|
||||
EditTypesNameValue3 = Value3
|
||||
EditTypesUnitValue1 = Unit1
|
||||
EditTypesUnitValue2 = Unit2
|
||||
EditTypesUnitValue3 = Unit3
|
||||
|
||||
PartsName = Name
|
||||
PartsShortDescription = Short Description
|
||||
PartsLongDescription = Long Description
|
||||
PartsVendor = Vendor
|
||||
PartsManufactorLink = Manufactor Link
|
||||
PartsNotSpecified = not specified
|
||||
PartsVendorLink = Vendor Link
|
||||
PartsPackageUnit = Package Unit
|
||||
PartsPrice = Price
|
||||
PartsMinOrderQuantity = Minimum Order Quantity
|
||||
PartsQuantity = Actual Quantity
|
||||
PartsMinQuantity = Minimum Quantity
|
||||
PartsPackage = Package
|
||||
PartsObsolete = Obsolete
|
||||
PartsObsoleteOnly = Only Obsolete
|
||||
PartsObsoleteNon = Non Obsolete
|
||||
PartsObsoleteAll = All Parts
|
||||
PartsType = Type
|
||||
PartsStorage = Store
|
||||
PartsValues = Values
|
||||
PartsDownloads = Downloads
|
||||
PartsPicture = Picture
|
||||
|
||||
DownloadsName = Name
|
||||
DownloadsPath = Path
|
||||
DownloadsSize = Size
|
||||
DownloadsType = Type
|
||||
|
||||
RepeatOrderPackagesToOrder = Packages To Order
|
||||
RepeatOrderSumPrice = Sum Price
|
||||
|
||||
ConsCheckCreateDatabaseStructure = Create Database Structure
|
||||
ConsCheckRepairIncorrectType = Repair incorrect parts type
|
||||
COnsCheckIncorrectTypeParts = Number of parts with incorrect types
|
||||
158
languages/German.lng
Executable file
|
|
@ -0,0 +1,158 @@
|
|||
MenuHome = Startseite
|
||||
|
||||
MenuParts = Bauteile
|
||||
MenuPartsByType = Teile nach Typ
|
||||
MenuPartsByStore = Teile nach Lager
|
||||
MenuPartsAddNewPart = Neues Bauteil
|
||||
|
||||
MenuAdmin = Administration
|
||||
MenuAdminStores = Lager
|
||||
MenuAdminTypes = Typen
|
||||
MenuAdminPacks = Gehäuse
|
||||
MenuAdminVendors = Lieferanten
|
||||
MenuAdminUsers = Benutzer
|
||||
MenuAdminConfig = Config
|
||||
|
||||
MenuTools = Werkzeuge
|
||||
MenuToolsRepOrder = Nachbestellung
|
||||
MenuToolsPartStat = Bauteil Statistik
|
||||
MenuToolsConsCheck = Konsistenz Prüfung
|
||||
|
||||
MenuHelp = Hilfe
|
||||
MenuHelpUserGuide = Benutzerhandbuch
|
||||
MenuHelpAdminGuide = Administrationshandbuch
|
||||
MenuHelpDeveloperGuide = Entwicklerhandbuch
|
||||
MenuHelpVersionHistory = Versionsgeschichte
|
||||
MenuHelpAbout = Über
|
||||
|
||||
MenuUserSettings = Benutzer Einstellungen
|
||||
MenuUserLogout = Logout
|
||||
|
||||
MenuLogin = Login
|
||||
MenuLoginName = Login Name
|
||||
MenuLoginPassword = Passwort
|
||||
|
||||
ScentenceNoLoginSpecified = Kein Login angegeben!
|
||||
ScentenceLoggedAsRoot = Eingeloggt als root!
|
||||
ScentenceLoginFailed = Login fehlgeschlagen!
|
||||
ScentenceLoginTimeoutExpired = Login Zeitlimit überschritten!
|
||||
ScentenceLoginSucceeded = Login erfolgreich.
|
||||
ScentenceNoUserRights = Sie besitzen nicht die nötigen Benutzerrechte!
|
||||
SentencePageNotFound = Die Seite wurde nicht gefunden!
|
||||
SentenceLoginForbidden = Dieser Login ist nicht erlaubt!
|
||||
SentencePasswordForbidden = Dieses Passwort ist nicht erlaubt!
|
||||
SentenceDatabaseError = Datenbank fehler!
|
||||
SentenceNewUserAdded = Neuer Benutzer wurde zugefügt.
|
||||
SentenceUserUpdated = Benutzereintrag wurde gespeichert.
|
||||
SentenceUserDeleted = Benutzer wurde gelöscht.
|
||||
SentencePasswordChangedWarning = Benutzer Passwort wurde geändert!
|
||||
SentenceTemplateNotFound = Das Template wurde nicht gefunden!
|
||||
SentenceLockIsActive = Dieser Posten ist durch einen anderen Benutzer gesperrt.
|
||||
SentenceUnknownError = Unbekannter Fehler!
|
||||
SentenceNestedListMoved = Das Element wurde verschoben.
|
||||
SentencePleaseSelectPartType = Bitte wählen sie den Typ des Bauteils.
|
||||
SentencePleaseSelectPartStorage = Bitte wählen sie den Lagerort des Bauteils.
|
||||
SentencePleaseSelectPackage = Bitte wählen sie den Gehäusetyp des Bauteils.
|
||||
SentencePleaseSpecifyPartValues = Bitte geben sie die Werte des Bauteils ein.
|
||||
SentenceNoNameOrValueOrDescriptionGiven = Kein Name, Wert oder Beschreibung angegeben!
|
||||
SentenceNewPartAdded = Neues Bauteil wurde der Datenbank hinzugefügt.
|
||||
SentencePartHasBeenUpdated = Bauteil wurde gespeichert.
|
||||
SentenceNoFileGiven = Keine Datei angegeben!
|
||||
SentenceNotEnoughDiskSpace = Nicht genügend Speicherplatz!
|
||||
SentenceFileAlreadyExist = Die Datei existiert bereits!
|
||||
SentenceCanNotCopyFile = Datei kann nicht kopiert werden!
|
||||
SentenceFileHasBeenUploaded = Datei wurde hochgeladen.
|
||||
SentenceDownloadEdited = Download wurde bearbeitet.
|
||||
SentenceDownloadDeleted = Download wurde gelöscht.
|
||||
SentenceShureToDeletePart = Sind sie sicher, dass sie das Bauteil aus der Datenbank löschen wollen?
|
||||
SentencePartDeleted = Bauteil wurde aus der Datenbank gelöscht.
|
||||
|
||||
TagTitleEditUserLogin = Benutzer login bearbeiten.
|
||||
TagTitleEditUserPassword = Passwort ändern oder frei lassen.
|
||||
TagTitleEditUserRight = Markieren setzt dieses Benutzerrecht.
|
||||
TagTitleDeleteUser = Benutzer löschen.
|
||||
TagTitleDeleteEntry = Eintrag löschen.
|
||||
TagTitleEdit = Eintrag bearbeiten.
|
||||
TagTitleDelete = Eintrag löschen.
|
||||
TagTitleCancel = Abbrechen
|
||||
TagTitleMove = Eintrag verschieben.
|
||||
TagTitleMoveUp = Eintrag nach oben verschieben.
|
||||
|
||||
ButtonEdit = Bearbeiten
|
||||
ButtonSave = Speichern
|
||||
ButtonNew = Neu
|
||||
ButtonProceed = Fortfahren
|
||||
ButtonUpload = Hochladen
|
||||
|
||||
UserSettingsTableHead = Benutzer Einstellungen
|
||||
UserSettingsSetNewPassword = Neues Passwort setzen
|
||||
UserSettingsConfirmNewPassword = Neues Passwort bestätigen
|
||||
UserSettingsLanguage = Sprache
|
||||
UserSettingsTemplate = Template
|
||||
UserSettingsDefault = Standart
|
||||
|
||||
EditVendorsId = Id
|
||||
EditVendorsName = Händler
|
||||
EditVendorsHomepage = Homepage
|
||||
EditVendorsMinBill = Mindestbestellwert
|
||||
EditVendorsShippingCost = Versandkosten
|
||||
EditVendorsEdit = Ändern
|
||||
EditVendorsSentenceVendorNameRequired = Name des Händlers wird benötigt!
|
||||
EditVendorsSentenceVendorNewAdded = Neuer Händler eingetragen.
|
||||
EditVendorsSentenceVendorDeleted = Händler gelöscht.
|
||||
EditVendorsSentenceVendorUpated = Händler geändert.
|
||||
|
||||
EditStoresNoStoreNameGiven = Sie müssen einen Namen für das Lager angeben!
|
||||
EditStoresNewStoreAdded = Neues Lager angelegt.
|
||||
EditStoresStoreDeleted = Lager gelöscht.
|
||||
|
||||
EditPackagesNoPackageNameGiven = Sie müssen einen Gehäusenamen angeben!
|
||||
EditPackagesNewPackageAdded = Neues Gehäuse hinzugefügt.
|
||||
EditPackagesPackageDeleted = Gehäuse gelöscht.
|
||||
|
||||
EditTypesNoTypeNameGiven = Sie müssen einen Typennamen angeben!
|
||||
EditTypesNewTypeAdded = Neuer Typ zugefügt.
|
||||
EditTypesTypeDeleted = Typ gelöscht.
|
||||
EditTypesName = Name
|
||||
EditTypesShortName = Abk.
|
||||
EditTypesNameValue1 = Wert1
|
||||
EditTypesNameValue2 = Wert2
|
||||
EditTypesNameValue3 = Wert2
|
||||
EditTypesUnitValue1 = Einheit1
|
||||
EditTypesUnitValue2 = Einheit2
|
||||
EditTypesUnitValue3 = Einheit3
|
||||
|
||||
PartsName = Name
|
||||
PartsShortDescription = kuzre Beschreibung
|
||||
PartsLongDescription = lange Beschreibung
|
||||
PartsVendor = Händler
|
||||
PartsManufactorLink = Hersteller Link
|
||||
PartsNotSpecified = nicht angegeben
|
||||
PartsVendorLink = Händler Link
|
||||
PartsPackageUnit = Verpackungseinheit
|
||||
PartsPrice = Preis
|
||||
PartsMinOrderQuantity = Mindestbestellmenge
|
||||
PartsQuantity = Aktuelle Anzahl
|
||||
PartsMinQuantity = Mindest Anzahl
|
||||
PartsPackage = Gehäuse
|
||||
PartsObsolete = Obsolet
|
||||
PartsObsoleteOnly = nur Obsolet
|
||||
PartsObsoleteNon = keine Obsolete
|
||||
PartsObsoleteAll = alle Bauteile
|
||||
PartsType = Typ
|
||||
PartsStorage = Lager
|
||||
PartsValues = Werte
|
||||
PartsDownloads = Downloads
|
||||
PartsPicture = Bild
|
||||
|
||||
DownloadsName = Name
|
||||
DownloadsPath = Pfad
|
||||
DownloadsSize = Größe
|
||||
DownloadsType = Typ
|
||||
|
||||
RepeatOrderPackagesToOrder = Bestellmenge
|
||||
RepeatOrderSumPrice = Gesamtpreis
|
||||
|
||||
ConsCheckCreateDatabaseStructure = Datenbank Struktur erzeugen
|
||||
ConsCheckRepairIncorrectType = Kaputte Bauteiltypen reparieren
|
||||
COnsCheckIncorrectTypeParts = Anzahl kaputter Bauteiltypen
|
||||
125
pages/add_part.php
Executable file
|
|
@ -0,0 +1,125 @@
|
|||
<?php
|
||||
|
||||
if (isset($_POST['NewPartType'])) $_SESSION['NewPartType'] = $_POST['NewPartType'];
|
||||
if (isset($_POST['NewPartStorage'])) $_SESSION['NewPartStorage'] = $_POST['NewPartStorage'];
|
||||
if (isset($_POST['NewPartPackage'])) $_SESSION['NewPartPackage'] = $_POST['NewPartPackage'];
|
||||
$_SESSION['NewPartObsolete'] = (isset($_POST['NewPartObsolete']))? $_POST['NewPartObsolete']:"";
|
||||
$_SESSION['NewPartName'] = (isset($_POST['NewPartName']))? $_POST['NewPartName']:"";
|
||||
$_SESSION['NewPartValue1'] = (isset($_POST['NewPartValue1']))? $_POST['NewPartValue1']:"";
|
||||
$_SESSION['NewPartValue2'] = (isset($_POST['NewPartValue2']))? $_POST['NewPartValue2']:"";
|
||||
$_SESSION['NewPartValue3'] = (isset($_POST['NewPartValue3']))? $_POST['NewPartValue3']:"";
|
||||
$_SESSION['NewPartShortDesc'] = (isset($_POST['NewPartShortDesc']))? $_POST['NewPartShortDesc']:"";
|
||||
$_SESSION['NewPartLongDesc'] = (isset($_POST['NewPartLongDesc']))? $_POST['NewPartLongDesc']:"";
|
||||
$_SESSION['NewPartVendor'] = (isset($_POST['NewPartVendor']))? $_POST['NewPartVendor']:"";
|
||||
$_SESSION['NewPartVedorLink'] = (isset($_POST['NewPartVedorLink']))? $_POST['NewPartVedorLink']:"";
|
||||
$_SESSION['NewPartManufactorLink'] = (isset($_POST['NewPartManufactorLink']))? $_POST['NewPartManufactorLink']:"";
|
||||
$_SESSION['NewPartPackageUnit'] = (isset($_POST['NewPartPackageUnit']))? $_POST['NewPartPackageUnit']:"";
|
||||
$_SESSION['NewPartPrice'] = (isset($_POST['NewPartPrice']))? $_POST['NewPartPrice']:"";
|
||||
$_SESSION['NewPartMinOrderQty'] = (isset($_POST['NewPartMinOrderQty']))? $_POST['NewPartMinOrderQty']:"";
|
||||
$_SESSION['NewPartQty'] = (isset($_POST['NewPartQty']))? $_POST['NewPartQty']:"";
|
||||
$_SESSION['NewPartMinQty'] = (isset($_POST['NewPartMinQty']))? $_POST['NewPartMinQty']:"";
|
||||
$AddNewPartSetp = (isset($_GET['AddNewPartSetp'])) ? $_GET['AddNewPartSetp']:"";
|
||||
|
||||
if (UserHasRight('EditParts'))
|
||||
{
|
||||
if ($AddNewPartSetp=="CreatePart")
|
||||
{
|
||||
if (!isset($_SESSION['NewPartPackage']) || !$_SESSION['NewPartPackage']) $AddNewPartSetp="SelectPackage" ;
|
||||
elseif (!isset($_SESSION['NewPartStorage']) || !$_SESSION['NewPartStorage']) $AddNewPartSetp="SelectStorage" ;
|
||||
elseif (!isset($_SESSION['NewPartType']) || !$_SESSION['NewPartType']) $AddNewPartSetp="" ;
|
||||
else
|
||||
{
|
||||
if (!$_SESSION['NewPartName'] && !$_SESSION['NewPartShortDesc'] && !$_SESSION['NewPartLongDesc']
|
||||
&& !$_SESSION['NewPartValue1'] && !$_SESSION['NewPartValue2'] && !$_SESSION['NewPartValue3'])
|
||||
{
|
||||
MessageError(LangSpell('SentenceNoNameOrValueOrDescriptionGiven'));
|
||||
ErrorLog("[add_part.php] No name, description or value given!");
|
||||
$AddNewPartSetp="SelectValues";
|
||||
}
|
||||
else
|
||||
{
|
||||
$InsertQuery = "INSERT INTO `Parts` (`Name`, `Value1`, `Value2`, `Value3`, `ShortDesc`, `LongDesc`"
|
||||
.", `TypeId`, `StorageId`, `PackageId`, `VendorId`, `VendorLink`, `ManufactorLink`"
|
||||
.", `PackageUnit`, `Price`, `MinOrderQty`, `Qty`, `MinQty`, `Obsolete`) VALUES "
|
||||
."('".$_SESSION['NewPartName']."', '".OtherSiPrefixToFloat ($_SESSION['NewPartValue1'])."'"
|
||||
.", '".OtherSiPrefixToFloat ($_SESSION['NewPartValue2'])."', '".OtherSiPrefixToFloat ($_SESSION['NewPartValue3'])."'"
|
||||
.", '".$_SESSION['NewPartShortDesc']."', '".$_SESSION['NewPartLongDesc']."'"
|
||||
.", '".$_SESSION['NewPartType']."', '".$_SESSION['NewPartStorage']."'"
|
||||
.", '".$_SESSION['NewPartPackage']."', '".$_SESSION['NewPartVendor']."'"
|
||||
.", '".$_SESSION['NewPartVedorLink']."', '".$_SESSION['NewPartManufactorLink']."'"
|
||||
.", '".$_SESSION['NewPartPackageUnit']."', '".OtherConvertToFloat ($_SESSION['NewPartPrice'])."'"
|
||||
.", '".$_SESSION['NewPartMinOrderQty']."', '".$_SESSION['NewPartQty']."'"
|
||||
.", '".$_SESSION['NewPartMinQty']."', '".((isset($_SESSION['NewPartObsolete']) && strtolower($_SESSION['NewPartObsolete'])=="true")? "True":"False")."');";
|
||||
global $GlobalMysqlHandler;
|
||||
if (mysqli_query($GlobalMysqlHandler, $InsertQuery))
|
||||
{
|
||||
unset($_SESSION['NewPartType'],$_SESSION['NewPartStorage'],$_SESSION['NewPartPackage']
|
||||
,$_SESSION['NewPartName'],$_SESSION['NewPartValue1'],$_SESSION['NewPartValue2']
|
||||
,$_SESSION['NewPartValue3'],$_SESSION['NewPartShortDesc'],$_SESSION['NewPartLongDesc']
|
||||
,$_SESSION['NewPartVendor'],$_SESSION['NewPartVedorLink'],$_SESSION['NewPartManufactorLink']
|
||||
,$_SESSION['NewPartPackageUnit'],$_SESSION['NewPartPrice'],$_SESSION['NewPartMinOrderQty']
|
||||
,$_SESSION['NewPartQty'],$_SESSION['NewPartMinQty']);
|
||||
$AddNewPartSetp = "";
|
||||
MessageSuccess(LangSpell('SentenceNewPartAdded'));
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageError(LangSpell('SentenceDatabaseError'));
|
||||
ErrorLog("[add_part.hp] Failed to Insert new part!");
|
||||
$AddNewPartSetp="SelectValues";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($AddNewPartSetp=="SelectValues")
|
||||
{
|
||||
if (isset($_SESSION['NewPartPackage']) && $_SESSION['NewPartPackage'])
|
||||
{
|
||||
include "./pages/add_part_values.php";
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageWarning(LangSpell('SentencePleaseSelectPackage'));
|
||||
$AddNewPartSetp="SelectPackage";
|
||||
}
|
||||
}
|
||||
|
||||
if ($AddNewPartSetp=="SelectPackage")
|
||||
{
|
||||
if (isset($_SESSION['NewPartStorage']) && $_SESSION['NewPartStorage'])
|
||||
{
|
||||
include "./pages/add_part_package.php";
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageWarning(LangSpell('SentencePleaseSelectPartStorage'));
|
||||
$AddNewPartSetp="SelectStorage";
|
||||
}
|
||||
}
|
||||
|
||||
if ($AddNewPartSetp=="SelectStorage")
|
||||
{
|
||||
if (isset($_SESSION['NewPartType']) && $_SESSION['NewPartType'])
|
||||
{
|
||||
include "./pages/add_part_storage.php";
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageWarning(LangSpell('SentencePleaseSelectPartType'));
|
||||
include "./pages/add_part_type.php";
|
||||
}
|
||||
}
|
||||
|
||||
if ($AddNewPartSetp=="")
|
||||
{
|
||||
$_SESSION['NewPartType'] = 0;
|
||||
$_SESSION['NewPartStorage'] = 0;
|
||||
include "./pages/add_part_type.php";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageError(LangSpell("ScentenceNoUserRights"));
|
||||
}
|
||||
?>
|
||||
73
pages/add_part_package.php
Executable file
|
|
@ -0,0 +1,73 @@
|
|||
<?php
|
||||
|
||||
$NewPartType = (isset($_POST['NewPartType']))? $_POST['NewPartType']:0;
|
||||
|
||||
function WritePackageList($ParentId, $ParentIsLocked)
|
||||
{
|
||||
global $GlobalMysqlHandler;
|
||||
global $GlobalContent;
|
||||
global $GlobalTemplate;
|
||||
global $EditTypesEditId;
|
||||
|
||||
$ListQuery="SELECT * FROM `Packages` WHERE `ParentId` =$ParentId";
|
||||
$ListQuery=mysqli_query($GlobalMysqlHandler, $ListQuery);
|
||||
|
||||
if (!$ParentId || NestedListVisibilityIsSet($ParentId, 'AddPartPackage'))
|
||||
$GlobalContent .= "<ul style=\"display:block;\">\n";
|
||||
else
|
||||
$GlobalContent .= "<ul style=\"display:none;\">\n";
|
||||
|
||||
if (mysqli_num_rows($ListQuery))
|
||||
{
|
||||
while ($ListData=mysqli_fetch_array($ListQuery))
|
||||
{
|
||||
$GlobalContent .= " <li>\n";
|
||||
if (LockIsActive('Types',$ListData['Id']) || $ParentIsLocked)
|
||||
{
|
||||
$GlobalContent .= OtherGetIcon('LockActive.png',0);
|
||||
$ParentIsLocked = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$GlobalContent .= ' <input type="radio" name="NewPartPackage" value="'.$ListData['Id'].'">';
|
||||
}
|
||||
$GlobalContent .= " <a href=\"index.php?Page=AddPart&AddNewPartSetp=SelectPackage&ToDo=OpenSublist&SublistId=".$ListData['Id']."\">".LangStr2Html($ListData['Name'])."</a>";
|
||||
$GlobalContent .= " (".NestedListCountSubElements($ListData['Id'],'Packages').")";
|
||||
$GlobalContent .= " \n</li>\n";
|
||||
|
||||
WritePackageList($ListData['Id'],$ParentIsLocked);
|
||||
}
|
||||
}
|
||||
$GlobalContent .= "</ul>\n";
|
||||
}
|
||||
|
||||
|
||||
if (UserHasRight('EditParts'))
|
||||
{
|
||||
///////////////
|
||||
// open sublist
|
||||
if ($ToDo=="OpenSublist")
|
||||
{
|
||||
if (isset($_GET['SublistId']) && $_GET['SublistId'])
|
||||
{
|
||||
NestedListVisibilityToggle($_GET['SublistId'], 'AddPartPackage');
|
||||
}
|
||||
else
|
||||
{
|
||||
ErrorLog("[add_part1.php] No SublistId to open type!");
|
||||
MessageError(LangSpell('SentenceUnknownError'));
|
||||
}
|
||||
$ToDo="";
|
||||
}
|
||||
|
||||
$GlobalContent .= '<h1>'.LangSpellHtml('SentencePleaseSelectPackage').'</h1>';
|
||||
$GlobalContent .= '<form action="index.php?Page=AddPart&AddNewPartSetp=SelectValues" method="post">';
|
||||
WritePackageList(0, 0);
|
||||
$GlobalContent .= '<input type="submit" value="'.LangSpellHtml('ButtonProceed').'"class="Button">';
|
||||
$GlobalContent .= '</form>';
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageError(LangSpell("ScentenceNoUserRights"));
|
||||
}
|
||||
?>
|
||||
73
pages/add_part_storage.php
Executable file
|
|
@ -0,0 +1,73 @@
|
|||
<?php
|
||||
|
||||
$NewPartType = (isset($_POST['NewPartType']))? $_POST['NewPartType']:0;
|
||||
|
||||
function WriteStorageList($ParentId, $ParentIsLocked)
|
||||
{
|
||||
global $GlobalMysqlHandler;
|
||||
global $GlobalContent;
|
||||
global $GlobalTemplate;
|
||||
global $EditTypesEditId;
|
||||
|
||||
$ListQuery="SELECT * FROM `Storages` WHERE `ParentId` =$ParentId";
|
||||
$ListQuery=mysqli_query($GlobalMysqlHandler, $ListQuery);
|
||||
|
||||
if (!$ParentId || NestedListVisibilityIsSet($ParentId, 'AddPartStorage'))
|
||||
$GlobalContent .= "<ul style=\"display:block;\">\n";
|
||||
else
|
||||
$GlobalContent .= "<ul style=\"display:none;\">\n";
|
||||
|
||||
if (mysqli_num_rows($ListQuery))
|
||||
{
|
||||
while ($ListData=mysqli_fetch_array($ListQuery))
|
||||
{
|
||||
$GlobalContent .= " <li>\n";
|
||||
if (LockIsActive('Types',$ListData['Id']) || $ParentIsLocked)
|
||||
{
|
||||
$GlobalContent .= OtherGetIcon('LockActive.png',0);
|
||||
$ParentIsLocked = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$GlobalContent .= ' <input type="radio" name="NewPartStorage" value="'.$ListData['Id'].'">';
|
||||
}
|
||||
$GlobalContent .= " <a href=\"index.php?Page=AddPart&AddNewPartSetp=SelectStorage&ToDo=OpenSublist&SublistId=".$ListData['Id']."\">".LangStr2Html($ListData['Name'])."</a>";
|
||||
$GlobalContent .= " (".NestedListCountSubElements($ListData['Id'],'Storages').")";
|
||||
$GlobalContent .= " \n</li>\n";
|
||||
|
||||
WriteStorageList($ListData['Id'],$ParentIsLocked);
|
||||
}
|
||||
}
|
||||
$GlobalContent .= "</ul>\n";
|
||||
}
|
||||
|
||||
|
||||
if (UserHasRight('EditParts'))
|
||||
{
|
||||
///////////////
|
||||
// open sublist
|
||||
if ($ToDo=="OpenSublist")
|
||||
{
|
||||
if (isset($_GET['SublistId']) && $_GET['SublistId'])
|
||||
{
|
||||
NestedListVisibilityToggle($_GET['SublistId'], 'AddPartStorage');
|
||||
}
|
||||
else
|
||||
{
|
||||
ErrorLog("[add_part1.php] No SublistId to open type!");
|
||||
MessageError(LangSpell('SentenceUnknownError'));
|
||||
}
|
||||
$ToDo="";
|
||||
}
|
||||
|
||||
$GlobalContent .= '<h1>'.LangSpellHtml('SentencePleaseSelectPartStorage').'</h1>';
|
||||
$GlobalContent .= '<form action="index.php?Page=AddPart&AddNewPartSetp=SelectPackage" method="post">';
|
||||
WriteStorageList(0, 0);
|
||||
$GlobalContent .= '<input type="submit" value="'.LangSpellHtml('ButtonProceed').'"class="Button">';
|
||||
$GlobalContent .= '</form>';
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageError(LangSpell("ScentenceNoUserRights"));
|
||||
}
|
||||
?>
|
||||
75
pages/add_part_type.php
Executable file
|
|
@ -0,0 +1,75 @@
|
|||
<?php
|
||||
|
||||
function WriteTypeList($ParentId, $ParentIsLocked)
|
||||
{
|
||||
global $GlobalMysqlHandler;
|
||||
global $GlobalContent;
|
||||
global $GlobalTemplate;
|
||||
global $EditTypesEditId;
|
||||
|
||||
$ListQuery="SELECT * FROM `Types` WHERE `ParentId` =$ParentId";
|
||||
$ListQuery=mysqli_query($GlobalMysqlHandler, $ListQuery);
|
||||
|
||||
if (!$ParentId || NestedListVisibilityIsSet($ParentId, 'AddPartType'))
|
||||
$GlobalContent .= "<ul style=\"display:block;\">\n";
|
||||
else
|
||||
$GlobalContent .= "<ul style=\"display:none;\">\n";
|
||||
|
||||
if (mysqli_num_rows($ListQuery))
|
||||
{
|
||||
while ($ListData=mysqli_fetch_array($ListQuery))
|
||||
{
|
||||
$GlobalContent .= " <li>\n";
|
||||
if (LockIsActive('Types',$ListData['Id']) || $ParentIsLocked)
|
||||
{
|
||||
$GlobalContent .= OtherGetIcon('LockActive',0);
|
||||
$ParentIsLocked = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$GlobalContent .= ' <input type="radio" name="NewPartType" value="'.$ListData['Id'].'">';
|
||||
}
|
||||
$GlobalContent .= " <a href=\"index.php?Page=AddPart&ToDo=OpenSublist&SublistId=".$ListData['Id']."\">".LangStr2Html($ListData['Name']);
|
||||
if (strlen($ListData['ShortName'])) $GlobalContent .= " [".LangStr2Html($ListData['ShortName'])."]";
|
||||
$GlobalContent .= "</a>";
|
||||
$GlobalContent .= " (".NestedListCountSubElements($ListData['Id'],'Types').")";
|
||||
$GlobalContent .= " \n</li>\n";
|
||||
|
||||
WriteTypeList($ListData['Id'],$ParentIsLocked);
|
||||
}
|
||||
}
|
||||
$GlobalContent .= "</ul>\n";
|
||||
}
|
||||
|
||||
|
||||
if (UserHasRight('EditParts'))
|
||||
{
|
||||
///////////////
|
||||
// open sublist
|
||||
if ($ToDo=="OpenSublist")
|
||||
{
|
||||
if (isset($_GET['SublistId']) && $_GET['SublistId'])
|
||||
{
|
||||
NestedListVisibilityToggle($_GET['SublistId'], 'AddPartType');
|
||||
}
|
||||
else
|
||||
{
|
||||
ErrorLog("[add_part1.php] No SublistId to open type!");
|
||||
MessageError(LangSpell('SentenceUnknownError'));
|
||||
}
|
||||
$ToDo="";
|
||||
}
|
||||
|
||||
//////////
|
||||
// Content
|
||||
$GlobalContent .= '<h1>'.LangSpellHtml('SentencePleaseSelectPartType').'</h1>';
|
||||
$GlobalContent .= '<form action="index.php?Page=AddPart&AddNewPartSetp=SelectStorage" method="post">';
|
||||
WriteTypeList(0, 0);
|
||||
$GlobalContent .= '<input type="submit" value="'.LangSpellHtml('ButtonProceed').'"class="Button">';
|
||||
$GlobalContent .= '</form>';
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageError(LangSpell("ScentenceNoUserRights"));
|
||||
}
|
||||
?>
|
||||
107
pages/add_part_values.php
Executable file
|
|
@ -0,0 +1,107 @@
|
|||
<?php
|
||||
|
||||
if (UserHasRight('EditParts'))
|
||||
{
|
||||
global $GlobalMysqlHandler;
|
||||
|
||||
/////////////
|
||||
// Type Array
|
||||
$TypeQuery = "SELECT * FROM `Types` WHERE `Id` = ".$_SESSION['NewPartType'];
|
||||
$TypeQuery = mysqli_query($GlobalMysqlHandler, $TypeQuery);
|
||||
$TypeValues = array();
|
||||
if (mysqli_num_rows($TypeQuery))
|
||||
{
|
||||
$TypeItem = mysql_fetch_array($TypeQuery);
|
||||
$TypeValues[0][0] = $TypeItem['NameValue1'];
|
||||
$TypeValues[0][1] = $TypeItem['UnitValue1'];
|
||||
$TypeValues[1][0] = $TypeItem['NameValue2'];
|
||||
$TypeValues[1][1] = $TypeItem['UnitValue2'];
|
||||
$TypeValues[2][0] = $TypeItem['NameValue3'];
|
||||
$TypeValues[2][1] = $TypeItem['UnitValue3'];
|
||||
}
|
||||
|
||||
//////////////
|
||||
// Value Table
|
||||
|
||||
$GlobalContent .= '<h1>'.LangSpellHtml('SentencePleaseSpecifyPartValues').'</h1>';
|
||||
$GlobalContent .= '<form action="index.php?Page=AddPart&AddNewPartSetp=CreatePart" method="post">';
|
||||
$GlobalContent .= '<table>';
|
||||
|
||||
$GlobalContent .= '<tr><th>'.LangSpellHtml('PartsObsolete').'</th><td>';
|
||||
$GlobalContent .= '<input type="checkbox" name="NewPartObsolete" value="True" '.((isset($_SESSION['NewPartObsolete']) && strtolower($_SESSION['NewPartObsolete'])=="true")? "checked":"").'"></td></tr>';
|
||||
|
||||
$GlobalContent .= '<tr><th>'.LangSpellHtml('PartsName').'</th><td>';
|
||||
$GlobalContent .= '<input type="text" name="NewPartName" value="'.((isset($_SESSION['NewPartName']))? $_SESSION['NewPartName']:"").'"></td></tr>';
|
||||
|
||||
if ($TypeValues[0][0])
|
||||
{
|
||||
$GlobalContent .= '<tr><th>'.$TypeValues[0][0].'</th><td>';
|
||||
$GlobalContent .= '<input type="text" name="NewPartValue1" value="'.((isset($_SESSION['NewPartValue1']))? $_SESSION['NewPartValue1']:"").'"></td>';
|
||||
$GlobalContent .= '<td> '.$TypeValues[0][1].'</td></tr>';
|
||||
}
|
||||
|
||||
if ($TypeValues[1][0])
|
||||
{
|
||||
$GlobalContent .= '<tr><th>'.$TypeValues[1][0].'</th><td>';
|
||||
$GlobalContent .= '<input type="text" name="NewPartValue2" value="'.((isset($_SESSION['NewPartValue2']))? $_SESSION['NewPartValue2']:"").'"></td>';
|
||||
$GlobalContent .= '<td> '.$TypeValues[1][1].'</td></tr>';
|
||||
}
|
||||
|
||||
if ($TypeValues[2][0])
|
||||
{
|
||||
$GlobalContent .= '<tr><th>'.$TypeValues[2][0].'</th><td>';
|
||||
$GlobalContent .= '<input type="text" name="NewPartValue3" value="'.((isset($_SESSION['NewPartValue3']))? $_SESSION['NewPartValue3']:"").'"></td>';
|
||||
$GlobalContent .= '<td> '.$TypeValues[2][1].'</td></tr>';
|
||||
}
|
||||
|
||||
$GlobalContent .= '<tr><th>'.LangSpellHtml('PartsShortDescription').'</th><td>';
|
||||
$GlobalContent .= '<input type="text" name="NewPartShortDesc" value="'.((isset($_SESSION['NewPartShortDesc']))? $_SESSION['NewPartShortDesc']:"").'"></td></tr>';
|
||||
|
||||
$GlobalContent .= '<tr><th>'.LangSpellHtml('PartsLongDescription').'</th><td>';
|
||||
$GlobalContent .= '<textarea name="NewPartLongDesc">'.((isset($_SESSION['NewPartLongDesc']))? $_SESSION['NewPartLongDesc']:"").'</textarea></td></tr>';
|
||||
|
||||
$GlobalContent .= '<tr><th>'.LangSpellHtml('PartsVendor').'</th><td>';
|
||||
$GlobalContent .= '<select name="NewPartVendor">';
|
||||
$VendorQuery = "SELECT `Id`,`Name` FROM `Vendors` ORDER BY `Name` ASC";
|
||||
$GlobalContent .= '<option value="0">'.LangSpellHtml('PartsNotSpecified').'</option>';
|
||||
$VendorQuery = mysqli_query($GlobalMysqlHandler, $VendorQuery);
|
||||
while ($VendorData = mysqli_fetch_array($VendorQuery))
|
||||
{
|
||||
$Selected = (isset($_SESSION['NewPartVendor']) && ($_SESSION['NewPartVendor']==$VendorData['Id']))? "selected":"";
|
||||
$GlobalContent .= '<option value="'.$VendorData['Id'].'" '.$Selected.'>'.$VendorData['Name'].'</option>';
|
||||
}
|
||||
$GlobalContent .= '</select></td></tr>';
|
||||
|
||||
$GlobalContent .= '<tr><th>'.LangSpellHtml('PartsVendorLink').'</th><td>';
|
||||
$GlobalContent .= '<input type="text" name="NewPartVedorLink" value="'.((isset($_SESSION['NewPartVedorLink']))? $_SESSION['NewPartVedorLink']:"").'"></td></tr>';
|
||||
|
||||
$GlobalContent .= '<tr><th>'.LangSpellHtml('PartsManufactorLink').'</th><td>';
|
||||
$GlobalContent .= '<input type="text" name="NewPartManufactorLink" value="'.((isset($_SESSION['NewPartManufactorLink']))? $_SESSION['NewPartManufactorLink']:"").'"></td></tr>';
|
||||
|
||||
$GlobalContent .= '<tr><th>'.LangSpellHtml('PartsPackageUnit').'</th><td>';
|
||||
$GlobalContent .= '<input type="text" name="NewPartPackageUnit" value="'.((isset($_SESSION['NewPartPackageUnit']))? $_SESSION['NewPartPackageUnit']:"").'"></td></tr>';
|
||||
|
||||
$GlobalContent .= '<tr><th>'.LangSpellHtml('PartsPrice').'</th><td>';
|
||||
$GlobalContent .= '<input type="text" name="NewPartPrice" value="'.((isset($_SESSION['NewPartPrice']))? $_SESSION['NewPartPrice']:"").'"></td></tr>';
|
||||
|
||||
$GlobalContent .= '<tr><th>'.LangSpellHtml('PartsMinOrderQuantity').'</th><td>';
|
||||
$GlobalContent .= '<input type="text" name="NewPartMinOrderQty" value="'.((isset($_SESSION['NewPartMinOrderQty']))? $_SESSION['NewPartMinOrderQty']:"").'"></td></tr>';
|
||||
|
||||
$GlobalContent .= '<tr><th>'.LangSpellHtml('PartsQuantity').'</th><td>';
|
||||
$GlobalContent .= '<input type="text" name="NewPartQty" value="'.((isset($_SESSION['NewPartQty']))? $_SESSION['NewPartQty']:"").'"></td></tr>';
|
||||
|
||||
$GlobalContent .= '<tr><th>'.LangSpellHtml('PartsMinQuantity').'</th><td>';
|
||||
$GlobalContent .= '<input type="text" name="NewPartMinQty" value="'.((isset($_SESSION['NewPartMinQty']))? $_SESSION['NewPartMinQty']:"").'"></td></tr>';
|
||||
|
||||
$GlobalContent .= '<tr><th></th><td>';
|
||||
$GlobalContent .= '<input type="submit" value="'.LangSpellHtml('ButtonProceed').'"class="Button">';
|
||||
$GlobalContent .= '</td></tr>';
|
||||
|
||||
$GlobalContent .= '</table>';
|
||||
$GlobalContent .= '</form>';
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageError(LangSpell("ScentenceNoUserRights"));
|
||||
}
|
||||
?>
|
||||
4
pages/consistency_check.php
Executable file
|
|
@ -0,0 +1,4 @@
|
|||
<?php
|
||||
include "./pages/consistency_check_databse.php";
|
||||
include "./pages/consistency_check_incorrect_types.php";
|
||||
?>
|
||||
146
pages/consistency_check_databse.php
Executable file
|
|
@ -0,0 +1,146 @@
|
|||
<?php
|
||||
////////////////////////////
|
||||
// create database structure
|
||||
if (UserGetLogin()=="root")
|
||||
{
|
||||
if ($ToDo=="CreateDbStructure")
|
||||
{
|
||||
$CheckHandler=mysqli_connect($GlobalMysqlHost,$GlobalMysqlUser,$GlobalMysqlPwd);
|
||||
if (!$CheckHandler)
|
||||
{
|
||||
MessageError("Can not connect to database, check config!");
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageSuccess("Database connection successful.");
|
||||
$DatabaseExists = 0;
|
||||
if (mysqli_select_db$CheckHandler, ($GlobalMysqlDatabase)) $DatabaseExists=1;
|
||||
if (!$DatabaseExists)
|
||||
{
|
||||
if (mysqli_query($CheckHandler, "CREATE DATABASE `$GlobalMysqlDatabase` ;")) $DatabaseExists=1;
|
||||
else MessageError("Can not create database!");
|
||||
}
|
||||
if (mysqli_select_db($CheckHandler, $GlobalMysqlDatabase)) $DatabaseExists=1;
|
||||
if ($DatabaseExists)
|
||||
{
|
||||
////////////////
|
||||
// create tables
|
||||
mysqli_query($CheckHandler, 'SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";');
|
||||
//Downloads
|
||||
mysqli_query($CheckHandler, 'CREATE TABLE IF NOT EXISTS `Downloads` ( `Id` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`Id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; ');
|
||||
mysqli_query($CheckHandler, 'ALTER TABLE `Downloads` ADD `Id` int(11) NOT NULL AUTO_INCREMENT');
|
||||
mysqli_query($CheckHandler, 'ALTER TABLE `Downloads` DROP PRIMARY KEY , ADD PRIMARY KEY ( `Id` )');
|
||||
mysqli_query($CheckHandler, 'ALTER TABLE `Downloads` CHANGE `Id` `Id` INT( 11 ) NOT NULL AUTO_INCREMENT ');
|
||||
mysqli_query($CheckHandler, 'ALTER TABLE `Downloads` ADD `PartId` int(11) NOT NULL');
|
||||
mysqli_query($CheckHandler, 'ALTER TABLE `Downloads` ADD `Name` varchar(200) COLLATE utf8_unicode_ci NOT NULL');
|
||||
mysqli_query($CheckHandler, 'ALTER TABLE `Downloads` ADD `Path` varchar(200) COLLATE utf8_unicode_ci NOT NULL');
|
||||
mysqli_query($CheckHandler, 'ALTER TABLE `Downloads` ADD `Type` varchar(200) COLLATE utf8_unicode_ci NOT NULL');
|
||||
//Packages
|
||||
mysqli_query($CheckHandler, 'CREATE TABLE IF NOT EXISTS `Packages` ( `Id` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`Id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; ');
|
||||
mysqli_query($CheckHandler, 'ALTER TABLE `Packages` ADD `Id` int(11) NOT NULL AUTO_INCREMENT');
|
||||
mysqli_query($CheckHandler, 'ALTER TABLE `Packages` DROP PRIMARY KEY , ADD PRIMARY KEY ( `Id` )');
|
||||
mysqli_query($CheckHandler, 'ALTER TABLE `Packages` CHANGE `Id` `Id` INT( 11 ) NOT NULL AUTO_INCREMENT ');
|
||||
mysqli_query($CheckHandler, 'ALTER TABLE `Packages` ADD `Name` varchar(100) COLLATE utf8_unicode_ci NOT NULL');
|
||||
mysqli_query($CheckHandler, 'ALTER TABLE `Packages` ADD `ParentId` int(11) NOT NULL');
|
||||
mysqli_query($CheckHandler, 'ALTER TABLE `Packages` ADD `LockId` int(11) NOT NULL');
|
||||
mysqli_query($CheckHandler, 'ALTER TABLE `Packages` ADD `LockTime` int(11) NOT NULL');
|
||||
//Parts
|
||||
mysqli_query($CheckHandler, 'CREATE TABLE IF NOT EXISTS `Parts` ( `Id` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`Id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; ');
|
||||
mysqli_query($CheckHandler, 'ALTER TABLE `Parts` ADD `Id` int(11) NOT NULL AUTO_INCREMENT');
|
||||
mysqli_query($CheckHandler, 'ALTER TABLE `Parts` DROP PRIMARY KEY , ADD PRIMARY KEY ( `Id` )');
|
||||
mysqli_query($CheckHandler, 'ALTER TABLE `Parts` CHANGE `Id` `Id` INT( 11 ) NOT NULL AUTO_INCREMENT ');
|
||||
mysqli_query($CheckHandler, 'ALTER TABLE `Parts` ADD `Name` varchar(100) COLLATE utf8_unicode_ci NOT NULL');
|
||||
mysqli_query($CheckHandler, 'ALTER TABLE `Parts` ADD `Value1` float NOT NULL');
|
||||
mysqli_query($CheckHandler, 'ALTER TABLE `Parts` ADD `Value2` float NOT NULL');
|
||||
mysqli_query($CheckHandler, 'ALTER TABLE `Parts` ADD `Value3` float NOT NULL');
|
||||
mysqli_query($CheckHandler, 'ALTER TABLE `Parts` ADD `ShortDesc` varchar(250) COLLATE utf8_unicode_ci NOT NULL');
|
||||
mysqli_query($CheckHandler, 'ALTER TABLE `Parts` ADD `LongDesc` text COLLATE utf8_unicode_ci NOT NULL');
|
||||
mysqli_query($CheckHandler, 'ALTER TABLE `Parts` ADD `TypeId` int(11) NOT NULL');
|
||||
mysqli_query($CheckHandler, 'ALTER TABLE `Parts` ADD `StorageId` int(11) NOT NULL');
|
||||
mysqli_query($CheckHandler, 'ALTER TABLE `Parts` ADD `PackageId` int(11) NOT NULL');
|
||||
mysqli_query($CheckHandler, 'ALTER TABLE `Parts` ADD `VendorId` int(11) NOT NULL');
|
||||
mysqli_query($CheckHandler, 'ALTER TABLE `Parts` ADD `VendorLink` varchar(250) COLLATE utf8_unicode_ci NOT NULL');
|
||||
mysqli_query($CheckHandler, 'ALTER TABLE `Parts` ADD `ManufactorLink` varchar(250) COLLATE utf8_unicode_ci NOT NULL');
|
||||
mysqli_query($CheckHandler, 'ALTER TABLE `Parts` ADD `PackageUnit` int(11) NOT NULL DEFAULT \'1\'');
|
||||
mysqli_query($CheckHandler, 'ALTER TABLE `Parts` ADD `Price` float NOT NULL');
|
||||
mysqli_query($CheckHandler, 'ALTER TABLE `Parts` ADD `MinOrderQty` int(11) NOT NULL');
|
||||
mysqli_query($CheckHandler, 'ALTER TABLE `Parts` ADD `Qty` int(11) NOT NULL');
|
||||
mysqli_query($CheckHandler, 'ALTER TABLE `Parts` ADD `MinQty` int(11) NOT NULL');
|
||||
mysqli_query($CheckHandler, 'ALTER TABLE `Parts` ADD `Obsolete` enum(\'False\',\'True\') COLLATE utf8_unicode_ci NOT NULL');
|
||||
mysqli_query($CheckHandler, 'ALTER TABLE `Parts` ADD `PicturePath` varchar(200) COLLATE utf8_unicode_ci NOT NULL');
|
||||
mysqli_query($CheckHandler, 'ALTER TABLE `Parts` ADD `LockId` int(11) NOT NULL');
|
||||
mysqli_query($CheckHandler, 'ALTER TABLE `Parts` ADD `LockTime` int(11) NOT NULL');
|
||||
//Storages
|
||||
mysqli_query($CheckHandler, 'CREATE TABLE IF NOT EXISTS `Storages` ( `Id` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`Id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; ');
|
||||
mysqli_query($CheckHandler, 'ALTER TABLE `Storages` ADD `Id` int(11) NOT NULL AUTO_INCREMENT');
|
||||
mysqli_query($CheckHandler, 'ALTER TABLE `Storages` DROP PRIMARY KEY , ADD PRIMARY KEY ( `Id` )');
|
||||
mysqli_query($CheckHandler, 'ALTER TABLE `Storages` CHANGE `Id` `Id` INT( 11 ) NOT NULL AUTO_INCREMENT ');
|
||||
mysqli_query($CheckHandler, 'ALTER TABLE `Storages` ADD `Name` varchar(100) COLLATE utf8_unicode_ci NOT NULL');
|
||||
mysqli_query($CheckHandler, 'ALTER TABLE `Storages` ADD `ParentId` int(11) NOT NULL');
|
||||
mysqli_query($CheckHandler, 'ALTER TABLE `Storages` ADD `LockId` int(11) NOT NULL');
|
||||
mysqli_query($CheckHandler, 'ALTER TABLE `Storages` ADD `LockTime` int(11) NOT NULL');
|
||||
//Types
|
||||
mysqli_query($CheckHandler, 'CREATE TABLE IF NOT EXISTS `Types` ( `Id` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`Id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; ');
|
||||
mysqli_query($CheckHandler, 'ALTER TABLE `Types` ADD `Id` int(11) NOT NULL AUTO_INCREMENT');
|
||||
mysqli_query($CheckHandler, 'ALTER TABLE `Types` DROP PRIMARY KEY , ADD PRIMARY KEY ( `Id` )');
|
||||
mysqli_query($CheckHandler, 'ALTER TABLE `Types` CHANGE `Id` `Id` INT( 11 ) NOT NULL AUTO_INCREMENT ');
|
||||
mysqli_query($CheckHandler, 'ALTER TABLE `Types` ADD `Name` varchar(100) COLLATE utf8_unicode_ci NOT NULL');
|
||||
mysqli_query($CheckHandler, 'ALTER TABLE `Types` ADD `ShortName` varchar(10) COLLATE utf8_unicode_ci NOT NULL');
|
||||
mysqli_query($CheckHandler, 'ALTER TABLE `Types` ADD `NameValue1` varchar(50) COLLATE utf8_unicode_ci NOT NULL');
|
||||
mysqli_query($CheckHandler, 'ALTER TABLE `Types` ADD `UnitValue1` varchar(20) COLLATE utf8_unicode_ci NOT NULL');
|
||||
mysqli_query($CheckHandler, 'ALTER TABLE `Types` ADD `NameValue2` varchar(50) COLLATE utf8_unicode_ci NOT NULL');
|
||||
mysqli_query($CheckHandler, 'ALTER TABLE `Types` ADD `UnitValue2` varchar(20) COLLATE utf8_unicode_ci NOT NULL');
|
||||
mysqli_query($CheckHandler, 'ALTER TABLE `Types` ADD `NameValue3` varchar(50) COLLATE utf8_unicode_ci NOT NULL');
|
||||
mysqli_query($CheckHandler, 'ALTER TABLE `Types` ADD `UnitValue3` varchar(20) COLLATE utf8_unicode_ci NOT NULL');
|
||||
mysqli_query($CheckHandler, 'ALTER TABLE `Types` ADD `ParentId` int(11) NOT NULL');
|
||||
mysqli_query($CheckHandler, 'ALTER TABLE `Types` ADD `LockId` int(11) NOT NULL');
|
||||
mysqli_query($CheckHandler, 'ALTER TABLE `Types` ADD `LockTime` int(11) NOT NULL');
|
||||
//User
|
||||
mysqli_query($CheckHandler, 'CREATE TABLE IF NOT EXISTS `User` ( `Id` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`Id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; ');
|
||||
mysqli_query($CheckHandler, 'ALTER TABLE `User` ADD `Id` int(11) NOT NULL AUTO_INCREMENT');
|
||||
mysqli_query($CheckHandler, 'ALTER TABLE `User` DROP PRIMARY KEY , ADD PRIMARY KEY ( `Id` )');
|
||||
mysqli_query($CheckHandler, 'ALTER TABLE `User` CHANGE `Id` `Id` INT( 11 ) NOT NULL AUTO_INCREMENT ');
|
||||
mysqli_query($CheckHandler, 'ALTER TABLE `User` ADD `Login` varchar(100) COLLATE utf8_unicode_ci NOT NULL');
|
||||
mysqli_query($CheckHandler, 'ALTER TABLE `User` ADD `Password` varchar(35) COLLATE utf8_unicode_ci NOT NULL');
|
||||
mysqli_query($CheckHandler, 'ALTER TABLE `User` ADD `Template` varchar(100) COLLATE utf8_unicode_ci NOT NULL');
|
||||
mysqli_query($CheckHandler, 'ALTER TABLE `User` ADD `Language` varchar(100) COLLATE utf8_unicode_ci NOT NULL');
|
||||
//UserRights
|
||||
mysqli_query($CheckHandler, 'CREATE TABLE IF NOT EXISTS `UserRights` ( `Id` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`Id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; ');
|
||||
mysqli_query($CheckHandler, 'ALTER TABLE `UserRights` ADD `Id` int(11) NOT NULL AUTO_INCREMENT');
|
||||
mysqli_query($CheckHandler, 'ALTER TABLE `UserRights` DROP PRIMARY KEY , ADD PRIMARY KEY ( `Id` )');
|
||||
mysqli_query($CheckHandler, 'ALTER TABLE `UserRights` CHANGE `Id` `Id` INT( 11 ) NOT NULL AUTO_INCREMENT ');
|
||||
mysqli_query($CheckHandler, 'ALTER TABLE `UserRights` ADD `EditStores` enum(\'False\',\'True\') COLLATE utf8_unicode_ci NOT NULL DEFAULT \'False\'');
|
||||
mysqli_query($CheckHandler, 'ALTER TABLE `UserRights` ADD `EditTypes` enum(\'False\',\'True\') COLLATE utf8_unicode_ci NOT NULL DEFAULT \'False\'');
|
||||
mysqli_query($CheckHandler, 'ALTER TABLE `UserRights` ADD `EditPackages` enum(\'False\',\'True\') COLLATE utf8_unicode_ci NOT NULL DEFAULT \'False\'');
|
||||
mysqli_query($CheckHandler, 'ALTER TABLE `UserRights` ADD `EditVendors` enum(\'False\',\'True\') COLLATE utf8_unicode_ci NOT NULL DEFAULT \'False\'');
|
||||
mysqli_query($CheckHandler, 'ALTER TABLE `UserRights` ADD `ViewSTPV` enum(\'False\',\'True\') COLLATE utf8_unicode_ci NOT NULL');
|
||||
mysqli_query($CheckHandler, 'ALTER TABLE `UserRights` ADD `EditParts` enum(\'False\',\'True\') COLLATE utf8_unicode_ci NOT NULL');
|
||||
mysqli_query($CheckHandler, 'ALTER TABLE `UserRights` ADD `EditPartQuantity` enum(\'False\',\'True\') COLLATE utf8_unicode_ci NOT NULL');
|
||||
mysqli_query($CheckHandler, 'ALTER TABLE `UserRights` ADD `ConsistencyCheck` enum(\'False\',\'True\') COLLATE utf8_unicode_ci NOT NULL');
|
||||
//Vendors
|
||||
mysqli_query($CheckHandler, 'CREATE TABLE IF NOT EXISTS `Vendors` ( `Id` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`Id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; ');
|
||||
mysqli_query($CheckHandler, 'ALTER TABLE `Vendors` ADD `Id` int(11) NOT NULL AUTO_INCREMENT');
|
||||
mysqli_query($CheckHandler, 'ALTER TABLE `Vendors` DROP PRIMARY KEY , ADD PRIMARY KEY ( `Id` )');
|
||||
mysqli_query($CheckHandler, 'ALTER TABLE `Vendors` CHANGE `Id` `Id` INT( 11 ) NOT NULL AUTO_INCREMENT ');
|
||||
mysqli_query($CheckHandler, 'ALTER TABLE `Vendors` ADD `Name` varchar(200) COLLATE utf8_unicode_ci NOT NULL');
|
||||
mysqli_query($CheckHandler, 'ALTER TABLE `Vendors` ADD `Homepage` varchar(200) COLLATE utf8_unicode_ci NOT NULL');
|
||||
mysqli_query($CheckHandler, 'ALTER TABLE `Vendors` ADD `MinBill` float NOT NULL');
|
||||
mysqli_query($CheckHandler, 'ALTER TABLE `Vendors` ADD `ShippingCost` float NOT NULL');
|
||||
mysqli_query($CheckHandler, 'ALTER TABLE `Vendors` ADD `LockId` int(11) NOT NULL');
|
||||
mysqli_query($CheckHandler, 'ALTER TABLE `Vendors` ADD `LockTime` int(11) NOT NULL');
|
||||
|
||||
mysqli_close($CheckHandler);
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageError("No database to operate!");
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$GlobalContent .= "<h1>".LangSpellHtml('ConsCheckCreateDatabaseStructure')."</h1>";
|
||||
$GlobalContent .= '<a href="index.php?Page=ConsistencyCheck&ToDo=CreateDbStructure" class="Button">'.LangSpellHtml('ButtonProceed').'</a>';
|
||||
}
|
||||
}
|
||||
?>
|
||||
81
pages/consistency_check_incorrect_types.php
Executable file
|
|
@ -0,0 +1,81 @@
|
|||
<?php
|
||||
//////////////
|
||||
// check types
|
||||
global $GlobalMysqlHandler;
|
||||
|
||||
function ElementExistInArray ( $Array, $Element )
|
||||
{
|
||||
$RetVal=0;
|
||||
foreach ($Array as $x)
|
||||
{
|
||||
if ($x==$Element) $RetVal=1;
|
||||
}
|
||||
return $RetVal;
|
||||
}
|
||||
|
||||
if (UserHasRight('ConsistencyCheck'))
|
||||
{
|
||||
$TypeQuery = "SELECT `Id` FROM `Types`";
|
||||
$TypeQuery = mysqli_query($GlobalMysqlHandler, $TypeQuery);
|
||||
$Types = array();
|
||||
while ($Type = mysqli_fetch_array($TypeQuery)) $Types[count($Types)]=$Type['Id'];
|
||||
|
||||
if ($ToDo=="RepairIncorrectTypes")
|
||||
{
|
||||
$CheckQuery = mysqli_query($GlobalMysqlHandler, "SELECT `Id`,`TypeId` FROM `Parts`");
|
||||
$LostPartsTypeId=0;
|
||||
$Error=0;
|
||||
$MovedParts=0;
|
||||
while ($Part = mysqli_fetch_array($CheckQuery))
|
||||
{
|
||||
if (!ElementExistInArray($Types,$Part['TypeId']))
|
||||
{
|
||||
if (!$LostPartsTypeId)
|
||||
{
|
||||
$LostPartypeQuery=mysqli_query($GlobalMysqlHandler, "SELECT `Id` FROM `Types` WHERE `Name` = 'LostTypeParts'");
|
||||
if (!mysql_num_rows($LostPartypeQuery))
|
||||
{
|
||||
mysqli_query($GlobalMysqlHandler, "INSERT INTO `Types` ( `Name` , `ParentId` ) VALUES ( 'LostTypeParts', '0' );");
|
||||
}
|
||||
$LostPartypeQuery=mysqli_query($GlobalMysqlHandler, "SELECT `Id` FROM `Types` WHERE `Name` = 'LostTypeParts'");
|
||||
if (mysqli_num_rows($LostPartypeQuery))
|
||||
{
|
||||
$Type=mysqli_fetch_array($LostPartypeQuery);
|
||||
$LostPartsTypeId=$Type['Id'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$Error=1;
|
||||
MessageError(LangSpell('SentenceDatabaseError'));
|
||||
ErrorLog("Can not create 'LostTypeParts' type!");
|
||||
}
|
||||
}
|
||||
if (!$Error)
|
||||
{
|
||||
if (mysqli_query($GlobalMysqlHandler, "UPDATE `Parts` SET `TypeId` = '$LostPartsTypeId' WHERE `Id` =".$Part['Id']." LIMIT 1 ;"))
|
||||
$MovedParts++;
|
||||
else
|
||||
{
|
||||
MessageError(LangSpell('SentenceDatabaseError'));
|
||||
ErrorLog("Can not change type id from part '".$Part['Id']."'!");
|
||||
}
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ($MovedParts)
|
||||
{
|
||||
MessageSuccess("$MovedParts parts moved to type 'LostTypeParts'.");
|
||||
}
|
||||
}
|
||||
|
||||
//show content
|
||||
$CheckQuery = mysqli_query($GlobalMysqlHandler, "SELECT `TypeId` FROM `Parts`");
|
||||
$IncorrectTypes=0;
|
||||
while ($Part = mysqli_fetch_array($CheckQuery)) $IncorrectTypes+= ElementExistInArray($Types,$Part['TypeId'])? 0:1;
|
||||
$GlobalContent .= "<h1>".LangSpellHtml('ConsCheckRepairIncorrectType')."</h1>";
|
||||
$GlobalContent .= LangSpellHtml('COnsCheckIncorrectTypeParts') . ": " . $IncorrectTypes . "<br>";
|
||||
$GlobalContent .= '<a href="index.php?Page=ConsistencyCheck&ToDo=RepairIncorrectTypes" class="Button">'.LangSpellHtml('ButtonProceed').'</a>';
|
||||
}
|
||||
?>
|
||||
165
pages/edit_config.php
Executable file
|
|
@ -0,0 +1,165 @@
|
|||
<?php
|
||||
|
||||
if (UserGetLogin()=="root")
|
||||
{
|
||||
//////////////////
|
||||
//save Config
|
||||
if ($ToDo=="SaveConfig")
|
||||
{
|
||||
//create new config file array
|
||||
$ConfigFileArray = array();
|
||||
$ConfigFileArray[count($ConfigFileArray)]=' $CfgStdTemplate = "'.$_POST['CfgStdTemplate'].'";'."\n";
|
||||
$ConfigFileArray[count($ConfigFileArray)]=' $CfgStdLanguage = "'.$_POST['CfgStdLanguage'].'";'."\n";
|
||||
$ConfigFileArray[count($ConfigFileArray)]=' $CfgStdTimeZone = "'.$_POST['CfgStdTimeZone'].'";'."\n";
|
||||
$ConfigFileArray[count($ConfigFileArray)]=' $CfgStdTimeFormat = "'.$_POST['CfgStdTimeFormat'].'";'."\n";
|
||||
if ( ($_POST['Password1']==$_POST['Password2']) && (trim($_POST['Password1'])) )
|
||||
{
|
||||
$ConfigFileArray[count($ConfigFileArray)]=' $CfgRootPassword = "'.md5($_POST['Password1']).'";'."\n";
|
||||
MessageWarning(LangSpellHtml('SentencePasswordChangedWarning'));
|
||||
UserLogout();
|
||||
}
|
||||
else
|
||||
{
|
||||
include "config.php";
|
||||
$ConfigFileArray[count($ConfigFileArray)] = ' $CfgRootPassword = "'.$CfgRootPassword.'";'."\n";
|
||||
}
|
||||
$ConfigFileArray[count($ConfigFileArray)]=' $CfgLogfile = "'.$_POST['CfgLogfile'].'";'."\n";
|
||||
$ConfigFileArray[count($ConfigFileArray)]=' $CfgLogfileMaxLines = "'.$_POST['CfgLogfileMaxLines'].'";'."\n";
|
||||
$ConfigFileArray[count($ConfigFileArray)]=' $CfgSetDebugMode = "'.$_POST['CfgSetDebugMode'].'";'."\n";
|
||||
$ConfigFileArray[count($ConfigFileArray)]=' $CfgMysqlHost = "'.$_POST['CfgMysqlHost'].'";'."\n";
|
||||
$ConfigFileArray[count($ConfigFileArray)]=' $CfgMysqlUser = "'.$_POST['CfgMysqlUser'].'";'."\n";
|
||||
$ConfigFileArray[count($ConfigFileArray)]=' $CfgMysqlPwd = "'.$_POST['CfgMysqlPwd'].'";'."\n";
|
||||
$ConfigFileArray[count($ConfigFileArray)]=' $CfgMysqlDatabase = "'.$_POST['CfgMysqlDatabase'].'";'."\n";
|
||||
$ConfigFileArray[count($ConfigFileArray)]=' $CfgLoginTimeout = "'.$_POST['CfgLoginTimeout'].'";'."\n";
|
||||
$ConfigFileArray[count($ConfigFileArray)]=' $CfgLockAutoReleaseTime = "'.$_POST['CfgLockAutoReleaseTime'].'";'."\n";
|
||||
|
||||
//save config file
|
||||
$ConfigFileHandler=fopen("./config.php","w");
|
||||
fputs($ConfigFileHandler,"<?php\n");
|
||||
foreach ($ConfigFileArray as $Line)
|
||||
{
|
||||
fputs($ConfigFileHandler,$Line);
|
||||
}
|
||||
fputs($ConfigFileHandler,"?>\n");
|
||||
fclose($ConfigFileHandler);
|
||||
}
|
||||
include("./includes/load_config.php");
|
||||
}
|
||||
|
||||
|
||||
if (UserGetLogin()=="root")
|
||||
{
|
||||
//////////////////
|
||||
//global content
|
||||
include ("config.php");
|
||||
$GlobalContent.='<form action="index.php?Page=EditConfig&ToDo=SaveConfig" method="post">'."\n";
|
||||
$GlobalContent.='<table>'."\n";
|
||||
|
||||
$GlobalContent.=' <tr>'."\n";
|
||||
$GlobalContent.=' <th>CfgStdTemplate</th>'."\n";
|
||||
$GlobalContent.=' <td><select name="CfgStdTemplate">'."\n";
|
||||
$AvailableTemplates=OtherGetAvailableTemplates();
|
||||
foreach ($AvailableTemplates as $x)
|
||||
{
|
||||
$GlobalContent.=' <option value="'.$x.'" '.(($x==$CfgStdTemplate)? 'selected':'').'>'.$x.'</option>'."\n";
|
||||
}
|
||||
$GlobalContent.=' </select><td>'."\n";
|
||||
$GlobalContent.=' <tr>'."\n";
|
||||
|
||||
$GlobalContent.=' <tr>'."\n";
|
||||
$GlobalContent.=' <th>CfgStdLanguage</th>'."\n";
|
||||
$GlobalContent.=' <td><select name="CfgStdLanguage">'."\n";
|
||||
$AvailableTemplates=LangGetAvailableLanguages();
|
||||
foreach ($AvailableTemplates as $x)
|
||||
{
|
||||
$GlobalContent.=' <option value="'.$x.'" '.(($x==$CfgStdLanguage)? 'selected':'').'>'.$x.'</option>'."\n";
|
||||
}
|
||||
$GlobalContent.=' </select><td>'."\n";
|
||||
$GlobalContent.=' <tr>'."\n";
|
||||
|
||||
$GlobalContent.=' <tr>'."\n";
|
||||
$GlobalContent.=' <th>CfgStdTimeZone</th>'."\n";
|
||||
$GlobalContent.=' <td><input type="text" name="CfgStdTimeZone" value="'.$CfgStdTimeZone.'"></td>'."\n";
|
||||
$GlobalContent.=' <td>'."\n";
|
||||
$GlobalContent.=' <a href="http://www.php.net/manual/en/timezones.php" title="" target="new">'."\n";
|
||||
$GlobalContent.=' '.OtherGetIcon('Help',"Button")."\n";
|
||||
$GlobalContent.=' </a>'."\n";
|
||||
$GlobalContent.=' </td>'."\n";
|
||||
$GlobalContent.=' <tr>'."\n";
|
||||
|
||||
$GlobalContent.=' <tr>'."\n";
|
||||
$GlobalContent.=' <th>CfgStdTimeFormat</th>'."\n";
|
||||
$GlobalContent.=' <td><input type="text" name="CfgStdTimeFormat" value="'.$CfgStdTimeFormat.'"></td>'."\n";
|
||||
$GlobalContent.=' <td>'."\n";
|
||||
$GlobalContent.=' <a href="http://www.php.net/manual/en/function.date.php" title="" target="new">'."\n";
|
||||
$GlobalContent.=' '.OtherGetIcon('Help',"Button")."\n";
|
||||
$GlobalContent.=' </a>'."\n";
|
||||
$GlobalContent.=' </td>'."\n";
|
||||
$GlobalContent.=' <tr>'."\n";
|
||||
|
||||
$GlobalContent.=' <tr>'."\n";
|
||||
$GlobalContent.=' <th>'.LangSpellHtml('UserSettingsSetNewPassword').'</th>'."\n";
|
||||
$GlobalContent.=' <td><input type="password" name="Password1" value=""></td>'."\n";
|
||||
$GlobalContent.=' <tr>'."\n";
|
||||
$GlobalContent.=' <tr>'."\n";
|
||||
$GlobalContent.=' <th>'.LangSpellHtml('UserSettingsConfirmNewPassword').'</th>'."\n";
|
||||
$GlobalContent.=' <td><input type="password" name="Password2" value=""></td>'."\n";
|
||||
$GlobalContent.=' <tr>'."\n";
|
||||
|
||||
$GlobalContent.=' <tr>'."\n";
|
||||
$GlobalContent.=' <th>CfgLogfile</th>'."\n";
|
||||
$GlobalContent.=' <td><input type="text" name="CfgLogfile" value="'.$CfgLogfile.'"></td>'."\n";
|
||||
$GlobalContent.=' <tr>'."\n";
|
||||
$GlobalContent.=' <tr>'."\n";
|
||||
$GlobalContent.=' <th>CfgLogfileMaxLines</th>'."\n";
|
||||
$GlobalContent.=' <td><input type="text" name="CfgLogfileMaxLines" value="'.$CfgLogfileMaxLines.'"></td>'."\n";
|
||||
$GlobalContent.=' <tr>'."\n";
|
||||
|
||||
$GlobalContent.=' <tr>'."\n";
|
||||
$GlobalContent.=' <th>CfgSetDebugMode</th>'."\n";
|
||||
$GlobalContent.=' <td><select name="CfgSetDebugMode">'."\n";
|
||||
$GlobalContent.=' <option value="True" '.((strtolower($CfgSetDebugMode)=="true")? "selected":"").'>True</option>'."\n";
|
||||
$GlobalContent.=' <option value="False" '.((strtolower($CfgSetDebugMode)!="true")? "selected":"").'>False</option>'."\n";
|
||||
$GlobalContent.=' </select></td>'."\n";
|
||||
$GlobalContent.=' <tr>'."\n";
|
||||
|
||||
$GlobalContent.=' <tr>'."\n";
|
||||
$GlobalContent.=' <th>CfgMysqlHost</th>'."\n";
|
||||
$GlobalContent.=' <td><input type="text" name="CfgMysqlHost" value="'.$CfgMysqlHost.'"></td>'."\n";
|
||||
$GlobalContent.=' <tr>'."\n";
|
||||
$GlobalContent.=' <tr>'."\n";
|
||||
$GlobalContent.=' <th>CfgMysqlUser</th>'."\n";
|
||||
$GlobalContent.=' <td><input type="text" name="CfgMysqlUser" value="'.$CfgMysqlUser.'"></td>'."\n";
|
||||
$GlobalContent.=' <tr>'."\n";
|
||||
$GlobalContent.=' <tr>'."\n";
|
||||
$GlobalContent.=' <th>CfgMysqlPwd</th>'."\n";
|
||||
$GlobalContent.=' <td><input type="text" name="CfgMysqlPwd" value="'.$CfgMysqlPwd.'"></td>'."\n";
|
||||
$GlobalContent.=' <tr>'."\n";
|
||||
$GlobalContent.=' <tr>'."\n";
|
||||
$GlobalContent.=' <th>CfgMysqlDatabase</th>'."\n";
|
||||
$GlobalContent.=' <td><input type="text" name="CfgMysqlDatabase" value="'.$CfgMysqlDatabase.'"></td>'."\n";
|
||||
$GlobalContent.=' <tr>'."\n";
|
||||
|
||||
$GlobalContent.=' <tr>'."\n";
|
||||
$GlobalContent.=' <th>CfgLoginTimeout</th>'."\n";
|
||||
$GlobalContent.=' <td><input type="text" name="CfgLoginTimeout" value="'.$CfgLoginTimeout.'"></td>'."\n";
|
||||
$GlobalContent.=' <tr>'."\n";
|
||||
|
||||
$GlobalContent.=' <tr>'."\n";
|
||||
$GlobalContent.=' <th>CfgLockAutoReleaseTime</th>'."\n";
|
||||
$GlobalContent.=' <td><input type="text" name="CfgLockAutoReleaseTime" value="'.$CfgLockAutoReleaseTime.'"></td>'."\n";
|
||||
$GlobalContent.=' <tr>'."\n";
|
||||
|
||||
$GlobalContent.=' <tr>'."\n";
|
||||
$GlobalContent.=' <th>'.LangSpellHtml('ButtonSave').'</th>'."\n";
|
||||
$GlobalContent.=' <td><input type="submit" value="'.LangSpellHtml('ButtonSave').'" class="Button"></td>'."\n";
|
||||
$GlobalContent.=' <tr>'."\n";
|
||||
|
||||
$GlobalContent.='</table>'."\n";
|
||||
$GlobalContent.='</form>'."\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageError(LangSpell("ScentenceNoUserRights"));
|
||||
}
|
||||
?>
|
||||
299
pages/edit_packages.php
Executable file
|
|
@ -0,0 +1,299 @@
|
|||
<?php
|
||||
|
||||
$EditPackagesEditId=0;
|
||||
|
||||
function WritePackagesList($ParentId, $ParentIsLocked)
|
||||
{
|
||||
global $GlobalMysqlHandler;
|
||||
global $GlobalContent;
|
||||
global $GlobalTemplate;
|
||||
global $EditPackagesEditId;
|
||||
|
||||
$ListQuery="SELECT `Id` , `Name` FROM `Packages` WHERE `ParentId` =$ParentId";
|
||||
$ListQuery=mysqli_query($GlobalMysqlHandler, $ListQuery);
|
||||
|
||||
if (!$ParentId || NestedListVisibilityIsSet($ParentId, 'EditPackages'))
|
||||
$GlobalContent .= "<ul style=\"display:block;\">\n";
|
||||
else
|
||||
$GlobalContent .= "<ul style=\"display:none;\">\n";
|
||||
|
||||
if (mysqli_num_rows($ListQuery))
|
||||
{
|
||||
while ($ListData=mysqli_fetch_array($ListQuery))
|
||||
{
|
||||
if ($EditPackagesEditId
|
||||
&& ($EditPackagesEditId==$ListData['Id'])
|
||||
&& !( LockIsActive('Packages',$ListData['Id']) || $ParentIsLocked)
|
||||
)
|
||||
{ //edit entry
|
||||
$GlobalContent .= " <li>\n";
|
||||
$GlobalContent .= ' <a href="index.php?Page=EditPackages&ToDo=DeletePackage&Id='.$ListData['Id'].'" title="'.LangSpellHtml('TagTitleDelete').'">'.OtherGetIcon('Delete',"Button").'</a>';
|
||||
$GlobalContent .= ' <form action="index.php?Page=EditPackages&ToDo=EditpackageSave" method="post">';
|
||||
$GlobalContent .= ' <input type="hidden" name="Id" value="'.$ListData['Id'].'">';
|
||||
$GlobalContent .= '<input type="text" name="Name" value="'.$ListData['Name'].'">';
|
||||
$GlobalContent .= '<select name="MoveToId" title="'.LangSpellHtml('TagTitleMove').'">';
|
||||
if ($ParentId)
|
||||
$GlobalContent .= '<option value="#MOVE#ITEM#UP#">'.LangSpellHtml('TagTitleMoveUp').'</option>';
|
||||
$GlobalContent .= '<option value="" selected>--- '.LangSpellHtml('TagTitleMove').' ---</option>';
|
||||
$MoveItems = NestedLisGetSubelements($ParentId,"Packages");
|
||||
foreach ($MoveItems as $MvItm)
|
||||
{
|
||||
if ($MvItm[0]==$ListData['Id']) continue;
|
||||
$GlobalContent .= '<option value="'.$MvItm[0].'">'.$MvItm[1].'</option>';
|
||||
}
|
||||
$GlobalContent .= "</select>";
|
||||
$GlobalContent .= '<input type="submit" value="'.LangSpellHtml('ButtonSave').'" class="Button">';
|
||||
$GlobalContent .= ' </form>';
|
||||
$GlobalContent .= ' <a href="index.php?Page=EditPackages&ToDo=CancelEditPackage&Id='.$ListData['Id'].'" title="'.LangSpellHtml('TagTitleCancel').'">'.OtherGetIcon('Cancel',"Button").'</a>' ."\n";
|
||||
$GlobalContent .= " </li>\n";
|
||||
}
|
||||
else
|
||||
{ //just show entry
|
||||
$GlobalContent .= " <li>\n";
|
||||
if (LockIsActive('Packages',$ListData['Id']) || $ParentIsLocked)
|
||||
{
|
||||
$GlobalContent .= ' '.OtherGetIcon('LockActive');
|
||||
$ParentIsLocked = 1;
|
||||
}
|
||||
elseif (UserHasRight('EditPackages'))
|
||||
{
|
||||
$GlobalContent .= ' <a href="index.php?Page=EditPackages&ToDo=EditPackage&Id='.$ListData['Id'].'" target="_top" title="'.LangSpellHtml('TagTitleEdit').'">';
|
||||
$GlobalContent .= OtherGetIcon('Edit',"Button");
|
||||
}
|
||||
$GlobalContent .= " <a href=\"index.php?Page=EditPackages&ToDo=OpenSublist&SublistId=".$ListData['Id']."\">".LangStr2Html($ListData['Name'])."</a>";
|
||||
$GlobalContent .= " (".NestedListCountSubElements($ListData['Id'],'Packages').")";
|
||||
$GlobalContent .= " \n</li>\n";
|
||||
}
|
||||
|
||||
WritePackagesList($ListData['Id'],$ParentIsLocked);
|
||||
}
|
||||
}
|
||||
if (!$EditPackagesEditId && UserHasRight('EditPackages'))
|
||||
{
|
||||
$GlobalContent .= " <li>\n";
|
||||
$GlobalContent .= ' <form action="index.php?Page=EditPackages&ToDo=NewPackage&ParentId='.$ParentId.'" method="post">'."\n";
|
||||
$GlobalContent .= ' <input type="text" name="NewPackageName" value="">'."\n";
|
||||
$GlobalContent .= ' <input type="submit" value="'.LangSpellHtml('ButtonNew').'" class="Button">'."\n";
|
||||
$GlobalContent .= ' </form>'."\n";
|
||||
$GlobalContent .= " </li>\n";
|
||||
}
|
||||
$GlobalContent .= "</ul>\n";
|
||||
}
|
||||
|
||||
if (UserHasRight('EditPackages'))
|
||||
{
|
||||
/////////////////
|
||||
//edit package save
|
||||
if ($ToDo=="EditpackageSave")
|
||||
{
|
||||
if (isset($_POST['Id']) && $_POST['Id'] && isset($_POST['Name']) && $_POST['Name'])
|
||||
{
|
||||
global $GlobalMysqlHandler;
|
||||
$Id = $_POST['Id'];
|
||||
$Name = $_POST['Name'];
|
||||
$MoveId = (isset($_POST['MoveToId']))? $_POST['MoveToId']:0;
|
||||
|
||||
if ($MoveId)
|
||||
{
|
||||
$MoveQuery = "";
|
||||
if ($MoveId=="#MOVE#ITEM#UP#")
|
||||
{
|
||||
$FirstParentId = NestedListGetParentId($Id,'Packages');
|
||||
$MoveId = NestedListGetParentId($FirstParentId,'Packages');
|
||||
}
|
||||
else
|
||||
{
|
||||
$FirstParentId = NestedListGetParentId($Id,'Packages');
|
||||
}
|
||||
|
||||
$MoveQuery="UPDATE `Packages` SET `ParentId` = '$MoveId' WHERE `Id` =$Id LIMIT 1 ;";
|
||||
|
||||
if (mysqli_query($GlobalMysqlHandler, $MoveQuery))
|
||||
{
|
||||
MessageSuccess(LangSpell('SentenceNestedListMoved'));
|
||||
NestedListVisibilityUnset($FirstParentId,'EditPackages');
|
||||
NestedListVisibilitySet($MoveId,'EditPackages');
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageError(LangSpell('SentenceDatabaseError'));
|
||||
ErrorLog("[edit_pacakges.php] Db error on moving element with id $Id to parent id $MoveId");
|
||||
}
|
||||
}
|
||||
|
||||
$ChangeNameQuery="UPDATE `Packages` SET `Name` = '$Name' WHERE `Id` =$Id LIMIT 1 ;";
|
||||
if (!mysqli_query($GlobalMysqlHandler, $ChangeNameQuery))
|
||||
{
|
||||
MessageError(LangSpell('SentenceDatabaseError'));
|
||||
ErrorLog("[edit_pacakges.php] Db error on naming element with id $Id");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (isset($_POST['Name']) && !trim($_POST['Name']))
|
||||
MessageError(LangSpell('EditPackagesNoPackageNameGiven'));
|
||||
else
|
||||
{
|
||||
ErrorLog("[edit_pacakges.php] No Id to move down!");
|
||||
MessageError(LangSpell('SentenceUnknownError'));
|
||||
}
|
||||
}
|
||||
|
||||
$ToDo="";
|
||||
}
|
||||
|
||||
/////////////////
|
||||
// delete package
|
||||
if ($ToDo=="DeletePackage")
|
||||
{
|
||||
if (isset($_GET['Id']) && $_GET['Id'])
|
||||
{
|
||||
$Id = $_GET['Id'];
|
||||
if (!LockIsActive('Packages',$Id))
|
||||
{
|
||||
global $GlobalMysqlHandler;
|
||||
$DeleteQuery="DELETE FROM `Packages` WHERE `Id` = $Id LIMIT 1";
|
||||
if (mysqli_query($GlobalMysqlHandler, $DeleteQuery))
|
||||
{
|
||||
MessageSuccess(LangSpell('EditPackagesPackageDeleted'));
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageError(LangSpell('SentenceDatabaseError'));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageError(LangSpell('SentenceLockIsActive'));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ErrorLog("[edit_pacakges.php] No Id to delete package!");
|
||||
MessageError(LangSpell('SentenceUnknownError'));
|
||||
}
|
||||
$ToDo="";
|
||||
}
|
||||
|
||||
////////////////
|
||||
// add new package
|
||||
if ($ToDo=="NewPackage")
|
||||
{
|
||||
if (isset($_GET['ParentId']) && isset($_POST['NewPackageName']))
|
||||
{
|
||||
$ParentId = $_GET['ParentId'];
|
||||
$NewPackageName = $_POST['NewPackageName'];
|
||||
if (LockActivate('Packages',$ParentId))
|
||||
{
|
||||
if (trim($NewPackageName)!="")
|
||||
{
|
||||
global $GlobalMysqlHandler;
|
||||
$InsertQuery="INSERT INTO `Packages` ( `Name` , `ParentId` ) VALUES ( '$NewPackageName', '$ParentId' );";
|
||||
if (mysqli_query($GlobalMysqlHandler, $InsertQuery))
|
||||
{
|
||||
MessageSuccess(LangSpell('EditPackagesNewPackageAdded'));
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageError(LangSpell('SentenceDatabaseError'));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageError(LangSpell('EditPackagesNoPackageNameGiven'));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageError(LangSpell('SentenceLockIsActive'));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!isset($_GET['ParentId']))
|
||||
ErrorLog("[edit_pacakges.php] No ParentId to add new package!");
|
||||
if (!isset($_POST['NewPackageName']))
|
||||
ErrorLog("[edit_pacakges.php] No NewPackageName to add new package!");
|
||||
MessageError(LangSpell('SentenceUnknownError'));
|
||||
}
|
||||
$ToDo="";
|
||||
}
|
||||
|
||||
///////////////
|
||||
// edit package
|
||||
if ($ToDo=="EditPackage")
|
||||
{
|
||||
if (isset($_GET['Id']) && $_GET['Id'])
|
||||
{
|
||||
$EditId = $_GET['Id'];
|
||||
if (LockActivate('Packages',$EditId))
|
||||
{
|
||||
$EditPackagesEditId=$EditId;
|
||||
//NestedListVisibilityUnset($EditId, 'EditPackages');
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageError(LangSpell('SentenceLockIsActive'));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ErrorLog("[edit_pacakges.php] No Id to edit package");
|
||||
MessageError(LangSpell('SentenceUnknownError'));
|
||||
}
|
||||
$ToDo = "";
|
||||
}
|
||||
|
||||
//////////////////////
|
||||
// cancel edit package
|
||||
if ($ToDo=="CancelEditPackage")
|
||||
{
|
||||
if (isset($_GET['Id']) && $_GET['Id'])
|
||||
{
|
||||
$EditId = $_GET['Id'];
|
||||
if (LockRelease('Packages',$EditId))
|
||||
{
|
||||
$EditPackagesEditId=0;
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageError(LangSpell('SentenceLockIsActive'));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ErrorLog("[edit_pacakges.php] No Id to release loack on package");
|
||||
MessageError(LangSpell('SentenceUnknownError'));
|
||||
}
|
||||
$ToDo = "";
|
||||
}
|
||||
}
|
||||
|
||||
if (UserHasRight('EditPackages') || UserHasRight('ViewSTPV'))
|
||||
{
|
||||
///////////////
|
||||
// open sublist
|
||||
if ($ToDo=="OpenSublist")
|
||||
{
|
||||
if (isset($_GET['SublistId']) && $_GET['SublistId'])
|
||||
{
|
||||
NestedListVisibilityToggle($_GET['SublistId'], 'EditPackages');
|
||||
}
|
||||
else
|
||||
{
|
||||
ErrorLog("[edit_pacakges.php] No SublistId to open package!");
|
||||
MessageError(LangSpell('SentenceUnknownError'));
|
||||
}
|
||||
$ToDo="";
|
||||
}
|
||||
|
||||
///////////////
|
||||
// sow packages
|
||||
if ($ToDo=="")
|
||||
WritePackagesList(0,0);
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageError(LangSpell("ScentenceNoUserRights"));
|
||||
}
|
||||
?>
|
||||
299
pages/edit_stores.php
Executable file
|
|
@ -0,0 +1,299 @@
|
|||
<?php
|
||||
|
||||
$EditStoresEditId=0;
|
||||
|
||||
function WriteStoreList($ParentId, $ParentIsLocked)
|
||||
{
|
||||
global $GlobalMysqlHandler;
|
||||
global $GlobalContent;
|
||||
global $GlobalTemplate;
|
||||
global $EditStoresEditId;
|
||||
|
||||
$ListQuery="SELECT `Id` , `Name` FROM `Storages` WHERE `ParentId` =$ParentId";
|
||||
$ListQuery=mysqli_query($GlobalMysqlHandler, $ListQuery);
|
||||
|
||||
if (!$ParentId || NestedListVisibilityIsSet($ParentId, 'EditStorage'))
|
||||
$GlobalContent .= "<ul style=\"display:block;\">\n";
|
||||
else
|
||||
$GlobalContent .= "<ul style=\"display:none;\">\n";
|
||||
|
||||
if (mysqli_num_rows($ListQuery))
|
||||
{
|
||||
while ($ListData=mysqli_fetch_array($ListQuery))
|
||||
{
|
||||
if ($EditStoresEditId
|
||||
&& ($EditStoresEditId==$ListData['Id'])
|
||||
&& !( LockIsActive('Storages',$ListData['Id']) || $ParentIsLocked)
|
||||
)
|
||||
{ //edit entry
|
||||
$GlobalContent .= " <li>\n";
|
||||
$GlobalContent .= ' <a href="index.php?Page=EditStores&ToDo=DeleteStore&Id='.$ListData['Id'].'" title="'.LangSpellHtml('TagTitleDelete').'">'.OtherGetIcon('Delete',"Button").'</a>';
|
||||
$GlobalContent .= ' <form action="index.php?Page=EditStores&ToDo=EditStoreSave" method="post">';
|
||||
$GlobalContent .= ' <input type="hidden" name="Id" value="'.$ListData['Id'].'">';
|
||||
$GlobalContent .= '<input type="text" name="Name" value="'.$ListData['Name'].'">';
|
||||
$GlobalContent .= '<select name="MoveToId" title="'.LangSpellHtml('TagTitleMove').'">';
|
||||
if ($ParentId)
|
||||
$GlobalContent .= '<option value="#MOVE#ITEM#UP#">'.LangSpellHtml('TagTitleMoveUp').'</option>';
|
||||
$GlobalContent .= '<option value="" selected>--- '.LangSpellHtml('TagTitleMove').' ---</option>';
|
||||
$MoveItems = NestedLisGetSubelements($ParentId,"Storages");
|
||||
foreach ($MoveItems as $MvItm)
|
||||
{
|
||||
if ($MvItm[0]==$ListData['Id']) continue;
|
||||
$GlobalContent .= '<option value="'.$MvItm[0].'">'.$MvItm[1].'</option>';
|
||||
}
|
||||
$GlobalContent .= "</select>";
|
||||
$GlobalContent .= '<input type="submit" value="'.LangSpellHtml('ButtonSave').'" class="Button">';
|
||||
$GlobalContent .= ' </form>';
|
||||
$GlobalContent .= ' <a href="index.php?Page=EditStores&ToDo=CancelEditStore&Id='.$ListData['Id'].'" title="'.LangSpellHtml('TagTitleCancel').'">'.OtherGetIcon('Cancel',"Button").'</a>' ."\n";
|
||||
$GlobalContent .= " </li>\n";
|
||||
}
|
||||
else
|
||||
{ //just show entry
|
||||
$GlobalContent .= " <li>\n";
|
||||
if (LockIsActive('Storages',$ListData['Id']) || $ParentIsLocked)
|
||||
{
|
||||
$GlobalContent .= ' '.OtherGetIcon('LockActive');
|
||||
$ParentIsLocked = 1;
|
||||
}
|
||||
elseif (UserHasRight('EditStores'))
|
||||
{
|
||||
$GlobalContent .= ' <a href="index.php?Page=EditStores&ToDo=EditStore&Id='.$ListData['Id'].'" target="_top" title="'.LangSpellHtml('TagTitleEdit').'">';
|
||||
$GlobalContent .= OtherGetIcon('Edit',"Button");
|
||||
}
|
||||
$GlobalContent .= " <a href=\"index.php?Page=EditStores&ToDo=OpenSublist&SublistId=".$ListData['Id']."\">".LangStr2Html($ListData['Name'])."</a>";
|
||||
$GlobalContent .= " (".NestedListCountSubElements($ListData['Id'],'Storages').")";
|
||||
$GlobalContent .= " \n</li>\n";
|
||||
}
|
||||
|
||||
WriteStoreList($ListData['Id'],$ParentIsLocked);
|
||||
}
|
||||
}
|
||||
if (!$EditStoresEditId && UserHasRight('EditStores'))
|
||||
{
|
||||
$GlobalContent .= " <li>\n";
|
||||
$GlobalContent .= ' <form action="index.php?Page=EditStores&ToDo=NewStore&ParentId='.$ParentId.'" method="post">'."\n";
|
||||
$GlobalContent .= ' <input type="text" name="NewStoreName" value="">'."\n";
|
||||
$GlobalContent .= ' <input type="submit" value="'.LangSpellHtml('ButtonNew').'" class="Button">'."\n";
|
||||
$GlobalContent .= ' </form>'."\n";
|
||||
$GlobalContent .= " </li>\n";
|
||||
}
|
||||
$GlobalContent .= "</ul>\n";
|
||||
}
|
||||
|
||||
if (UserHasRight('EditStores'))
|
||||
{
|
||||
/////////////////
|
||||
//edit store save
|
||||
if ($ToDo=="EditStoreSave")
|
||||
{
|
||||
if (isset($_POST['Id']) && $_POST['Id'] && isset($_POST['Name']) && $_POST['Name'])
|
||||
{
|
||||
global $GlobalMysqlHandler;
|
||||
$Id = $_POST['Id'];
|
||||
$Name = $_POST['Name'];
|
||||
$MoveId = (isset($_POST['MoveToId']))? $_POST['MoveToId']:0;
|
||||
|
||||
if ($MoveId)
|
||||
{
|
||||
$MoveQuery = "";
|
||||
if ($MoveId=="#MOVE#ITEM#UP#")
|
||||
{
|
||||
$FirstParentId = NestedListGetParentId($Id,'Storages');
|
||||
$MoveId = NestedListGetParentId($FirstParentId,'Storages');
|
||||
}
|
||||
else
|
||||
{
|
||||
$FirstParentId = NestedListGetParentId($Id,'Storages');
|
||||
}
|
||||
|
||||
$MoveQuery="UPDATE `Storages` SET `ParentId` = '$MoveId' WHERE `Id` =$Id LIMIT 1 ;";
|
||||
|
||||
if (mysqli_query($GlobalMysqlHandler, $MoveQuery))
|
||||
{
|
||||
MessageSuccess(LangSpell('SentenceNestedListMoved'));
|
||||
NestedListVisibilityUnset($FirstParentId,'EditStorage');
|
||||
NestedListVisibilitySet($MoveId,'EditStorage');
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageError(LangSpell('SentenceDatabaseError'));
|
||||
ErrorLog("[edit_stored.php] Db error on moving element with id $Id to parent id $MoveId");
|
||||
}
|
||||
}
|
||||
|
||||
$ChangeNameQuery="UPDATE `Storages` SET `Name` = '$Name' WHERE `Id` =$Id LIMIT 1 ;";
|
||||
if (!mysqli_query($GlobalMysqlHandler, $ChangeNameQuery))
|
||||
{
|
||||
MessageError(LangSpell('SentenceDatabaseError'));
|
||||
ErrorLog("[edit_stored.php] Db error on naming element with id $Id");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (isset($_POST['Name']) && !trim($_POST['Name']))
|
||||
MessageError(LangSpell('EditStoresNoStoreNameGiven'));
|
||||
else
|
||||
{
|
||||
ErrorLog("[edit_stores.php] No Id to move!");
|
||||
MessageError(LangSpell('SentenceUnknownError'));
|
||||
}
|
||||
}
|
||||
|
||||
$ToDo="";
|
||||
}
|
||||
|
||||
///////////////
|
||||
// delete store
|
||||
if ($ToDo=="DeleteStore")
|
||||
{
|
||||
if (isset($_GET['Id']) && $_GET['Id'])
|
||||
{
|
||||
$Id = $_GET['Id'];
|
||||
if (!LockIsActive('Storages',$Id))
|
||||
{
|
||||
global $GlobalMysqlHandler;
|
||||
$DeleteQuery="DELETE FROM `Storages` WHERE `Id` = $Id LIMIT 1";
|
||||
if (mysqli_query($GlobalMysqlHandler, $DeleteQuery))
|
||||
{
|
||||
MessageSuccess(LangSpell('EditStoresStoreDeleted'));
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageError(LangSpell('SentenceDatabaseError'));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageError(LangSpell('SentenceLockIsActive'));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ErrorLog("[edit_stores.php] No Id to delete store!");
|
||||
MessageError(LangSpell('SentenceUnknownError'));
|
||||
}
|
||||
$ToDo="";
|
||||
}
|
||||
|
||||
////////////////
|
||||
// add new store
|
||||
if ($ToDo=="NewStore")
|
||||
{
|
||||
if (isset($_GET['ParentId']) && isset($_POST['NewStoreName']))
|
||||
{
|
||||
$ParentId = $_GET['ParentId'];
|
||||
$NewStoreName = $_POST['NewStoreName'];
|
||||
if (LockActivate('Storages',$ParentId))
|
||||
{
|
||||
if (trim($NewStoreName)!="")
|
||||
{
|
||||
global $GlobalMysqlHandler;
|
||||
$InsertQuery="INSERT INTO `Storages` ( `Name` , `ParentId` ) VALUES ( '$NewStoreName', '$ParentId' );";
|
||||
if (mysqli_query($GlobalMysqlHandler, $InsertQuery))
|
||||
{
|
||||
MessageSuccess(LangSpell('EditStoresNewStoreAdded'));
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageError(LangSpell('SentenceDatabaseError'));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageError(LangSpell('EditStoresNoStoreNameGiven'));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageError(LangSpell('SentenceLockIsActive'));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!isset($_GET['ParentId']))
|
||||
ErrorLog("[edit_stores.php] No ParentId to add new store!");
|
||||
if (!isset($_POST['NewStoreName']))
|
||||
ErrorLog("[edit_stores.php] No NewStoreName to add new store!");
|
||||
MessageError(LangSpell('SentenceUnknownError'));
|
||||
}
|
||||
$ToDo="";
|
||||
}
|
||||
|
||||
/////////////
|
||||
// edit store
|
||||
if ($ToDo=="EditStore")
|
||||
{
|
||||
if (isset($_GET['Id']) && $_GET['Id'])
|
||||
{
|
||||
$EditId = $_GET['Id'];
|
||||
if (LockActivate('Storages',$EditId))
|
||||
{
|
||||
$EditStoresEditId=$EditId;
|
||||
//NestedListVisibilityUnset($EditId, 'EditStorage');
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageError(LangSpell('SentenceLockIsActive'));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ErrorLog("[edit_stores.php] No Id to edit store");
|
||||
MessageError(LangSpell('SentenceUnknownError'));
|
||||
}
|
||||
$ToDo = "";
|
||||
}
|
||||
|
||||
////////////////////
|
||||
// cancel edit store
|
||||
if ($ToDo=="CancelEditStore")
|
||||
{
|
||||
if (isset($_GET['Id']) && $_GET['Id'])
|
||||
{
|
||||
$EditId = $_GET['Id'];
|
||||
if (LockRelease('Storages',$EditId))
|
||||
{
|
||||
$EditStoresEditId=0;
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageError(LangSpell('SentenceLockIsActive'));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ErrorLog("[edit_stores.php] No Id to release loack on storage");
|
||||
MessageError(LangSpell('SentenceUnknownError'));
|
||||
}
|
||||
$ToDo = "";
|
||||
}
|
||||
}
|
||||
|
||||
if (UserHasRight('EditStores') || UserHasRight('ViewSTPV'))
|
||||
{
|
||||
///////////////
|
||||
// open sublist
|
||||
if ($ToDo=="OpenSublist")
|
||||
{
|
||||
if (isset($_GET['SublistId']) && $_GET['SublistId'])
|
||||
{
|
||||
NestedListVisibilityToggle($_GET['SublistId'], 'EditStorage');
|
||||
}
|
||||
else
|
||||
{
|
||||
ErrorLog("[edit_stores.php] No SublistId to open store!");
|
||||
MessageError(LangSpell('SentenceUnknownError'));
|
||||
}
|
||||
$ToDo="";
|
||||
}
|
||||
|
||||
///////////////
|
||||
// sow stores
|
||||
if ($ToDo=="")
|
||||
WriteStoreList(0,0);
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageError(LangSpell("ScentenceNoUserRights"));
|
||||
}
|
||||
?>
|
||||
310
pages/edit_types.php
Executable file
|
|
@ -0,0 +1,310 @@
|
|||
<?php
|
||||
|
||||
$EditTypesEditId=0;
|
||||
|
||||
function WriteTypeList($ParentId, $ParentIsLocked)
|
||||
{
|
||||
global $GlobalMysqlHandler;
|
||||
global $GlobalContent;
|
||||
global $GlobalTemplate;
|
||||
global $EditTypesEditId;
|
||||
|
||||
$ListQuery="SELECT * FROM `Types` WHERE `ParentId` =$ParentId";
|
||||
$ListQuery=mysqli_query($GlobalMysqlHandler, $ListQuery);
|
||||
|
||||
if (!$ParentId || NestedListVisibilityIsSet($ParentId, 'EditTypes'))
|
||||
$GlobalContent .= "<ul style=\"display:block;\">\n";
|
||||
else
|
||||
$GlobalContent .= "<ul style=\"display:none;\">\n";
|
||||
|
||||
if (mysqli_num_rows($ListQuery))
|
||||
{
|
||||
while ($ListData=mysqli_fetch_array($ListQuery))
|
||||
{
|
||||
if ($EditTypesEditId
|
||||
&& ($EditTypesEditId==$ListData['Id'])
|
||||
&& !( LockIsActive('Types',$ListData['Id']) || $ParentIsLocked)
|
||||
)
|
||||
{ //edit entry
|
||||
$GlobalContent .= " <li>\n";
|
||||
$GlobalContent .= ' <a href="index.php?Page=EditTypes&ToDo=DeleteType&Id='.$ListData['Id'].'" title="'.LangSpellHtml('TagTitleDelete').'">'.OtherGetIcon('Delete',"Button").'</a>';
|
||||
$GlobalContent .= ' <form action="index.php?Page=EditTypes&ToDo=EditTypeSave" method="post">';
|
||||
$GlobalContent .= ' <input type="hidden" name="Id" value="'.$ListData['Id'].'">';
|
||||
$GlobalContent .= LangSpellHtml('EditTypesName').':<input type="text" name="Name" value="'.$ListData['Name'].'"> ';
|
||||
$GlobalContent .= LangSpellHtml('EditTypesShortName').':<input type="text" name="ShortName" value="'.$ListData['ShortName'].'">';
|
||||
$GlobalContent .= '<select name="MoveToId" title="'.LangSpellHtml('TagTitleMove').'">';
|
||||
if ($ParentId)
|
||||
$GlobalContent .= '<option value="#MOVE#ITEM#UP#">'.LangSpellHtml('TagTitleMoveUp').'</option>';
|
||||
$GlobalContent .= '<option value="" selected>--- '.LangSpellHtml('TagTitleMove').' ---</option>';
|
||||
$MoveItems = NestedLisGetSubelements($ParentId,"Types");
|
||||
foreach ($MoveItems as $MvItm)
|
||||
{
|
||||
if ($MvItm[0]==$ListData['Id']) continue;
|
||||
$GlobalContent .= '<option value="'.$MvItm[0].'">'.$MvItm[1].'</option>';
|
||||
}
|
||||
$GlobalContent .= "</select>";
|
||||
$GlobalContent .= '<input type="submit" value="'.LangSpellHtml('ButtonSave').'" class="Button">';
|
||||
$GlobalContent .= ' <a href="index.php?Page=EditTypes&ToDo=CancelEditType&Id='.$ListData['Id'].'" title="'.LangSpellHtml('TagTitleCancel').'">'.OtherGetIcon('Cancel',"Button").'</a><br>' ."\n";
|
||||
$GlobalContent .= LangSpellHtml('EditTypesNameValue1').':<input type="text" name="NameValue1" value="'.$ListData['NameValue1'].'"> ';
|
||||
$GlobalContent .= LangSpellHtml('EditTypesNameValue2').':<input type="text" name="NameValue2" value="'.$ListData['NameValue2'].'"> ';
|
||||
$GlobalContent .= LangSpellHtml('EditTypesNameValue3').':<input type="text" name="NameValue3" value="'.$ListData['NameValue3'].'"><br>';
|
||||
$GlobalContent .= LangSpellHtml('EditTypesUnitValue1').':<input type="text" name="UnitValue1" value="'.$ListData['UnitValue1'].'"> ';
|
||||
$GlobalContent .= LangSpellHtml('EditTypesUnitValue2').':<input type="text" name="UnitValue2" value="'.$ListData['UnitValue2'].'"> ';
|
||||
$GlobalContent .= LangSpellHtml('EditTypesUnitValue3').':<input type="text" name="UnitValue3" value="'.$ListData['UnitValue3'].'"><br>';
|
||||
$GlobalContent .= ' </form>';
|
||||
$GlobalContent .= " </li>\n";
|
||||
}
|
||||
else
|
||||
{ //just show entry
|
||||
$GlobalContent .= " <li>\n";
|
||||
if (LockIsActive('Types',$ListData['Id']) || $ParentIsLocked)
|
||||
{
|
||||
$GlobalContent .= ' '.OtherGetIcon('LockActive');
|
||||
$ParentIsLocked = 1;
|
||||
}
|
||||
elseif (UserHasRight('EditTypes'))
|
||||
{
|
||||
$GlobalContent .= ' <a href="index.php?Page=EditTypes&ToDo=EditType&Id='.$ListData['Id'].'" target="_top" title="'.LangSpellHtml('TagTitleEdit').'">';
|
||||
$GlobalContent .= OtherGetIcon('Edit',"Button");
|
||||
}
|
||||
$GlobalContent .= " <a href=\"index.php?Page=EditTypes&ToDo=OpenSublist&SublistId=".$ListData['Id']."\">".LangStr2Html($ListData['Name'])."</a>";
|
||||
$GlobalContent .= " (".NestedListCountSubElements($ListData['Id'],'Types').")";
|
||||
$GlobalContent .= " \n</li>\n";
|
||||
}
|
||||
|
||||
WriteTypeList($ListData['Id'],$ParentIsLocked);
|
||||
}
|
||||
}
|
||||
if (!$EditTypesEditId && UserHasRight('EditTypes'))
|
||||
{
|
||||
$GlobalContent .= " <li>\n";
|
||||
$GlobalContent .= ' <form action="index.php?Page=EditTypes&ToDo=NewType&ParentId='.$ParentId.'" method="post">'."\n";
|
||||
$GlobalContent .= ' <input type="text" name="NewTypeName" value="">'."\n";
|
||||
$GlobalContent .= ' <input type="submit" value="'.LangSpellHtml('ButtonNew').'" class="Button">'."\n";
|
||||
$GlobalContent .= ' </form>'."\n";
|
||||
$GlobalContent .= " </li>\n";
|
||||
}
|
||||
$GlobalContent .= "</ul>\n";
|
||||
}
|
||||
|
||||
if (UserHasRight('EditTypes'))
|
||||
{
|
||||
/////////////////
|
||||
//edit type save
|
||||
if ($ToDo=="EditTypeSave")
|
||||
{
|
||||
if (isset($_POST['Id']) && $_POST['Id'] && isset($_POST['Name']) && $_POST['Name']
|
||||
&& isset($_POST['ShortName'])
|
||||
&& isset($_POST['NameValue1']) && isset($_POST['NameValue2']) && isset($_POST['NameValue3'])
|
||||
&& isset($_POST['UnitValue1']) && isset($_POST['UnitValue2']) && isset($_POST['UnitValue3'])
|
||||
)
|
||||
{
|
||||
global $GlobalMysqlHandler;
|
||||
$Id = $_POST['Id'];
|
||||
$Name = $_POST['Name'];
|
||||
$MoveId = (isset($_POST['MoveToId']))? $_POST['MoveToId']:0;
|
||||
|
||||
if ($MoveId)
|
||||
{
|
||||
$MoveQuery = "";
|
||||
if ($MoveId=="#MOVE#ITEM#UP#")
|
||||
{
|
||||
$FirstParentId = NestedListGetParentId($Id,'Types');
|
||||
$MoveId = NestedListGetParentId($FirstParentId,'Types');
|
||||
}
|
||||
else
|
||||
{
|
||||
$FirstParentId = NestedListGetParentId($Id,'Types');
|
||||
}
|
||||
|
||||
$MoveQuery="UPDATE `Types` SET `ParentId` = '$MoveId' WHERE `Id` =$Id LIMIT 1 ;";
|
||||
|
||||
if (mysqli_query($GlobalMysqlHandler, $MoveQuery))
|
||||
{
|
||||
MessageSuccess(LangSpell('SentenceNestedListMoved'));
|
||||
NestedListVisibilityUnset($FirstParentId,'EditTypes');
|
||||
NestedListVisibilitySet($MoveId,'EditTypes');
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageError(LangSpell('SentenceDatabaseError'));
|
||||
ErrorLog("[edit_types.php] Db error on moving element with id $Id to parent id $MoveId");
|
||||
}
|
||||
}
|
||||
|
||||
//$ChangeItemQuery="UPDATE `Types` SET `Name` = '$Name' WHERE `Id` =$Id LIMIT 1 ;";
|
||||
$ChangeItemQuery="UPDATE `Types` SET `Name` = '$Name', `ShortName` = '".$_POST['ShortName']."', `NameValue1` = '".$_POST['NameValue1']."', `NameValue2` = '".$_POST['NameValue2']."', `NameValue3` = '".$_POST['NameValue3']."', `UnitValue1` = '".$_POST['UnitValue1']."', `UnitValue2` = '".$_POST['UnitValue2']."', `UnitValue3` = '".$_POST['UnitValue3']."' WHERE `Id` =$Id LIMIT 1 ;";
|
||||
if (!mysqli_query($GlobalMysqlHandler, $ChangeItemQuery))
|
||||
{
|
||||
MessageError(LangSpell('SentenceDatabaseError'));
|
||||
ErrorLog("[edit_types.php] Db error on updating element with id $Id");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (isset($_POST['Name']) && !trim($_POST['Name']))
|
||||
MessageError(LangSpell('EditTypesNoTypeNameGiven'));
|
||||
else
|
||||
{
|
||||
ErrorLog("[edit_types.php] No Id to move down!");
|
||||
MessageError(LangSpell('SentenceUnknownError'));
|
||||
}
|
||||
}
|
||||
$ToDo="";
|
||||
}
|
||||
|
||||
///////////////
|
||||
// delete type
|
||||
if ($ToDo=="DeleteType")
|
||||
{
|
||||
if (isset($_GET['Id']) && $_GET['Id'])
|
||||
{
|
||||
$Id = $_GET['Id'];
|
||||
if (!LockIsActive('Types',$Id))
|
||||
{
|
||||
global $GlobalMysqlHandler;
|
||||
$DeleteQuery="DELETE FROM `Types` WHERE `Id` = $Id LIMIT 1";
|
||||
if (mysqli_query($GlobalMysqlHandler, $DeleteQuery))
|
||||
{
|
||||
MessageSuccess(LangSpell('EditTypesTypeDeleted'));
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageError(LangSpell('SentenceDatabaseError'));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageError(LangSpell('SentenceLockIsActive'));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ErrorLog("[edit_types.php] No Id to delete type!");
|
||||
MessageError(LangSpell('SentenceUnknownError'));
|
||||
}
|
||||
$ToDo="";
|
||||
}
|
||||
|
||||
////////////////
|
||||
// add new type
|
||||
if ($ToDo=="NewType")
|
||||
{
|
||||
if (isset($_GET['ParentId']) && isset($_POST['NewTypeName']))
|
||||
{
|
||||
$ParentId = $_GET['ParentId'];
|
||||
$NewTypeName = $_POST['NewTypeName'];
|
||||
if (LockActivate('Types',$ParentId))
|
||||
{
|
||||
if (trim($NewTypeName)!="")
|
||||
{
|
||||
global $GlobalMysqlHandler;
|
||||
$InsertQuery="INSERT INTO `Types` ( `Name` , `ParentId` ) VALUES ( '$NewTypeName', '$ParentId' );";
|
||||
if (mysqli_query($GlobalMysqlHandler, $InsertQuery))
|
||||
{
|
||||
MessageSuccess(LangSpell('EditTypesNewTypeAdded'));
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageError(LangSpell('SentenceDatabaseError'));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageError(LangSpell('EditTypesNoTypeNameGiven'));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageError(LangSpell('SentenceLockIsActive'));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!isset($_GET['ParentId']))
|
||||
ErrorLog("[edit_types.php] No ParentId to add new type!");
|
||||
if (!isset($_POST['NewTypeName']))
|
||||
ErrorLog("[edit_types.php] No NewTypeName to add new type!");
|
||||
MessageError(LangSpell('SentenceUnknownError'));
|
||||
}
|
||||
$ToDo="";
|
||||
}
|
||||
|
||||
/////////////
|
||||
// edit type
|
||||
if ($ToDo=="EditType")
|
||||
{
|
||||
if (isset($_GET['Id']) && $_GET['Id'])
|
||||
{
|
||||
$EditId = $_GET['Id'];
|
||||
if (LockActivate('Types',$EditId))
|
||||
{
|
||||
$EditTypesEditId=$EditId;
|
||||
//NestedListVisibilityUnset($EditId, 'EditTypes');
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageError(LangSpell('SentenceLockIsActive'));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ErrorLog("[edit_types.php] No Id to edit type.");
|
||||
MessageError(LangSpell('SentenceUnknownError'));
|
||||
}
|
||||
$ToDo = "";
|
||||
}
|
||||
|
||||
////////////////////
|
||||
// cancel edit type
|
||||
if ($ToDo=="CancelEditType")
|
||||
{
|
||||
if (isset($_GET['Id']) && $_GET['Id'])
|
||||
{
|
||||
$EditId = $_GET['Id'];
|
||||
if (LockRelease('Types',$EditId))
|
||||
{
|
||||
$EditTypesEditId=0;
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageError(LangSpell('SentenceLockIsActive'));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ErrorLog("[edit_types.php] No Id to release loack on storage");
|
||||
MessageError(LangSpell('SentenceUnknownError'));
|
||||
}
|
||||
$ToDo = "";
|
||||
}
|
||||
}
|
||||
|
||||
if (UserHasRight('EditTypes') || UserHasRight('ViewSTPV'))
|
||||
{
|
||||
///////////////
|
||||
// open sublist
|
||||
if ($ToDo=="OpenSublist")
|
||||
{
|
||||
if (isset($_GET['SublistId']) && $_GET['SublistId'])
|
||||
{
|
||||
NestedListVisibilityToggle($_GET['SublistId'], 'EditTypes');
|
||||
}
|
||||
else
|
||||
{
|
||||
ErrorLog("[edit_types.php] No SublistId to open type!");
|
||||
MessageError(LangSpell('SentenceUnknownError'));
|
||||
}
|
||||
$ToDo="";
|
||||
}
|
||||
|
||||
///////////////
|
||||
// sow types
|
||||
if ($ToDo=="")
|
||||
WriteTypeList(0,0);
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageError(LangSpell("ScentenceNoUserRights"));
|
||||
}
|
||||
?>
|
||||
261
pages/edit_users.php
Executable file
|
|
@ -0,0 +1,261 @@
|
|||
<?php
|
||||
|
||||
if (UserGetLogin()=="root")
|
||||
{
|
||||
////////////////
|
||||
//Add new user
|
||||
if ($ToDo=="NewUser")
|
||||
{
|
||||
//Get primary vars
|
||||
$Error=0;
|
||||
$Login = (isset($_POST['Login']))? $_POST['Login']:"";
|
||||
$Password = (isset($_POST['Password']))? $_POST['Password']:"";
|
||||
|
||||
//check primary vars
|
||||
$UserExistQuery="SELECT * FROM `User` WHERE `Login` LIKE '$Login'";
|
||||
$UserExistQuery=mysqli_query($GlobalMysqlHandler, $UserExistQuery);
|
||||
if ($Login=="" || $Login=="root" || mysqli_num_rows($UserExistQuery))
|
||||
{
|
||||
$Error=1;
|
||||
MessageError(LangSpell('SentenceLoginForbidden'));
|
||||
}
|
||||
|
||||
if ($Password=="")
|
||||
{
|
||||
$Error=1;
|
||||
MessageError(LangSpell('SentencePasswordForbidden'));
|
||||
}
|
||||
$Password=md5($Password);
|
||||
|
||||
if ($Error==0)
|
||||
{
|
||||
//insert into user table
|
||||
$InsertUserQuery = "INSERT INTO `User` ( `Login` , `Password` ) VALUES ( '$Login', '$Password' );";
|
||||
if (!mysqli_query($GlobalMysqlHandler, $InsertUserQuery))
|
||||
{
|
||||
ErrorLog("[edit_users.php] Database error while insert new user!");
|
||||
MessageError(LangSpell('SentenceDatabaseError'));
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageSuccess(LangSpell('SentenceNewUserAdded'));
|
||||
}
|
||||
|
||||
//get eactual inserted id
|
||||
$UserIdQuery="SELECT `Id` FROM `User` WHERE `Login` = '$Login' AND `Password` = '$Password'";
|
||||
$ActualInsertedUserId = 0;
|
||||
if (! ($UserIdQuery=mysqli_query($GlobalMysqlHandler, $UserIdQuery)) )
|
||||
ErrorLog("[edit_users.php] Database error while getting id from inserted user!");
|
||||
else
|
||||
{
|
||||
$ActualInsertedUserIdRecord=mysqli_fetch_array($UserIdQuery);
|
||||
$ActualInsertedUserId = $ActualInsertedUserIdRecord['Id'];
|
||||
|
||||
//insert user rights table
|
||||
|
||||
//generate rights query
|
||||
$RightsQuery="SELECT * FROM `UserRights` LIMIT 1";
|
||||
$RightsQuery=mysqli_query($GlobalMysqlHandler, $RightsQuery);
|
||||
$InsertRightValues = array();
|
||||
for ($i=1;$i<(mysqli_num_fields($RightsQuery));$i++)
|
||||
{
|
||||
if (isset($_POST[mysqli_field_name($RightsQuery,$i)]))
|
||||
{
|
||||
$x=count($InsertRightValues);
|
||||
$InsertRightValues[$x][0]=mysqli_field_name($RightsQuery,$i);
|
||||
$InsertRightValues[$x][1]=(strtoupper($_POST[mysqli_field_name($RightsQuery,$i)])=="TRUE")? "True":"False";
|
||||
}
|
||||
}
|
||||
|
||||
$InsertRightsQuery1 = "INSERT INTO `UserRights` ( `Id` ";
|
||||
$InsertRightsQuery2 = " ) VALUES ( '$ActualInsertedUserId' ";
|
||||
$InsertRightsQuery3 = " );";
|
||||
|
||||
for ($i=0;$i<count($InsertRightValues);$i++)
|
||||
{
|
||||
$InsertRightsQuery1 .= ", `".$InsertRightValues[$i][0]."` ";
|
||||
$InsertRightsQuery2 .= ", '".$InsertRightValues[$i][1]."'";
|
||||
}
|
||||
$InsertRightsQuery = $InsertRightsQuery1 . $InsertRightsQuery2 . $InsertRightsQuery3;
|
||||
|
||||
if (!mysqli_query($GlobalMysqlHandler, $InsertRightsQuery))
|
||||
{
|
||||
ErrorLog("[edit_users.php] Database error while insert new users rights (Id $ActualInsertedUserId)!");
|
||||
MessageError(LangSpell('SentenceDatabaseError'));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/////////////
|
||||
//Edit User
|
||||
if ($ToDo=="EditUser")
|
||||
{
|
||||
$Error=0;
|
||||
$Id = (isset($_POST['Id']))? $_POST['Id']:"";
|
||||
$Login = (isset($_POST['Login']))? $_POST['Login']:"";
|
||||
$Password = (isset($_POST['Password']))? $_POST['Password']:"";
|
||||
|
||||
$UserExistQuery="SELECT * FROM `User` WHERE `Login` LIKE '$Login' AND `Id` != '$Id'";
|
||||
$UserExistQuery=mysqli_query($GlobalMysqlHandler, $UserExistQuery);
|
||||
if ($Login=="" || $Login=="root" || mysqli_num_rows($UserExistQuery))
|
||||
{
|
||||
$Error=1;
|
||||
MessageError(LangSpell('SentenceLoginForbidden'));
|
||||
}
|
||||
|
||||
//check if user rights are existent, insert a record to UserRights if not
|
||||
$CheckRightsExistentQuery="SELECT * FROM `UserRights` WHERE `Id` =$Id";
|
||||
$CheckRightsExistentQuery=mysqli_query($GlobalMysqlHandler, $CheckRightsExistentQuery);
|
||||
if (!mysqli_num_rows($CheckRightsExistentQuery))
|
||||
{
|
||||
ErrorLog("[edit_users.php-EditUser] No record with Id=$Id in UserRights table!");
|
||||
$CheckRightsExistentQuery="INSERT INTO `ldtPartStock`.`UserRights` ( `Id` ) VALUES ( '$Id' );";
|
||||
if (!mysqli_query($GlobalMysqlHandler, $CheckRightsExistentQuery))
|
||||
ErrorLog("[edit_users.php-EditUser] Could not insert record with Id=$Id in UserRights table!");
|
||||
}
|
||||
|
||||
if ($Error==0)
|
||||
{
|
||||
//generate rights array var
|
||||
$UpdateRightValues = array();
|
||||
$RightsQuery="SELECT * FROM `UserRights` LIMIT 1";
|
||||
$RightsQuery=mysqli_query($GlobalMysqlHandler, $RightsQuery);
|
||||
for ($i=1;$i<(mysqli_num_fields($RightsQuery));$i++)
|
||||
{
|
||||
$x=count($UpdateRightValues);
|
||||
$UpdateRightValues[$x][0]=mysqli_field_name($RightsQuery,$i);
|
||||
$UpdateRightValues[$x][1]=( (isset($_POST[mysqli_field_name($RightsQuery,$i)]))
|
||||
&& (strtoupper($_POST[mysqli_field_name($RightsQuery,$i)])=="TRUE")
|
||||
)? "True":"False";
|
||||
}
|
||||
|
||||
//generate user query
|
||||
$UpdateUserQuery = "UPDATE `User` SET `Login` = '$Login'";
|
||||
if ($Password!="")
|
||||
$UpdateUserQuery .= ", `Password` = '".md5($Password)."'";
|
||||
$UpdateUserQuery .= " WHERE `Id` = '$Id' LIMIT 1;";
|
||||
|
||||
//generate user rights query
|
||||
$UpdateRightsQuery = "UPDATE `UserRights` SET ";
|
||||
for ($i=0;$i<count($UpdateRightValues);$i++)
|
||||
{
|
||||
$UpdateRightsQuery .= "`".$UpdateRightValues[$i][0]."` = '".$UpdateRightValues[$i][1]."'" . (($i<(count($UpdateRightValues)-1)) ? ", ":"");
|
||||
}
|
||||
$UpdateRightsQuery .= " WHERE `Id` = '$Id' LIMIT 1;";
|
||||
|
||||
$Error=0;
|
||||
|
||||
//update user table
|
||||
if (!mysqli_query($GlobalMysqlHandler, $UpdateUserQuery))
|
||||
{
|
||||
ErrorLog("[edit_users.php] Database error while update User table at Id = $Id!");
|
||||
MessageError(LangSpell('SentenceDatabaseError'));
|
||||
$Error=1;
|
||||
}
|
||||
|
||||
//update user rights table
|
||||
if (!mysqli_query($GlobalMysqlHandler, $UpdateRightsQuery))
|
||||
{
|
||||
ErrorLog("[edit_users.php] Database error while update UserRights table at Id = $Id!");
|
||||
MessageError(LangSpell('SentenceDatabaseError'));
|
||||
$Error=1;
|
||||
}
|
||||
|
||||
if (!$Error)
|
||||
MessageSuccess(LangSpell('SentenceUserUpdated'));
|
||||
}
|
||||
}
|
||||
|
||||
///////////////
|
||||
//Delete User
|
||||
if ($ToDo=="DeleteUser" && isset($_GET['Id']))
|
||||
{
|
||||
//generate querys
|
||||
$DeleteQuery1="DELETE FROM `User` WHERE `Id` = ".$_GET['Id'];
|
||||
$DeleteQuery2="DELETE FROM `UserRights` WHERE `Id` = ".$_GET['Id'];
|
||||
|
||||
//update DB
|
||||
if (!mysqli_query($GlobalMysqlHandler, $DeleteQuery1))
|
||||
{
|
||||
ErrorLog("[edit_users.php] Database error while delete user with Id=\"".$_GET['Id']."\" from User table!");
|
||||
MessageError(LangSpell('SentenceDatabaseError'));
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageSuccess(LangSpell('SentenceUserDeleted'));
|
||||
}
|
||||
|
||||
if (!mysqli_query($GlobalMysqlHandler, $DeleteQuery2))
|
||||
{
|
||||
ErrorLog("[edit_users.php] Database error while delete user with Id=\"".$_GET['Id']."\" from UserRihts table!");
|
||||
MessageError(LangSpell('SentenceDatabaseError'));
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////
|
||||
//Global content
|
||||
$UserQuery="SELECT * FROM `User`";
|
||||
$UserQuery=mysqli_query($GlobalMysqlHandler, $UserQuery);
|
||||
$RightsQuery="SELECT * FROM `UserRights` LIMIT 1";
|
||||
$RightsQuery=mysqli_query($GlobalMysqlHandler, $RightsQuery);
|
||||
|
||||
//table and head
|
||||
$GlobalContent.='<table>'."\n";
|
||||
$GlobalContent.=' <tr>'."\n";
|
||||
$GlobalContent.=' <th>Id</th>'."\n";
|
||||
$GlobalContent.=' <th>Login</th>'."\n";
|
||||
$GlobalContent.=' <th>Password</th>'."\n";
|
||||
for ($i=1;$i<mysqli_num_fields($RightsQuery);$i++)
|
||||
{
|
||||
$GlobalContent.=' <th>'.mysqli_field_name($RightsQuery,$i).'</th>'."\n";
|
||||
}
|
||||
$GlobalContent.=' <th> </th>'."\n";
|
||||
$GlobalContent.=' <th> </th>'."\n";
|
||||
$GlobalContent.=' </tr>'."\n";
|
||||
|
||||
//existing users
|
||||
while ($UserRecord=mysqli_fetch_array($UserQuery))
|
||||
{
|
||||
$GlobalContent.=' <tr>'."\n";
|
||||
$GlobalContent.=' <form action="index.php?Page=EditUsers&ToDo=EditUser" method="post">'."\n";
|
||||
$GlobalContent.=' <td><input type="hidden" name="Id" value="'.$UserRecord['Id'].'">'.$UserRecord['Id'].'</td>'."\n";
|
||||
$GlobalContent.=' <td><input type="text" name="Login" value="'.$UserRecord['Login'].'" title="'.LangSpellHtml('TagTitleEditUserLogin').'"></td>'."\n";
|
||||
$GlobalContent.=' <td><input type="password" name="Password" value="" title="'.LangSpellHtml('TagTitleEditUserPassword').'"></td>'."\n";
|
||||
|
||||
$RightsQuery="SELECT * FROM `UserRights` WHERE `Id` = ".$UserRecord['Id']." LIMIT 1";
|
||||
if (!$RightsQuery=mysqli_query($GlobalMysqlHandler, $RightsQuery))
|
||||
ErrorLog('[edit_users.php-$RightsQuery] Database error or user id '.$UserRecord['Id'].' not found in UserRights');
|
||||
$RightsRecord=mysqli_fetch_row($RightsQuery);
|
||||
for ($i=1;$i<(mysqli_num_fields($RightsQuery));$i++)
|
||||
{
|
||||
$GlobalContent.=' <td><input type="checkbox" name="'.mysqli_field_name($RightsQuery,$i).'" value="True" title="'.LangSpellHtml('TagTitleEditUserRight').'" '.((strtoupper($RightsRecord[$i])=="TRUE")? "checked":"").'></td>'."\n";
|
||||
}
|
||||
$GlobalContent.=' <td><input type="Submit" value="'.LangSpellHtml('ButtonSave').'" title="'.LangSpellHtml('ButtonSave').'" class="Button"></td>'."\n";
|
||||
$GlobalContent.=' <td><a href="index.php?Page=EditUsers&ToDo=DeleteUser&Id='.$UserRecord[0].'" title="'.LangSpellHtml('TagTitleDeleteUser').'" target="_top" class="Button">'.OtherGetIcon('Delete',0).'</a></td>'."\n";
|
||||
$GlobalContent.=' </form>'."\n";
|
||||
$GlobalContent.=' </tr>'."\n";
|
||||
}
|
||||
|
||||
//new user entry
|
||||
$GlobalContent.=' <tr>'."\n";
|
||||
$GlobalContent.=' <form action="index.php?Page=EditUsers&ToDo=NewUser" method="post">'."\n";
|
||||
$GlobalContent.=' <td><input type="hidden" name="Id" value="'.$UserRecord['Id'].'">'.$UserRecord[$i].'</td>'."\n";
|
||||
$GlobalContent.=' <td><input type="text" name="Login" value="'.$UserRecord['Login'].'" title="'.LangSpellHtml('TagTitleEditUserLogin').'"></td>'."\n";
|
||||
$GlobalContent.=' <td><input type="password" name="Password" value="" title="'.LangSpellHtml('TagTitleEditUserPassword').'"></td>'."\n";
|
||||
for ($i=1;$i<(mysqli_num_fields($RightsQuery));$i++)
|
||||
{
|
||||
$GlobalContent.=' <td><input type="checkbox" name="'.mysqli_field_name($RightsQuery,$i).'" value="True" title="'.LangSpellHtml('TagTitleEditUserRight').'"></td>'."\n";
|
||||
}
|
||||
$GlobalContent.=' <td><input type="Submit" value="'.LangSpellHtml('ButtonNew').'" class="Button"></td>'."\n";
|
||||
$GlobalContent.=' <td> </td>'."\n";
|
||||
$GlobalContent.=' </form>'."\n";
|
||||
$GlobalContent.=' </tr>'."\n";
|
||||
|
||||
$GlobalContent.='</table>'."\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageError(LangSpell("ScentenceNoUserRights"));
|
||||
}
|
||||
?>
|
||||
199
pages/edit_vendors.php
Executable file
|
|
@ -0,0 +1,199 @@
|
|||
<?php
|
||||
|
||||
$EditVendorId=0;
|
||||
|
||||
if (UserHasRight('EditVendors'))
|
||||
{
|
||||
////////////////
|
||||
//save changes
|
||||
if ($ToDo=="SaveVendor")
|
||||
{
|
||||
$Id = (isset($_POST['Id']))? $_POST['Id']:"";
|
||||
$Name = (isset($_POST['Name']))? $_POST['Name']:"";
|
||||
$Homepage = (isset($_POST['Homepage']))? $_POST['Homepage']:"";
|
||||
$MinBill = (isset($_POST['MinBill']))? OtherConvertToFloat($_POST['MinBill']):0;
|
||||
$ShippingCost = (isset($_POST['ShippingCost']))? OtherConvertToFloat($_POST['ShippingCost']):0;
|
||||
|
||||
if (LockIsActive('Vendors',$_POST['Id']))
|
||||
{
|
||||
MessageError(LangSpellHtml('SentenceLockIsActive'));
|
||||
}
|
||||
elseif (!$Id)
|
||||
{
|
||||
MessageError(LangSpellHtml('SentenceUnknownError'));
|
||||
}
|
||||
elseif (!$Name)
|
||||
{
|
||||
$Error=1;
|
||||
MessageError(LangSpellHtml('EditVendorsSentenceVendorNameRequired'));
|
||||
}
|
||||
else
|
||||
{
|
||||
$InsertVendorQuery = "UPDATE `Vendors` SET `Name` = '$Name', `Homepage` = '$Homepage', `MinBill` = '$MinBill', `ShippingCost` = '$ShippingCost' WHERE `Id` =$Id LIMIT 1 ;";
|
||||
if (!mysqli_query($GlobalMysqlHandler, $InsertVendorQuery))
|
||||
{
|
||||
ErrorLog("[edit_vendors.php] Database error while save changes vendor!");
|
||||
MessageError(LangSpell('SentenceDatabaseError'));
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageSuccess(LangSpell('EditVendorsSentenceVendorUpated'));
|
||||
}
|
||||
LockRelease('Vendors',$_POST['Id']);
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////
|
||||
//delete vendor
|
||||
if ($ToDo=="DeleteVendor")
|
||||
{
|
||||
global $GlobalMysqlHandler;
|
||||
$Id = (isset($_GET['Id']))? $_GET['Id']:0;
|
||||
$Vendor = (isset($_GET['Name']))? $_GET['Name']:0;
|
||||
if ($Id && !LockIsActive("Vendors",$Id))
|
||||
{
|
||||
if (!mysqli_query($GlobalMysqlHandler, "DELETE FROM `Vendors` WHERE `Id` = $Id LIMIT 1;"))
|
||||
{
|
||||
MessageError(LangSpellHtml('SentenceDatabaseError'));
|
||||
ErrorLog("[edit_vendors.php] Database error while delete vendor!");
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageSuccess(LangSpellHtml('EditVendorsSentenceVendorDeleted'));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageError(LangSpellHtml('SentenceLockIsActive'));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//////////////
|
||||
//new vendor
|
||||
if ($ToDo=="NewVendor")
|
||||
{
|
||||
$Name = (isset($_POST['Name']))? $_POST['Name']:"";
|
||||
$Homepage = (isset($_POST['Homepage']))? $_POST['Homepage']:"";
|
||||
$MinBill = (isset($_POST['MinBill']))? OtherConvertToFloat($_POST['MinBill']):0;
|
||||
$ShippingCost = (isset($_POST['ShippingCost']))? OtherConvertToFloat($_POST['ShippingCost']):0;
|
||||
|
||||
if (!$Name)
|
||||
{
|
||||
$Error=1;
|
||||
MessageError(LangSpellHtml('EditVendorsSentenceVendorNameRequired'));
|
||||
}
|
||||
else
|
||||
{
|
||||
$InsertVendorQuery = "INSERT INTO `Vendors` ( `Name` , `Homepage` , `MinBill` , `ShippingCost` ) VALUES ( '$Name', '$Homepage', '$MinBill', '$ShippingCost' );";
|
||||
if (!mysqli_query($GlobalMysqlHandler, $InsertVendorQuery))
|
||||
{
|
||||
ErrorLog("[edit_vendors.php] Database error while insert new vendor!");
|
||||
MessageError(LangSpell('SentenceDatabaseError'));
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageSuccess(LangSpell('EditVendorsSentenceVendorNewAdded'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////
|
||||
//cancel editing
|
||||
if ($ToDo=="CancelEditVendor")
|
||||
{
|
||||
$Id = (isset($_GET['Id']))? $_GET['Id']:"";
|
||||
if ($Id) LockRelease("Vendors",$Id);
|
||||
}
|
||||
|
||||
//////////////////
|
||||
//enable editing
|
||||
if (($ToDo=="EditVendor") && isset($_POST['Id']))
|
||||
{
|
||||
if (LockActivate('Vendors',$_POST['Id'])) $EditVendorId=$_POST['Id'];
|
||||
else MessageError(LangSpellHtml('SentenceLockIsActive'));
|
||||
}
|
||||
}
|
||||
|
||||
if(UserHasRight('EditVendors') || UserHasRight('ViewSTPV'))
|
||||
{
|
||||
//////////////////
|
||||
//global content
|
||||
$GlobalContent.='<table>'."\n";
|
||||
|
||||
$GlobalContent.=' <tr>'."\n";
|
||||
$GlobalContent.=' <th>'.LangSpellHtml('EditVendorsId').'</th>'."\n";
|
||||
$GlobalContent.=' <th>'.LangSpellHtml('EditVendorsName').'</th>'."\n";
|
||||
$GlobalContent.=' <th>'.LangSpellHtml('EditVendorsHomepage').'</th>'."\n";
|
||||
$GlobalContent.=' <th>'.LangSpellHtml('EditVendorsMinBill').'</th>'."\n";
|
||||
$GlobalContent.=' <th>'.LangSpellHtml('EditVendorsShippingCost').'</th>'."\n";
|
||||
if (UserHasRight('EditVendors'))
|
||||
$GlobalContent.=' <th colspan="2">'.LangSpellHtml('EditVendorsEdit').'</th>'."\n";
|
||||
$GlobalContent.=' </tr>'."\n";
|
||||
|
||||
$VendorQuery = "SELECT * FROM `Vendors`";
|
||||
$VendorQuery = mysqli_query($GlobalMysqlHandler, $VendorQuery);
|
||||
while ($Vendor=mysqli_fetch_array($VendorQuery))
|
||||
{
|
||||
if ( ($EditVendorId==$Vendor['Id']) )
|
||||
{
|
||||
$GlobalContent.=' <form action="index.php?Page=EditVendors&ToDo=SaveVendor" method="post">'."\n";
|
||||
$GlobalContent.=' <tr>'."\n";
|
||||
$GlobalContent.=' <td><input type="hidden" name="Id" value="'.$Vendor['Id'].'">'.$Vendor['Id'].'</td>'."\n";
|
||||
$GlobalContent.=' <td><input type="text" name="Name" value="'.$Vendor['Name'].'"></td>'."\n";
|
||||
$GlobalContent.=' <td><input type="text" name="Homepage" value="'.$Vendor['Homepage'].'"></td>'."\n";
|
||||
$GlobalContent.=' <td><input type="text" name="MinBill" value="'.$Vendor['MinBill'].'"></td>'."\n";
|
||||
$GlobalContent.=' <td><input type="text" name="ShippingCost" value="'.$Vendor['ShippingCost'].'"></td>'."\n";
|
||||
$GlobalContent.=' <td><a href="index.php?Page=EditVendors&ToDo=CancelEditVendor&Id='.$Vendor['Id'].'" title="'.LangSpellHtml('TagTitleCancel').'" target="_top">'.OtherGetIcon('Cancel',"Button").'</a></td>'."\n";
|
||||
$GlobalContent.=' <td><input type="submit" value="'.LangSpellHtml('ButtonSave').'" class="Button"></td>'."\n";
|
||||
$GlobalContent.=' </tr>'."\n";
|
||||
$GlobalContent.=' </form>'."\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
$GlobalContent.=' <tr>'."\n";
|
||||
$GlobalContent.=' <td>'.$Vendor['Id'].'</td>'."\n";
|
||||
$GlobalContent.=' <td>'.$Vendor['Name'].'</td>'."\n";
|
||||
$GlobalContent.=' <td><a href="'.$Vendor['Homepage'].'" target="_new">'.$Vendor['Homepage'].'</a></td>'."\n";
|
||||
$GlobalContent.=' <td>'.$Vendor['MinBill'].'</td>'."\n";
|
||||
$GlobalContent.=' <td>'.$Vendor['ShippingCost'].'</td>'."\n";
|
||||
if (LockIsActive("Vendors",$Vendor['Id']))
|
||||
$GlobalContent.=' <td>'.OtherGetIcon('LockActive.png').'</td>'."\n";
|
||||
elseif (UserHasRight('EditVendors'))
|
||||
{
|
||||
$GlobalContent.=' <td>'."\n";
|
||||
$GlobalContent.=' <a href="index.php?Page=EditVendors&ToDo=DeleteVendor&Id='.$Vendor['Id'].'&Name='.$Vendor['Name'].'" title="'.LangSpellHtml('TagTitleDeleteEntry').'" target="_top">'.OtherGetIcon('Delete',"Button").'</a>'."\n";
|
||||
$GlobalContent.=' </td>'."\n";
|
||||
$GlobalContent.=' <td>'."\n";
|
||||
$GlobalContent.=' <form action="index.php?Page=EditVendors&ToDo=EditVendor" method="post">'."\n";
|
||||
$GlobalContent.=' <input type="hidden" name="Id" value="'.$Vendor['Id'].'">'."\n";
|
||||
$GlobalContent.=' <input type="submit" value="'.LangSpellHtml('ButtonEdit').'" class="Button">'."\n";
|
||||
$GlobalContent.=' </form>'."\n";
|
||||
$GlobalContent.=' </td>'."\n";
|
||||
}
|
||||
$GlobalContent.=' </tr>'."\n";
|
||||
}
|
||||
}
|
||||
|
||||
if (!$EditVendorId && UserHasRight('EditVendors'))
|
||||
{
|
||||
$GlobalContent.=' <form action="index.php?Page=EditVendors&ToDo=NewVendor" method="post">'."\n";
|
||||
$GlobalContent.=' <tr>'."\n";
|
||||
$GlobalContent.=' <td><input type="hidden" name="Id" value="">'.$Vendor['Id'].'</td>'."\n";
|
||||
$GlobalContent.=' <td><input type="text" name="Name" value=""></td>'."\n";
|
||||
$GlobalContent.=' <td><input type="text" name="Homepage" value=""></td>'."\n";
|
||||
$GlobalContent.=' <td><input type="text" name="MinBill" value=""></td>'."\n";
|
||||
$GlobalContent.=' <td><input type="text" name="ShippingCost" value=""></td>'."\n";
|
||||
$GlobalContent.=' <td></td>'."\n";
|
||||
$GlobalContent.=' <td><input type="submit" value="'.LangSpellHtml('ButtonNew').'" class="Button"></td>'."\n";
|
||||
$GlobalContent.=' </tr>'."\n";
|
||||
$GlobalContent.=' </form>'."\n";
|
||||
}
|
||||
|
||||
$GlobalContent.='</table>'."\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageError(LangSpell("ScentenceNoUserRights"));
|
||||
}
|
||||
?>
|
||||
5
pages/home.php
Executable file
|
|
@ -0,0 +1,5 @@
|
|||
<?php
|
||||
|
||||
$GlobalContent .= "Ich bin Inhalt!";
|
||||
|
||||
?>
|
||||
155
pages/parts_by_store.php
Executable file
|
|
@ -0,0 +1,155 @@
|
|||
<?php
|
||||
global $GlobalMysqlHandler;
|
||||
if (!isset($_SESSION['PartsByStoreStoreId'])) $_SESSION['PartsByStoreStoreId']=0;
|
||||
|
||||
function WriteTypeSelector ($ParentId)
|
||||
{
|
||||
global $GlobalMysqlHandler;
|
||||
global $GlobalContent;
|
||||
global $GlobalTemplate;
|
||||
|
||||
$ListQuery="SELECT * FROM `Storages` WHERE `ParentId` =$ParentId";
|
||||
$ListQuery=mysqli_query($GlobalMysqlHandler, $ListQuery);
|
||||
|
||||
if (!$ParentId || NestedListVisibilityIsSet($ParentId, 'PartStoreSelector'))
|
||||
$GlobalContent .= "<ul style=\"display:block;\">\n";
|
||||
else
|
||||
$GlobalContent .= "<ul style=\"display:none;\">\n";
|
||||
|
||||
if (mysqli_num_rows($ListQuery))
|
||||
{
|
||||
while ($ListData=mysqli_fetch_array($ListQuery))
|
||||
{
|
||||
$GlobalContent .= "<li>";
|
||||
if (!(isset($_SESSION['PartsByStoreStoreId']) && $_SESSION['PartsByStoreStoreId']==$ListData['Id']))
|
||||
$GlobalContent .= " <a href=\"index.php?Page=PartsByStore&ToDo=ToggleTypeSelectorVisibility&SublistId=".$ListData['Id']."\">";
|
||||
$GlobalContent .= LangStr2Html($ListData['Name']);
|
||||
if (!(isset($_SESSION['PartsByStoreStoreId']) && $_SESSION['PartsByStoreStoreId']==$ListData['Id']))
|
||||
$GlobalContent .= "</a>\n";
|
||||
if (NestedListCountSubElements($ListData['Id'], 'Storages'))
|
||||
WriteTypeSelector($ListData['Id']);
|
||||
$GlobalContent .= "</li>\n";
|
||||
}
|
||||
}
|
||||
$GlobalContent .= "</ul>\n";
|
||||
}
|
||||
|
||||
|
||||
///////////////
|
||||
// open sublist
|
||||
if ($ToDo=="ToggleTypeSelectorVisibility")
|
||||
{
|
||||
if (isset($_GET['SublistId']) && $_GET['SublistId'])
|
||||
{
|
||||
$ParentId = NestedListGetParentId($_GET['SublistId'], 'Storages');
|
||||
NestedListVisibilityUnsetAllElements('PartStoreSelector');
|
||||
NestedListVisibilitySetAllParents($_GET['SublistId'], 'PartStoreSelector', 'Storages');
|
||||
NestedListVisibilitySet($_GET['SublistId'], 'PartStoreSelector');
|
||||
$_SESSION['PartsByStoreStoreId'] = $_GET['SublistId'];
|
||||
}
|
||||
else
|
||||
{
|
||||
ErrorLog("[parts_by_type.php] No SublistId to open type!");
|
||||
MessageError(LangSpell('SentenceUnknownError'));
|
||||
}
|
||||
$ToDo="";
|
||||
}
|
||||
|
||||
|
||||
///////////
|
||||
// Selector
|
||||
$GlobalContent .= '<div id="PartSelector">';
|
||||
$GlobalContent .= WriteTypeSelector (0);
|
||||
$GlobalContent .= '</div>'."\n";
|
||||
|
||||
////////////////
|
||||
// Sort Partlist
|
||||
if (!isset($_SESSION['SortPartListBy'])) $_SESSION['SortPartListBy']="Name";
|
||||
if (!isset($_SESSION['SortPartListOrder'])) $_SESSION['SortPartListOrder']="ASC";
|
||||
if (isset($_GET['SortBy']))
|
||||
{
|
||||
if ($_SESSION['SortPartListBy']==$_GET['SortBy']) //set order direction
|
||||
{
|
||||
if ($_SESSION['SortPartListOrder']=="ASC") $_SESSION['SortPartListOrder']="DESC";
|
||||
else $_SESSION['SortPartListOrder']="ASC";
|
||||
}
|
||||
else //set order by
|
||||
{
|
||||
$_SESSION['SortPartListBy']=$_GET['SortBy'];
|
||||
$_SESSION['SortPartListOrder']="ASC";
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////
|
||||
// Part List Begin
|
||||
$GlobalContent .= '<div id="PartList">';
|
||||
$GlobalContent .= '<table>'."\n";
|
||||
|
||||
//////////////////////
|
||||
// PartList Table Head
|
||||
$GlobalContent .= '<tr>';
|
||||
|
||||
//Name
|
||||
$GlobalContent .= '<th><a href="index.php?Page=PartsByStore&SortBy=Name" target="_top">';
|
||||
$GlobalContent .= LangSpellHtml('PartsName')." ";
|
||||
if ($_SESSION['SortPartListBy']=="Name" && $_SESSION['SortPartListOrder']=="ASC") $GlobalContent .= OtherGetIcon('SortUp',0);
|
||||
if ($_SESSION['SortPartListBy']=="Name" && $_SESSION['SortPartListOrder']=="DESC") $GlobalContent .= OtherGetIcon('SortDown',0);
|
||||
$GlobalContent .= '</a></th>';
|
||||
//Package
|
||||
$GlobalContent .= '<th><a href="index.php?Page=PartsByStore&SortBy=PackageId" target="_top">';
|
||||
$GlobalContent .= LangSpellHtml('PartsPackage')." ";
|
||||
if ($_SESSION['SortPartListBy']=="PackageId" && $_SESSION['SortPartListOrder']=="ASC") $GlobalContent .= OtherGetIcon('SortUp',0);
|
||||
if ($_SESSION['SortPartListBy']=="PackageId" && $_SESSION['SortPartListOrder']=="DESC") $GlobalContent .= OtherGetIcon('SortDown',0);
|
||||
$GlobalContent .= '</a></th>';
|
||||
//Quantity
|
||||
$GlobalContent .= '<th><a href="index.php?Page=PartsByStore&SortBy=Qty" target="_top">';
|
||||
$GlobalContent .= LangSpellHtml('PartsQuantity')." ";
|
||||
if ($_SESSION['SortPartListBy']=="Qty" && $_SESSION['SortPartListOrder']=="ASC") $GlobalContent .= OtherGetIcon('SortUp',0);
|
||||
if ($_SESSION['SortPartListBy']=="Qty" && $_SESSION['SortPartListOrder']=="DESC") $GlobalContent .= OtherGetIcon('SortDown',0);
|
||||
$GlobalContent .= '</a></th>';
|
||||
//Price
|
||||
$GlobalContent .= '<th><a href="index.php?Page=PartsByStore&SortBy=Price" target="_top">';
|
||||
$GlobalContent .= LangSpellHtml('PartsPrice')." ";
|
||||
if ($_SESSION['SortPartListBy']=="Price" && $_SESSION['SortPartListOrder']=="ASC") $GlobalContent .= OtherGetIcon('SortUp',0);
|
||||
if ($_SESSION['SortPartListBy']=="Price" && $_SESSION['SortPartListOrder']=="DESC") $GlobalContent .= OtherGetIcon('SortDown',0);
|
||||
$GlobalContent .= '</a></th>';
|
||||
//Obsolete
|
||||
$GlobalContent .= '<th>'.LangSpellHtml('PartsObsolete').'</th>';
|
||||
$GlobalContent .= '</tr>';
|
||||
|
||||
//////////////////////////
|
||||
// generate Partlist query
|
||||
$PartListQuery = "SELECT * FROM `Parts` WHERE `StorageId` = ".$_SESSION['PartsByStoreStoreId']."";
|
||||
$PartListQuery .= " ORDER BY `".$_SESSION['SortPartListBy']."` ".$_SESSION['SortPartListOrder'];
|
||||
//echo $PartListQuery;
|
||||
|
||||
/////////////////
|
||||
// Part List List
|
||||
$PartListQuery = mysqli_query($GlobalMysqlHandler, $PartListQuery);
|
||||
while ($Parts = mysqli_fetch_array($PartListQuery))
|
||||
{
|
||||
$GlobalContent .= ' <tr>';
|
||||
$GlobalContent .= ' <td><a href="index.php?Page=ShowPart&PartId='.$Parts['Id'].'" target="_top"><strong>'.$Parts['Name'].'</strong></a> '.$Parts['ShortDesc'].' </td>';
|
||||
//////////
|
||||
// Package
|
||||
$PackageQuery = "SELECT `Name` FROM `Packages` WHERE `Id` = ".$Parts['PackageId'];
|
||||
$PackageQuery = mysqli_query($GlobalMysqlHandler, $PackageQuery);
|
||||
if (mysqli_num_rows($PackageQuery))
|
||||
{
|
||||
$Package=mysqli_fetch_array($PackageQuery);
|
||||
$GlobalContent .= '<td>'.$Package['Name'].'</td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$GlobalContent .= '<td>-</td>';
|
||||
}
|
||||
$GlobalContent .= '<td>'.$Parts['Qty'].(($Parts['MinQty'])? "/".$Parts['MinQty']:"").'</td>';
|
||||
$GlobalContent .= '<td>'.OtherFormatPrice($Parts['Price']).'</td>';
|
||||
$GlobalContent .= '<td>'.((strtolower($Parts['Obsolete'])=="true")? LangSpellHtml('PartsObsolete'):"").'</td>';
|
||||
$GlobalContent .= ' </tr>';
|
||||
}
|
||||
|
||||
$GlobalContent .= '</table>'."\n";
|
||||
$GlobalContent .= '</div>'."\n";
|
||||
|
||||
?>
|
||||
241
pages/parts_by_type.php
Executable file
|
|
@ -0,0 +1,241 @@
|
|||
<?php
|
||||
global $GlobalMysqlHandler;
|
||||
if (!isset($_SESSION['PartsByTypeTypeId'])) $_SESSION['PartsByTypeTypeId']=0;
|
||||
|
||||
function WriteTypeSelector ($ParentId)
|
||||
{
|
||||
global $GlobalMysqlHandler;
|
||||
global $GlobalContent;
|
||||
global $GlobalTemplate;
|
||||
|
||||
$ListQuery="SELECT * FROM `Types` WHERE `ParentId` =$ParentId";
|
||||
$ListQuery=mysqli_query($GlobalMysqlHandler, $ListQuery);
|
||||
|
||||
if (!$ParentId || NestedListVisibilityIsSet($ParentId, 'PartTypeSelector'))
|
||||
$GlobalContent .= "<ul style=\"display:block;\">\n";
|
||||
else
|
||||
$GlobalContent .= "<ul style=\"display:none;\">\n";
|
||||
|
||||
if (mysqli_num_rows($ListQuery))
|
||||
{
|
||||
while ($ListData=mysqli_fetch_array($ListQuery))
|
||||
{
|
||||
$GlobalContent .= "<li>";
|
||||
//if (!NestedListVisibilityIsSet($ListData['Id'], 'PartTypeSelector')) $GlobalContent .= "+";
|
||||
if (!(isset($_SESSION['PartsByTypeTypeId']) && $_SESSION['PartsByTypeTypeId']==$ListData['Id']))
|
||||
$GlobalContent .= " <a href=\"index.php?Page=PartsByType&ToDo=ToggleTypeSelectorVisibility&SublistId=".$ListData['Id']."\">";
|
||||
$GlobalContent .= LangStr2Html($ListData['Name']);
|
||||
//if (strlen($ListData['ShortName'])) $GlobalContent .= " [".LangStr2Html($ListData['ShortName'])."]";
|
||||
if (!(isset($_SESSION['PartsByTypeTypeId']) && $_SESSION['PartsByTypeTypeId']==$ListData['Id']))
|
||||
$GlobalContent .= "</a>\n";
|
||||
if (NestedListCountSubElements($ListData['Id'], 'Types'))
|
||||
WriteTypeSelector($ListData['Id']);
|
||||
$GlobalContent .= "</li>\n";
|
||||
}
|
||||
}
|
||||
$GlobalContent .= "</ul>\n";
|
||||
}
|
||||
|
||||
//////////////
|
||||
// Delete Part
|
||||
if ($ToDo=="ToggleTypeSelectorVisibility" && UserHasRight('EditParts')
|
||||
&& isset($_POST['DeletePartId']) && $_POST['DeletePartId']
|
||||
&& isset($_POST['DeletePartShure']) && $_POST['DeletePartShure']=="True"
|
||||
&& isset($_GET['SublistId']) && $_GET['SublistId']
|
||||
)
|
||||
{
|
||||
if (LockIsActive('Parts',$_POST['DeletePartId']))
|
||||
{
|
||||
MessageError(LangSpellHtml('SentenceLockIsActive'));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (mysqli_query($GlobalMysqlHandler, "DELETE FROM `Parts` WHERE `Id` = ".$_POST['DeletePartId']." LIMIT 1"))
|
||||
{
|
||||
MessageSuccess(LangSpellHtml('SentencePartDeleted'));
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageError(LangSpellHtml('SentenceDatabaseError'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
///////////////
|
||||
// open sublist
|
||||
if ($ToDo=="ToggleTypeSelectorVisibility")
|
||||
{
|
||||
if (isset($_GET['SublistId']) && $_GET['SublistId'])
|
||||
{
|
||||
$ParentId = NestedListGetParentId($_GET['SublistId'], 'Types');
|
||||
NestedListVisibilityUnsetAllElements('PartTypeSelector');
|
||||
NestedListVisibilitySetAllParents($_GET['SublistId'], 'PartTypeSelector', 'Types');
|
||||
NestedListVisibilitySet($_GET['SublistId'], 'PartTypeSelector');
|
||||
$_SESSION['PartsByTypeTypeId'] = $_GET['SublistId'];
|
||||
}
|
||||
else
|
||||
{
|
||||
ErrorLog("[parts_by_type.php] No SublistId to open type!");
|
||||
MessageError(LangSpell('SentenceUnknownError'));
|
||||
}
|
||||
$ToDo="";
|
||||
}
|
||||
|
||||
/////////////
|
||||
// Type Array
|
||||
$TypeQuery = "SELECT * FROM `Types` WHERE `Id` = ".$_SESSION['PartsByTypeTypeId'];
|
||||
$TypeQuery = mysqli_query($GlobalMysqlHandler, $TypeQuery);
|
||||
$TypeValues = array();
|
||||
if (mysqli_num_rows($TypeQuery))
|
||||
{
|
||||
$TypeItem = mysqli_fetch_array($TypeQuery);
|
||||
$TypeValues[0][0] = $TypeItem['NameValue1'];
|
||||
$TypeValues[0][1] = $TypeItem['UnitValue1'];
|
||||
$TypeValues[1][0] = $TypeItem['NameValue2'];
|
||||
$TypeValues[1][1] = $TypeItem['UnitValue2'];
|
||||
$TypeValues[2][0] = $TypeItem['NameValue3'];
|
||||
$TypeValues[2][1] = $TypeItem['UnitValue3'];
|
||||
}
|
||||
|
||||
///////////
|
||||
// Selector
|
||||
$GlobalContent .= '<div id="PartSelector">';
|
||||
$GlobalContent .= WriteTypeSelector (0);
|
||||
$GlobalContent .= '</div>'."\n";
|
||||
|
||||
/////////
|
||||
// Filter
|
||||
$GlobalContent .= '<div id="PartFilter">'."\n";
|
||||
//Obsolete Filter
|
||||
if (!isset($_SESSION['FilterObsolete'])) $_SESSION['FilterObsolete']="NonObsolete";
|
||||
if (isset($_POST['FilterObsolete'])) $_SESSION['FilterObsolete']=$_POST['FilterObsolete'];
|
||||
$GlobalContent .= ' <form action="index.php?Page=PartsByType" method="post">'."\n";
|
||||
$GlobalContent .= ' <input type="radio" name="FilterObsolete" value="NonObsolete" onClick="javascript:this.form.submit()" '.(($_SESSION['FilterObsolete']=="NonObsolete")? "checked":"").'>'.LangSpellHtml('PartsObsoleteNon')."\n";
|
||||
$GlobalContent .= ' <input type="radio" name="FilterObsolete" value="OnlyObsolete" onClick="javascript:this.form.submit()" '.(($_SESSION['FilterObsolete']=="OnlyObsolete")? "checked":"").'>'.LangSpellHtml('PartsObsoleteOnly')."\n";
|
||||
$GlobalContent .= ' <input type="radio" name="FilterObsolete" value="AllObsolete" onClick="javascript:this.form.submit()" '.(($_SESSION['FilterObsolete']=="AllObsolete")? "checked":"").'>'.LangSpellHtml('PartsObsoleteAll')."\n";
|
||||
$GlobalContent .= ' </form>'."\n";
|
||||
$GlobalContent .= '</div>'."\n";
|
||||
|
||||
////////////////
|
||||
// Sort Partlist
|
||||
if (!isset($_SESSION['SortPartListBy'])) $_SESSION['SortPartListBy']="Name";
|
||||
if (!isset($_SESSION['SortPartListOrder'])) $_SESSION['SortPartListOrder']="ASC";
|
||||
if (isset($_GET['SortBy']))
|
||||
{
|
||||
if ($_SESSION['SortPartListBy']==$_GET['SortBy']) //set order direction
|
||||
{
|
||||
if ($_SESSION['SortPartListOrder']=="ASC") $_SESSION['SortPartListOrder']="DESC";
|
||||
else $_SESSION['SortPartListOrder']="ASC";
|
||||
}
|
||||
else //set order by
|
||||
{
|
||||
$_SESSION['SortPartListBy']=$_GET['SortBy'];
|
||||
$_SESSION['SortPartListOrder']="ASC";
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////
|
||||
// Part List Begin
|
||||
$GlobalContent .= '<div id="PartList">';
|
||||
$GlobalContent .= '<table>'."\n";
|
||||
|
||||
//////////////////////
|
||||
// PartList Table Head
|
||||
$GlobalContent .= '<tr>';
|
||||
|
||||
//Name
|
||||
$GlobalContent .= '<th><a href="index.php?Page=PartsByType&SortBy=Name" target="_top">';
|
||||
$GlobalContent .= LangSpellHtml('PartsName')." ";
|
||||
if ($_SESSION['SortPartListBy']=="Name" && $_SESSION['SortPartListOrder']=="ASC") $GlobalContent .= OtherGetIcon('SortUp',0);
|
||||
if ($_SESSION['SortPartListBy']=="Name" && $_SESSION['SortPartListOrder']=="DESC") $GlobalContent .= OtherGetIcon('SortDown',0);
|
||||
$GlobalContent .= '</a></th>';
|
||||
//Value 1
|
||||
if (isset($TypeValues[0][0]) && $TypeValues[0][0])
|
||||
{
|
||||
$GlobalContent .= '<th><a href="index.php?Page=PartsByType&SortBy=Value1" target="_top">';
|
||||
$GlobalContent .= $TypeValues[0][0]." ";
|
||||
if ($_SESSION['SortPartListBy']=="Value1" && $_SESSION['SortPartListOrder']=="ASC") $GlobalContent .= OtherGetIcon('SortUp',0);
|
||||
if ($_SESSION['SortPartListBy']=="Value1" && $_SESSION['SortPartListOrder']=="DESC") $GlobalContent .= OtherGetIcon('SortDown',0);
|
||||
$GlobalContent .= '</a></th>';
|
||||
}
|
||||
//Value2
|
||||
if (isset($TypeValues[1][0]) && $TypeValues[1][0])
|
||||
{
|
||||
$GlobalContent .= '<th><a href="index.php?Page=PartsByType&SortBy=Value2" target="_top">';
|
||||
$GlobalContent .= $TypeValues[1][0]." ";
|
||||
if ($_SESSION['SortPartListBy']=="Value2" && $_SESSION['SortPartListOrder']=="ASC") $GlobalContent .= OtherGetIcon('SortUp',0);
|
||||
if ($_SESSION['SortPartListBy']=="Value2" && $_SESSION['SortPartListOrder']=="DESC") $GlobalContent .= OtherGetIcon('SortDown',0);
|
||||
$GlobalContent .= '</a></th>';
|
||||
}
|
||||
//Value3
|
||||
if (isset($TypeValues[2][0]) && $TypeValues[2][0])
|
||||
{
|
||||
$GlobalContent .= '<th><a href="index.php?Page=PartsByType&SortBy=Value3" target="_top">';
|
||||
$GlobalContent .= $TypeValues[2][0]." ";
|
||||
if ($_SESSION['SortPartListBy']=="Value3" && $_SESSION['SortPartListOrder']=="ASC") $GlobalContent .= OtherGetIcon('SortUp',0);
|
||||
if ($_SESSION['SortPartListBy']=="Value3" && $_SESSION['SortPartListOrder']=="DESC") $GlobalContent .= OtherGetIcon('SortDown',0);
|
||||
$GlobalContent .= '</a></th>';
|
||||
}
|
||||
//Package
|
||||
$GlobalContent .= '<th><a href="index.php?Page=PartsByType&SortBy=PackageId" target="_top">';
|
||||
$GlobalContent .= LangSpellHtml('PartsPackage')." ";
|
||||
if ($_SESSION['SortPartListBy']=="PackageId" && $_SESSION['SortPartListOrder']=="ASC") $GlobalContent .= OtherGetIcon('SortUp',0);
|
||||
if ($_SESSION['SortPartListBy']=="PackageId" && $_SESSION['SortPartListOrder']=="DESC") $GlobalContent .= OtherGetIcon('SortDown',0);
|
||||
$GlobalContent .= '</a></th>';
|
||||
//Quantity
|
||||
$GlobalContent .= '<th><a href="index.php?Page=PartsByType&SortBy=Qty" target="_top">';
|
||||
$GlobalContent .= LangSpellHtml('PartsQuantity')." ";
|
||||
if ($_SESSION['SortPartListBy']=="Qty" && $_SESSION['SortPartListOrder']=="ASC") $GlobalContent .= OtherGetIcon('SortUp',0);
|
||||
if ($_SESSION['SortPartListBy']=="Qty" && $_SESSION['SortPartListOrder']=="DESC") $GlobalContent .= OtherGetIcon('SortDown',0);
|
||||
$GlobalContent .= '</a></th>';
|
||||
//Price
|
||||
$GlobalContent .= '<th><a href="index.php?Page=PartsByType&SortBy=Price" target="_top">';
|
||||
$GlobalContent .= LangSpellHtml('PartsPrice')." ";
|
||||
if ($_SESSION['SortPartListBy']=="Price" && $_SESSION['SortPartListOrder']=="ASC") $GlobalContent .= OtherGetIcon('SortUp',0);
|
||||
if ($_SESSION['SortPartListBy']=="Price" && $_SESSION['SortPartListOrder']=="DESC") $GlobalContent .= OtherGetIcon('SortDown',0);
|
||||
$GlobalContent .= '</a></th>';
|
||||
//Obsolete
|
||||
$GlobalContent .= '<th>'.LangSpellHtml('PartsObsolete').'</th>';
|
||||
$GlobalContent .= '</tr>';
|
||||
|
||||
//////////////////////////
|
||||
// generate Partlist query
|
||||
$PartListQuery = "SELECT * FROM `Parts` WHERE `TypeId` = ".$_SESSION['PartsByTypeTypeId']."";
|
||||
if ($_SESSION['FilterObsolete']=="OnlyObsolete") $PartListQuery .= " AND `Obsolete` LIKE 'TRUE'";
|
||||
if ($_SESSION['FilterObsolete']=="NonObsolete") $PartListQuery .= " AND `Obsolete` LIKE 'FALSE'";
|
||||
$PartListQuery .= " ORDER BY `".$_SESSION['SortPartListBy']."` ".$_SESSION['SortPartListOrder'];
|
||||
//echo $PartListQuery;
|
||||
|
||||
/////////////////
|
||||
// Part List List
|
||||
$PartListQuery = mysqli_query($GlobalMysqlHandler, $PartListQuery);
|
||||
while ($Parts = mysqli_fetch_array($PartListQuery))
|
||||
{
|
||||
$GlobalContent .= ' <tr>';
|
||||
$GlobalContent .= ' <td><a href="index.php?Page=ShowPart&PartId='.$Parts['Id'].'" target="_top"><strong>'.$Parts['Name'].'</strong></a> '.$Parts['ShortDesc'].' </td>';
|
||||
if (isset($TypeValues[0][0]) && $TypeValues[0][0]) $GlobalContent .= ' <td>'.OtherFloatToSiPrefix ($Parts['Value1']).$TypeValues[0][1].'</td>';
|
||||
if (isset($TypeValues[1][0]) && $TypeValues[1][0]) $GlobalContent .= ' <td>'.OtherFloatToSiPrefix ($Parts['Value2']).$TypeValues[1][1].'</td>';
|
||||
if (isset($TypeValues[2][0]) && $TypeValues[2][0]) $GlobalContent .= ' <td>'.OtherFloatToSiPrefix ($Parts['Value3']).$TypeValues[2][1].'</td>';
|
||||
//////////
|
||||
// Package
|
||||
$PackageQuery = "SELECT `Name` FROM `Packages` WHERE `Id` = ".$Parts['PackageId'];
|
||||
$PackageQuery = mysqli_query($GlobalMysqlHandler, $PackageQuery);
|
||||
if (mysqli_num_rows($PackageQuery))
|
||||
{
|
||||
$Package=mysqli_fetch_array($PackageQuery);
|
||||
$GlobalContent .= '<td>'.$Package['Name'].'</td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$GlobalContent .= '<td>-</td>';
|
||||
}
|
||||
$GlobalContent .= '<td>'.$Parts['Qty'].(($Parts['MinQty'])? "/".$Parts['MinQty']:"").'</td>';
|
||||
$GlobalContent .= '<td>'.OtherFormatPrice($Parts['Price']).'</td>';
|
||||
$GlobalContent .= '<td>'.((strtolower($Parts['Obsolete'])=="true")? LangSpellHtml('PartsObsolete'):"").'</td>';
|
||||
$GlobalContent .= ' </tr>';
|
||||
}
|
||||
|
||||
$GlobalContent .= '</table>'."\n";
|
||||
$GlobalContent .= '</div>'."\n";
|
||||
|
||||
?>
|
||||
73
pages/repeat_order.php
Executable file
|
|
@ -0,0 +1,73 @@
|
|||
<?php
|
||||
|
||||
function RepeatOrderTableByVendor ($VendorName, $VendorId)
|
||||
{
|
||||
global $GlobalMysqlHandler;
|
||||
global $GlobalContent;
|
||||
|
||||
$RepOrdQuery="SELECT * FROM `Parts` WHERE `Qty` < `MinQty` AND `VendorId` = $VendorId ORDER BY `Name` ASC";
|
||||
$RepOrdQuery=mysqli_query($GlobalMysqlHandler, $RepOrdQuery);
|
||||
|
||||
$ShowTable=0;
|
||||
if (mysqli_num_rows($RepOrdQuery))
|
||||
{
|
||||
$GlobalContent .= '<table>';
|
||||
$GlobalContent .= ' <tr>';
|
||||
$GlobalContent .= ' <td colspan="8">{'.$VendorId.'} <strong>'.$VendorName.'</strong></td>';
|
||||
$GlobalContent .= ' </tr>';
|
||||
$GlobalContent .= ' <tr>';
|
||||
$GlobalContent .= ' <th>'.LangSpellHtml('PartsName').'</th>';
|
||||
$GlobalContent .= ' <th>'.LangSpellHtml('PartsQuantity').'</th>';
|
||||
$GlobalContent .= ' <th>'.LangSpellHtml('PartsMinQuantity').'</th>';
|
||||
$GlobalContent .= ' <th>'.LangSpellHtml('PartsPackageUnit').'</th>';
|
||||
$GlobalContent .= ' <th>'.LangSpellHtml('PartsPrice').'</th>';
|
||||
$GlobalContent .= ' <th>'.LangSpellHtml('PartsVendorLink').'</th>';
|
||||
$GlobalContent .= ' <th>'.LangSpellHtml('RepeatOrderPackagesToOrder').'</th>';
|
||||
$GlobalContent .= ' <th>'.LangSpellHtml('RepeatOrderSumPrice').'</th>';
|
||||
$GlobalContent .= ' </tr>';
|
||||
$ShowTable = 1;
|
||||
}
|
||||
|
||||
$AllSumPrice=0;
|
||||
while ($Part = mysqli_fetch_array($RepOrdQuery))
|
||||
{
|
||||
if (!$Part['PackageUnit']) $Part['PackageUnit']=1;
|
||||
$Price=OtherFormatPrice($Part['Price']);
|
||||
$VendorLink=($Part['VendorLink'])? '<a href="'.$Part['VendorLink'].'" target="_new">':'-';
|
||||
$OrderPackages = ceil(($Part['MinQty']-$Part['Qty'])/$Part['PackageUnit']);
|
||||
$SumPrice = OtherFormatPrice($OrderPackages * $Part['Price']);
|
||||
$AllSumPrice += $OrderPackages * $Part['Price'];
|
||||
|
||||
$GlobalContent .= ' <tr>';
|
||||
$GlobalContent .= ' <td><a href="'.$Part['VendorLink'].'" title="'.$Part['VendorLink'].'" target="_new">'.$Part['Name'].'</a></td>';
|
||||
$GlobalContent .= ' <td>'.$Part['Qty'].'</td>';
|
||||
$GlobalContent .= ' <td>'.$Part['MinQty'].'</td>';
|
||||
$GlobalContent .= ' <td>'.$Part['PackageUnit'].'</td>';
|
||||
$GlobalContent .= ' <td>'.$Price.'</td>';
|
||||
$GlobalContent .= ' <td>'.$VendorLink.'</td>';
|
||||
$GlobalContent .= ' <td>'.$OrderPackages.'</td>';
|
||||
$GlobalContent .= ' <td>'.OtherFormatPrice($SumPrice).'</td>';
|
||||
$GlobalContent .= ' </tr>';
|
||||
}
|
||||
if ($ShowTable)
|
||||
{
|
||||
$GlobalContent .= ' <tr>';
|
||||
$GlobalContent .= ' <td colspan="7"></td><td><strong>'.OtherFormatPrice($AllSumPrice).'</strong></td>';
|
||||
$GlobalContent .= ' </tr>';
|
||||
$GlobalContent .= '</table>';
|
||||
}
|
||||
}
|
||||
|
||||
global $GlobalMysqlHandler;
|
||||
|
||||
|
||||
$VendorQuery = "SELECT * FROM `Vendors` ORDER BY `Name` ASC";
|
||||
$VendorQuery = mysqli_query($GlobalMysqlHandler, $VendorQuery);
|
||||
RepeatOrderTableByVendor(LangSpellHtml('PartsNotSpecified'),0);
|
||||
while ($Vendor = mysqli_fetch_array($VendorQuery))
|
||||
{
|
||||
RepeatOrderTableByVendor($Vendor['Name'],$Vendor['Id']);
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
398
pages/show_part.php
Executable file
|
|
@ -0,0 +1,398 @@
|
|||
<?php
|
||||
global $GlobalMysqlHandler;
|
||||
global $GlobalDownloadDir;
|
||||
global $GlobalPictureDir;
|
||||
|
||||
//////////////
|
||||
// Get Part Id
|
||||
$PartId = 0;
|
||||
$PartId = (isset($_GET['PartId']) ) ? $_GET['PartId']:$PartId;
|
||||
$PartId = (isset($_POST['PartId'])) ? $_POST['PartId']:$PartId;
|
||||
|
||||
//mysql part request
|
||||
$PartSQLQuery = "SELECT * FROM `Parts` WHERE `Id` = $PartId LIMIT 1;";
|
||||
$PartQuery = mysqli_query($GlobalMysqlHandler, $PartSQLQuery);
|
||||
$Part = mysqli_fetch_array($PartQuery);
|
||||
|
||||
if (mysqli_num_rows($PartQuery))
|
||||
{
|
||||
/////////////////////
|
||||
// upload new picture
|
||||
if (($ToDo=="UploadNewPicture") && (UserHasRight('EditParts')))
|
||||
{
|
||||
if (!LockIsActive('Parts',$PartId))
|
||||
{
|
||||
if (!is_dir($GlobalPictureDir) && !mkdir($GlobalPictureDir))
|
||||
{
|
||||
MessageError(LangSpell('SentenceCanNotCopyFile'));
|
||||
ErrorLog("Can not create directory $GlobalPictureDir");
|
||||
}
|
||||
elseif (!isset($_FILES['NewPictureFile']))
|
||||
{
|
||||
MessageError(LangSpell('SentenceNoFileGiven'));
|
||||
$ToDo="EditPicture";
|
||||
}
|
||||
elseif ($_FILES['NewPictureFile']['error'])
|
||||
{
|
||||
MessageError($_FILES['NewPictureFile']['error'].': http://www.php.net/manual/de/features.file-upload.errors.php');
|
||||
ErrorLog("Picture upload error ".$_FILES['NewPictureFile']['error']);
|
||||
$ToDo="EditPicture";
|
||||
}
|
||||
elseif (diskfreespace($GlobalPictureDir)<$_FILES['NewPictureFile']['size'])
|
||||
{
|
||||
MessageError(LangSpell('SentenceNotEnoughDiskSpace'));
|
||||
$ToDo="EditPicture";
|
||||
}
|
||||
else
|
||||
{
|
||||
$DestinationFileName = "[".$PartId."]_".$_FILES["NewPictureFile"]["name"];
|
||||
$SqlInsertQuery="UPDATE `Parts` SET `PicturePath` = '$DestinationFileName' WHERE `Id` = $PartId LIMIT 1 ;";
|
||||
$OldFileNameQuery=mysqli_query($GlobalMysqlHandler, "SELECT `PicturePath` FROM `Parts` WHERE `Id` = $PartId");
|
||||
$OldFileNameArray=mysqli_fetch_array($OldFileNameQuery);
|
||||
$OldFileName=$OldFileNameArray['PicturePath'];
|
||||
if ($OldFileName && file_exists($GlobalPictureDir."/".$OldFileName) && !unlink($GlobalPictureDir."/".$OldFileName))
|
||||
{
|
||||
MessageError(LangSpell('SentenceCanNotCopyFile'));
|
||||
ErrorLog("Unable to delete old picture!");
|
||||
$ToDo="EditPicture";
|
||||
}
|
||||
elseif (!move_uploaded_file($_FILES["NewPictureFile"]["tmp_name"],$GlobalPictureDir."/".$DestinationFileName))
|
||||
{
|
||||
MessageError(LangSpell('SentenceCanNotCopyFile')." ($GlobalPictureDir)");
|
||||
$ToDo="EditPicture";
|
||||
}
|
||||
elseif (!mysqli_query($GlobalMysqlHandler, $SqlInsertQuery))
|
||||
{
|
||||
ErrorLog("Can not instert into table 'Parts'!");
|
||||
MessageError(LangSpell('SentenceDatabaseError'));
|
||||
unlink($GlobalPictureDir."/".$DestinationFileName);
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageSuccess(LangSpell('SentenceFileHasBeenUploaded'));
|
||||
$ToDo="";
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageError(LangSpell('SentenceLockIsActive'));
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////
|
||||
// Delete Download
|
||||
if (isset($_GET['DownloadId']) && ($ToDo=="DeleteDownload") && (UserHasRight('EditParts')))
|
||||
{
|
||||
if (!LockIsActive('Parts',$PartId))
|
||||
{
|
||||
$DownloadQuery = "SELECT * FROM `Downloads` WHERE `Id` = ".$_GET['DownloadId'];
|
||||
$DownloadQuery = mysqli_query($GlobalMysqlHandler, $DownloadQuery);
|
||||
if (mysqli_num_rows($DownloadQuery))
|
||||
{
|
||||
$Download=mysqli_fetch_array($DownloadQuery);
|
||||
if (file_exists($GlobalDownloadDir."/".$Download['Path']))
|
||||
{
|
||||
if (unlink($GlobalDownloadDir."/".$Download['Path']))
|
||||
{
|
||||
if (mysqli_query($GlobalMysqlHandler, "DELETE FROM `Downloads` WHERE `Id` = ".$_GET['DownloadId']." LIMIT 1"))
|
||||
MessageSuccess(LangSpell('SentenceDownloadDeleted'));
|
||||
else
|
||||
{
|
||||
ErrorLog("Can not update table 'Downloads' at id '".$_POST['EditDownloadId']."'!");
|
||||
MessageError(LangSpell('SentenceDatabaseError'));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ErrorLog("Deleting file '".$GlobalDownloadDir."/".$Download['Path']."' failed'!");
|
||||
MessageError(LangSpell('SentenceCanNotCopyFile'));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (mysqli_query($GlobalMysqlHandler, "DELETE FROM `Downloads` WHERE `Id` = ".$_GET['DownloadId']." LIMIT 1"))
|
||||
MessageSuccess(LangSpell('SentenceDownloadDeleted'));
|
||||
else
|
||||
{
|
||||
ErrorLog("Can not update table 'Downloads' at id '".$_POST['EditDownloadId']."'!");
|
||||
MessageError(LangSpell('SentenceDatabaseError'));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageError(LangSpell('SentenceLockIsActive'));
|
||||
}
|
||||
$ToDo="";
|
||||
}
|
||||
|
||||
////////////////
|
||||
// Edit Download
|
||||
if (isset($_POST['EditDownloadId']) && isset($_POST['EditDownloadName']) && ($ToDo=="EditDownload") && (UserHasRight('EditParts')))
|
||||
{
|
||||
if (!LockIsActive('Parts',$PartId))
|
||||
{
|
||||
if (!mysqli_query($GlobalMysqlHandler, "UPDATE `Downloads` SET `Name` = '".$_POST['EditDownloadName']."' WHERE `Id` =".$_POST['EditDownloadId']." LIMIT 1 ;"))
|
||||
{
|
||||
ErrorLog("Can not update table 'Downloads' at id '".$_POST['EditDownloadId']."'!");
|
||||
MessageError(LangSpell('SentenceDatabaseError'));
|
||||
}
|
||||
else
|
||||
MessageSuccess(LangSpell('SentenceDownloadEdited'));
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageError(LangSpell('SentenceLockIsActive'));
|
||||
}
|
||||
$ToDo="";
|
||||
}
|
||||
|
||||
//////////////////////
|
||||
// upload new downlaod
|
||||
if (($ToDo=="UploadNewDownload") && (UserHasRight('EditParts')))
|
||||
{
|
||||
if (!LockIsActive('Parts',$PartId))
|
||||
{
|
||||
if (!is_dir($GlobalDownloadDir) && !mkdir($GlobalDownloadDir))
|
||||
{
|
||||
MessageError(LangSpell('SentenceCanNotCopyFile'));
|
||||
ErrorLog("Can not create directory $GlobalDownloadDir");
|
||||
}
|
||||
elseif (!isset($_FILES['AddNewDownloadFile']))
|
||||
{
|
||||
MessageError(LangSpell('SentenceNoFileGiven'));
|
||||
$ToDo="EditDownloads";
|
||||
}
|
||||
elseif ($_FILES['AddNewDownloadFile']['error'])
|
||||
{
|
||||
MessageError($_FILES['AddNewDownloadFile']['error'].': http://www.php.net/manual/de/features.file-upload.errors.php');
|
||||
ErrorLog("Upload error ".$_FILES['AddNewDownloadFile']['error']);
|
||||
$ToDo="EditDownloads";
|
||||
}
|
||||
elseif (diskfreespace($GlobalDownloadDir)<$_FILES['AddNewDownloadFile']['size'])
|
||||
{
|
||||
MessageError(LangSpell('SentenceNotEnoughDiskSpace'));
|
||||
$ToDo="EditDownloads";
|
||||
}
|
||||
else
|
||||
{
|
||||
$DestinationFileName = "[".$PartId."]_".$_FILES["AddNewDownloadFile"]["name"];
|
||||
$SqlInsertQuery="INSERT INTO `Downloads` ( `PartId` , `Name` , `Path` , `Type` ) VALUES ( '$PartId', "
|
||||
."'".((isset($_POST['AddNewDownloadName']) && $_POST['AddNewDownloadName'])? $_POST['AddNewDownloadName']:$_FILES["AddNewDownloadFile"]["name"])."', "
|
||||
."'$DestinationFileName', '".$_FILES["AddNewDownloadFile"]["type"]."' );";
|
||||
if (file_exists($GlobalDownloadDir."/".$DestinationFileName))
|
||||
{
|
||||
MessageError(LangSpell('SentenceFileAlreadyExist'));
|
||||
$ToDo="EditDownloads";
|
||||
}
|
||||
elseif (!move_uploaded_file($_FILES["AddNewDownloadFile"]["tmp_name"],$GlobalDownloadDir."/".$DestinationFileName))
|
||||
{
|
||||
MessageError(LangSpell('SentenceCanNotCopyFile')." ($GlobalDownloadDir)");
|
||||
$ToDo="EditDownloads";
|
||||
}
|
||||
elseif (!mysqli_query($GlobalMysqlHandler, $SqlInsertQuery))
|
||||
{
|
||||
ErrorLog("Can not instert into table 'Downloads'!");
|
||||
MessageError(LangSpell('SentenceDatabaseError'));
|
||||
unlink($GlobalDownloadDir."/".$DestinationFileName);
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageSuccess(LangSpell('SentenceFileHasBeenUploaded'));
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageError(LangSpell('SentenceLockIsActive'));
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////
|
||||
// Save values of the part
|
||||
if (($ToDo=="SaveValues") && (UserHasRight('EditParts')))
|
||||
{
|
||||
if (!LockIsActive('Parts',$PartId))
|
||||
{
|
||||
$UpdateQuery = "UPDATE `Parts` SET `Name` = '".$_POST['EditValuesName']."', ";
|
||||
$UpdateQuery .= "`Value1` = '".((isset($_POST['EditValuesValue1']))? OtherSiPrefixToFloat($_POST['EditValuesValue1']):0)."', ";
|
||||
$UpdateQuery .= "`Value2` = '".((isset($_POST['EditValuesValue2']))? OtherSiPrefixToFloat($_POST['EditValuesValue2']):0)."', ";
|
||||
$UpdateQuery .= "`Value3` = '".((isset($_POST['EditValuesValue3']))? OtherSiPrefixToFloat($_POST['EditValuesValue3']):0)."', ";
|
||||
$UpdateQuery .= "`ShortDesc` = '".$_POST['EditValuesShortDesc']."', ";
|
||||
$UpdateQuery .= "`LongDesc` = '".$_POST['EditValuesLongDesc']."', ";
|
||||
$UpdateQuery .= "`VendorId` = '".$_POST['EditValuesVendor']."', ";
|
||||
$UpdateQuery .= "`VendorLink` = '".$_POST['NewPartVedorLink']."', ";
|
||||
$UpdateQuery .= "`ManufactorLink` = '".$_POST['NewPartManufactorLink']."', ";
|
||||
$UpdateQuery .= "`PackageUnit` = '".$_POST['EditValuesPackageUnit']."', ";
|
||||
$UpdateQuery .= "`Price` = '".OtherFormatPrice($_POST['EditValuesPrice'])."', ";
|
||||
$UpdateQuery .= "`MinOrderQty` = '".$_POST['EditValuesMinOrderQty']."', ";
|
||||
$UpdateQuery .= "`Qty` = '".$_POST['EditValuesQty']."', ";
|
||||
$UpdateQuery .= "`MinQty` = '".$_POST['EditValuesMinQty']."', ";
|
||||
$UpdateQuery .= "`Obsolete` = '".(((isset($_POST['EditValuesObsolete'])) && (strtolower($_POST['EditValuesObsolete'])=="true"))? "True":"False")."' ";
|
||||
$UpdateQuery .= "WHERE `Id` = $PartId LIMIT 1 ;";
|
||||
if (mysqli_query($GlobalMysqlHandler, $UpdateQuery))
|
||||
{
|
||||
MessageSuccess(LangSpell('SentencePartHasBeenUpdated'));
|
||||
}
|
||||
else
|
||||
{
|
||||
ErrorLog("Can not update table 'Parts' at id '$PartId'!");
|
||||
MessageError(LangSpell('SentenceDatabaseError'));
|
||||
}
|
||||
$ToDo="";
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageError(LangSpell('SentenceLockIsActive'));
|
||||
}
|
||||
$ToDo="";
|
||||
}
|
||||
|
||||
///////////////////////////
|
||||
// Save storage of the part
|
||||
if (isset($_POST['EditPartStorage']) && ($ToDo=="SaveStorage") && (UserHasRight('EditParts')))
|
||||
{
|
||||
if (!LockIsActive('Parts',$PartId))
|
||||
{
|
||||
if (!mysqli_query($GlobalMysqlHandler, "UPDATE `Parts` SET `StorageId` = '".$_POST['EditPartStorage']."' WHERE `Id` =$PartId LIMIT 1 ;"))
|
||||
{
|
||||
ErrorLog("Can not update table 'Parts' at id '$PartId'!");
|
||||
MessageError(LangSpell('SentenceDatabaseError'));
|
||||
}
|
||||
else
|
||||
MessageSuccess(LangSpell('SentencePartHasBeenUpdated'));
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageError(LangSpell('SentenceLockIsActive'));
|
||||
}
|
||||
$ToDo="";
|
||||
}
|
||||
|
||||
///////////////////////////
|
||||
// Save package of the part
|
||||
if (isset($_POST['EditPartPackage']) && ($ToDo=="SavePackage") && (UserHasRight('EditParts')))
|
||||
{
|
||||
if (!LockIsActive('Parts',$PartId))
|
||||
{
|
||||
if (!mysqli_query($GlobalMysqlHandler, "UPDATE `Parts` SET `PackageId` = '".$_POST['EditPartPackage']."' WHERE `Id` =$PartId LIMIT 1 ;"))
|
||||
{
|
||||
ErrorLog("Can not update table 'Parts' at id '$PartId'!");
|
||||
MessageError(LangSpell('SentenceDatabaseError'));
|
||||
}
|
||||
else
|
||||
MessageSuccess(LangSpell('SentencePartHasBeenUpdated'));
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageError(LangSpell('SentenceLockIsActive'));
|
||||
}
|
||||
$ToDo="";
|
||||
}
|
||||
|
||||
////////////////////////
|
||||
// Save type of the part
|
||||
if (isset($_POST['EditPartType']) && ($ToDo=="SaveType") && (UserHasRight('EditParts')))
|
||||
{
|
||||
if (!LockIsActive('Parts',$PartId))
|
||||
{
|
||||
if (!mysqli_query($GlobalMysqlHandler, "UPDATE `Parts` SET `TypeId` = '".$_POST['EditPartType']."' WHERE `Id` =$PartId LIMIT 1 ;"))
|
||||
{
|
||||
ErrorLog("Can not update table 'Parts' at id '$PartId'!");
|
||||
MessageError(LangSpell('SentenceDatabaseError'));
|
||||
}
|
||||
else
|
||||
MessageSuccess(LangSpell('SentencePartHasBeenUpdated'));
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageError(LangSpell('SentenceLockIsActive'));
|
||||
}
|
||||
$ToDo="";
|
||||
}
|
||||
|
||||
//////////////////////////////
|
||||
//Update Parts Actual Quantity
|
||||
if (isset($_POST['NewQuantity']) && ($ToDo=="SaveNewQuantity") && (UserHasRight('EditParts') || UserHasRight('EditPartQuantity')))
|
||||
{
|
||||
if (!LockIsActive('Parts',$PartId))
|
||||
{
|
||||
$NewQuantity=$_POST['NewQuantity'];
|
||||
if (!mysqli_query($GlobalMysqlHandler, "UPDATE `Parts` SET `Qty` = '$NewQuantity' WHERE `Id` =$PartId LIMIT 1 ;"))
|
||||
{
|
||||
ErrorLog("Can not update table 'Parts' at id '$PartId'!");
|
||||
MessageError(LangSpell('SentenceDatabaseError'));
|
||||
}
|
||||
else
|
||||
MessageSuccess(LangSpell('SentencePartHasBeenUpdated'));
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageError(LangSpell('SentenceLockIsActive'));
|
||||
}
|
||||
$ToDo="";
|
||||
}
|
||||
|
||||
/////////////////
|
||||
// Get Part Query
|
||||
$PartSQLQuery = "SELECT * FROM `Parts` WHERE `Id` = $PartId LIMIT 1;";
|
||||
$PartQuery = mysqli_query($GlobalMysqlHandler, $PartSQLQuery);
|
||||
$Part = mysqli_fetch_array($PartQuery);
|
||||
|
||||
/////////////
|
||||
// Type Array
|
||||
$TypeQuery = "SELECT * FROM `Types` WHERE `Id` = ".$Part['TypeId'];
|
||||
$TypeQuery = mysqli_query($GlobalMysqlHandler, $TypeQuery);
|
||||
$TypeValues = array();
|
||||
if (mysqli_num_rows($TypeQuery))
|
||||
{
|
||||
$TypeItem = mysqli_fetch_array($TypeQuery);
|
||||
$TypeValues[0][0] = $TypeItem['NameValue1'];
|
||||
$TypeValues[0][1] = $TypeItem['UnitValue1'];
|
||||
$TypeValues[1][0] = $TypeItem['NameValue2'];
|
||||
$TypeValues[1][1] = $TypeItem['UnitValue2'];
|
||||
$TypeValues[2][0] = $TypeItem['NameValue3'];
|
||||
$TypeValues[2][1] = $TypeItem['UnitValue3'];
|
||||
}
|
||||
|
||||
$GlobalContent .= '<div id="ShowPart">'."\n";
|
||||
|
||||
if ($ToDo=="EditType" && UserHasRight('EditParts') && LockActivate('Parts',$PartId))
|
||||
{
|
||||
include "./pages/show_part_edit_type.php";
|
||||
}
|
||||
elseif ($ToDo=="EditPackage" && UserHasRight('EditParts') && LockActivate('Parts',$PartId))
|
||||
{
|
||||
include "./pages/show_part_edit_package.php";
|
||||
}
|
||||
elseif ($ToDo=="EditStorage" && UserHasRight('EditParts') && LockActivate('Parts',$PartId))
|
||||
{
|
||||
include "./pages/show_part_edit_storage.php";
|
||||
}
|
||||
elseif ($ToDo=="EditValues" && UserHasRight('EditParts') && LockActivate('Parts',$PartId))
|
||||
{
|
||||
include "./pages/show_part_edit_values.php";
|
||||
}
|
||||
elseif ($ToDo=="EditDownloads" && UserHasRight('EditParts') && LockActivate('Parts',$PartId))
|
||||
{
|
||||
include "./pages/show_part_edit_downloads.php";
|
||||
}
|
||||
elseif ($ToDo=="DeletePart" && UserHasRight('EditParts') && LockActivate('Parts',$PartId))
|
||||
{
|
||||
include "./pages/show_part_delete_part.php";
|
||||
}
|
||||
else
|
||||
{
|
||||
include "./pages/show_part_show.php";
|
||||
}
|
||||
|
||||
$GlobalContent .= '</div>'."\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageError(LangSpell("SentenceDatabaseError"));
|
||||
ErrorLog("[show_part.php] Part Id '$PartId' not found!");
|
||||
}
|
||||
?>
|
||||
22
pages/show_part_delete_part.php
Executable file
|
|
@ -0,0 +1,22 @@
|
|||
<?php
|
||||
|
||||
if (UserHasRight('EditParts'))
|
||||
{
|
||||
global $GlobalMysqlHandler;
|
||||
global $PartId;
|
||||
global $Part;
|
||||
|
||||
$GlobalContent .= "<h1>".LangSpellHtml('SentenceShureToDeletePart')."</h1>";
|
||||
$GlobalContent .= "<strong>".$Part['Name']."</strong> ".$Part['ShortDesc']."<br><br>\n";
|
||||
$GlobalContent .= '<form action="index.php?Page=PartsByType&ToDo=ToggleTypeSelectorVisibility&SublistId='.$Part['TypeId'].'" method="post">';
|
||||
$GlobalContent .= '<input type="hidden" name="DeletePartId" value="'.$PartId.'">';
|
||||
$GlobalContent .= LangSpellHtml('SentenceShureToDeletePart').': <input type="checkbox" name="DeletePartShure" value="True">';
|
||||
$GlobalContent .= ' <input type="submit" value="'.LangSpellHtml('ButtonProceed').'">';
|
||||
$GlobalContent .= '</form>';
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageError(LangSpell("ScentenceNoUserRights"));
|
||||
}
|
||||
?>
|
||||
63
pages/show_part_edit_downloads.php
Executable file
|
|
@ -0,0 +1,63 @@
|
|||
<?php
|
||||
if (UserHasRight('EditParts'))
|
||||
{
|
||||
global $GlobalMysqlHandler;
|
||||
global $PartId;
|
||||
global $Part;
|
||||
global $GlobalDownloadDir;
|
||||
|
||||
//////////////
|
||||
// Value Table
|
||||
|
||||
$GlobalContent .= '<table>';
|
||||
|
||||
$GlobalContent .= '<tr>';
|
||||
$GlobalContent .= '<th></th>';
|
||||
$GlobalContent .= '<th>'.LangSpellHtml('DownloadsName').'</th>';
|
||||
$GlobalContent .= '<th>'.LangSpellHtml('DownloadsPath').'</th>';
|
||||
$GlobalContent .= '<th>'.LangSpellHtml('DownloadsSize').'</th>';
|
||||
$GlobalContent .= '<th>'.LangSpellHtml('DownloadsType').'</th>';
|
||||
$GlobalContent .= '<th>'.LangSpellHtml('ButtonEdit').'</th>';
|
||||
$GlobalContent .= '</tr>';
|
||||
|
||||
$DownloadQuery = "SELECT * FROM `Downloads` WHERE `PartId` = $PartId";
|
||||
$DownloadQuery = mysqli_query($GlobalMysqlHandler, $DownloadQuery);
|
||||
while ($Download = mysqli_fetch_array($DownloadQuery))
|
||||
{
|
||||
$Size="-";
|
||||
if (file_exists($GlobalDownloadDir."/".$Download['Path'])) $Size=sprintf("%.2f",filesize($GlobalDownloadDir."/".$Download['Path'])/(1024*1024))." MB";
|
||||
|
||||
$GlobalContent .= '<form action="index.php?Page=ShowPart&PartId='.$PartId.'&ToDo=EditDownload" method="post">';
|
||||
$GlobalContent .= '<input type="hidden" name="EditDownloadId" value="'.$Download['Id'].'">';
|
||||
$GlobalContent .= '<tr>';
|
||||
$GlobalContent .= '<td>{'.$Download['Id'].'}</td>';
|
||||
$GlobalContent .= '<td><input type="text" name="EditDownloadName" value="'.$Download['Name'].'"></td>';
|
||||
$GlobalContent .= '<td>'.$Download['Path'].'</td>';
|
||||
$GlobalContent .= '<td>'.$Size.'</td>';
|
||||
$GlobalContent .= '<td>'.$Download['Type'].'</td>';
|
||||
$GlobalContent .= '<td>';
|
||||
$GlobalContent .= '<a href="index.php?Page=ShowPart&PartId='.$PartId.'&ToDo=DeleteDownload&DownloadId='.$Download['Id'].'" target="_top">'.OtherGetIcon('Delete',"Button").'</a> ';
|
||||
$GlobalContent .= '<input type="submit" value="'.LangSpellHtml('ButtonSave').'"class="Button">';
|
||||
$GlobalContent .= '</td>';
|
||||
$GlobalContent .= '</tr>';
|
||||
$GlobalContent .= '</form>';
|
||||
}
|
||||
|
||||
|
||||
$GlobalContent .= '<form action="index.php?Page=ShowPart&PartId='.$PartId.'&ToDo=UploadNewDownload" method="post" enctype="multipart/form-data">';
|
||||
$GlobalContent .= '<input type="hidden" name="MAX_FILE_SIZE" value="200000000">';
|
||||
$GlobalContent .= '<tr><td></td>';
|
||||
$GlobalContent .= '<td><input type="text" name="AddNewDownloadName" value=""></td>';
|
||||
$GlobalContent .= '<td><input type="file" name="AddNewDownloadFile" value=""></td>';
|
||||
$GlobalContent .= '<td></td><td></td>';
|
||||
$GlobalContent .= '<td><input type="submit" value="'.LangSpellHtml('ButtonUpload').'"class="Button"></td>';
|
||||
$GlobalContent .= '</tr>';
|
||||
$GlobalContent .= '</form>';
|
||||
|
||||
$GlobalContent .= '</table>';
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageError(LangSpell("ScentenceNoUserRights"));
|
||||
}
|
||||
?>
|
||||
72
pages/show_part_edit_package.php
Executable file
|
|
@ -0,0 +1,72 @@
|
|||
<?php
|
||||
|
||||
$NewPartType = (isset($_POST['NewPartType']))? $_POST['NewPartType']:0;
|
||||
|
||||
function WritePackageList($ParentId, $ParentIsLocked)
|
||||
{
|
||||
global $GlobalMysqlHandler;
|
||||
global $GlobalContent;
|
||||
global $GlobalTemplate;
|
||||
global $EditTypesEditId;
|
||||
global $PartId;
|
||||
global $Part;
|
||||
|
||||
$ListQuery="SELECT * FROM `Packages` WHERE `ParentId` =$ParentId";
|
||||
$ListQuery=mysqli_query($GlobalMysqlHandler, $ListQuery);
|
||||
|
||||
if (!$ParentId || NestedListVisibilityIsSet($ParentId, 'EditPartPackage'))
|
||||
$GlobalContent .= "<ul style=\"display:block;\">\n";
|
||||
else
|
||||
$GlobalContent .= "<ul style=\"display:none;\">\n";
|
||||
|
||||
if (mysqli_num_rows($ListQuery))
|
||||
{
|
||||
while ($ListData=mysqli_fetch_array($ListQuery))
|
||||
{
|
||||
$GlobalContent .= " <li>\n";
|
||||
if (LockIsActive('Types',$ListData['Id']) || $ParentIsLocked)
|
||||
{
|
||||
$GlobalContent .= ' '.OtherGetIcon('LockActive');
|
||||
$ParentIsLocked = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$GlobalContent .= ' <input type="radio" name="EditPartPackage" value="'.$ListData['Id'].'" '.(($Part['PackageId']==$ListData['Id'])? "checked":"").'>';
|
||||
}
|
||||
$GlobalContent .= " <a href=\"index.php?Page=ShowPart&ToDo=EditPackage&PartId=$PartId&OpenSublistId=".$ListData['Id']."\">".LangStr2Html($ListData['Name'])."</a>";
|
||||
$GlobalContent .= " (".NestedListCountSubElements($ListData['Id'],'Packages').")";
|
||||
$GlobalContent .= " \n</li>\n";
|
||||
|
||||
WritePackageList($ListData['Id'],$ParentIsLocked);
|
||||
}
|
||||
}
|
||||
$GlobalContent .= "</ul>\n";
|
||||
}
|
||||
|
||||
|
||||
if (UserHasRight('EditParts'))
|
||||
{
|
||||
///////////////
|
||||
// open sublist
|
||||
if (isset($_GET['OpenSublistId']) && $_GET['OpenSublistId'])
|
||||
{
|
||||
NestedListVisibilityToggle($_GET['OpenSublistId'], 'EditPartPackage');
|
||||
}
|
||||
else
|
||||
{
|
||||
NestedListVisibilityUnsetAllElements ('EditPartPackage');
|
||||
NestedListVisibilitySetAllParents ($Part['PackageId'], 'EditPartPackage', 'Packages');
|
||||
NestedListVisibilitySet ($Part['PackageId'], 'EditPartPackage');
|
||||
}
|
||||
|
||||
$GlobalContent .= '<h1>'.LangSpellHtml('SentencePleaseSelectPackage').'</h1>';
|
||||
$GlobalContent .= '<form action="index.php?Page=ShowPart&ToDo=SavePackage&PartId='.$PartId.'" method="post">';
|
||||
WritePackageList(0, 0);
|
||||
$GlobalContent .= '<input type="submit" value="'.LangSpellHtml('ButtonSave').'"class="Button">';
|
||||
$GlobalContent .= '</form>';
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageError(LangSpell("ScentenceNoUserRights"));
|
||||
}
|
||||
?>
|
||||
72
pages/show_part_edit_storage.php
Executable file
|
|
@ -0,0 +1,72 @@
|
|||
<?php
|
||||
|
||||
$NewPartType = (isset($_POST['NewPartType']))? $_POST['NewPartType']:0;
|
||||
|
||||
function WriteStorageList($ParentId, $ParentIsLocked)
|
||||
{
|
||||
global $GlobalMysqlHandler;
|
||||
global $GlobalContent;
|
||||
global $GlobalTemplate;
|
||||
global $EditTypesEditId;
|
||||
global $PartId;
|
||||
global $Part;
|
||||
|
||||
$ListQuery="SELECT * FROM `Storages` WHERE `ParentId` =$ParentId";
|
||||
$ListQuery=mysqli_query($GlobalMysqlHandler, $ListQuery);
|
||||
|
||||
if (!$ParentId || NestedListVisibilityIsSet($ParentId, 'EditPartStorage'))
|
||||
$GlobalContent .= "<ul style=\"display:block;\">\n";
|
||||
else
|
||||
$GlobalContent .= "<ul style=\"display:none;\">\n";
|
||||
|
||||
if (mysqli_num_rows($ListQuery))
|
||||
{
|
||||
while ($ListData=mysqli_fetch_array($ListQuery))
|
||||
{
|
||||
$GlobalContent .= " <li>\n";
|
||||
if (LockIsActive('Types',$ListData['Id']) || $ParentIsLocked)
|
||||
{
|
||||
$GlobalContent .= ' '.OtherGetIcon('LockActive');
|
||||
$ParentIsLocked = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$GlobalContent .= ' <input type="radio" name="EditPartStorage" value="'.$ListData['Id'].'" '.(($Part['StorageId']==$ListData['Id'])? "checked":"").'>';
|
||||
}
|
||||
$GlobalContent .= " <a href=\"index.php?Page=ShowPart&ToDo=EditStorage&PartId=$PartId&OpenSublistId=".$ListData['Id']."\">".LangStr2Html($ListData['Name'])."</a>";
|
||||
$GlobalContent .= " (".NestedListCountSubElements($ListData['Id'],'Storages').")";
|
||||
$GlobalContent .= " \n</li>\n";
|
||||
|
||||
WriteStorageList($ListData['Id'],$ParentIsLocked);
|
||||
}
|
||||
}
|
||||
$GlobalContent .= "</ul>\n";
|
||||
}
|
||||
|
||||
|
||||
if (UserHasRight('EditParts'))
|
||||
{
|
||||
///////////////
|
||||
// open sublist
|
||||
if (isset($_GET['OpenSublistId']) && $_GET['OpenSublistId'])
|
||||
{
|
||||
NestedListVisibilityToggle($_GET['OpenSublistId'], 'EditPartStorage');
|
||||
}
|
||||
else
|
||||
{
|
||||
NestedListVisibilityUnsetAllElements ('EditPartStorage');
|
||||
NestedListVisibilitySetAllParents ($Part['StorageId'], 'EditPartStorage', 'Storages');
|
||||
NestedListVisibilitySet ($Part['StorageId'], 'EditPartStorage');
|
||||
}
|
||||
|
||||
$GlobalContent .= '<h1>'.LangSpellHtml('SentencePleaseSelectPartStorage').'</h1>';
|
||||
$GlobalContent .= '<form action="index.php?Page=ShowPart&ToDo=SaveStorage&PartId='.$PartId.'" method="post">';
|
||||
WriteStorageList(0, 0);
|
||||
$GlobalContent .= '<input type="submit" value="'.LangSpellHtml('ButtonSave').'"class="Button">';
|
||||
$GlobalContent .= '</form>';
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageError(LangSpell("ScentenceNoUserRights"));
|
||||
}
|
||||
?>
|
||||
74
pages/show_part_edit_type.php
Executable file
|
|
@ -0,0 +1,74 @@
|
|||
<?php
|
||||
|
||||
function WriteTypeList($ParentId, $ParentIsLocked)
|
||||
{
|
||||
global $GlobalMysqlHandler;
|
||||
global $GlobalContent;
|
||||
global $GlobalTemplate;
|
||||
global $EditTypesEditId;
|
||||
global $PartId;
|
||||
global $Part;
|
||||
|
||||
$ListQuery="SELECT * FROM `Types` WHERE `ParentId` =$ParentId";
|
||||
$ListQuery=mysqli_query($GlobalMysqlHandler, $ListQuery);
|
||||
|
||||
if (!$ParentId || NestedListVisibilityIsSet($ParentId, 'EditPartType'))
|
||||
$GlobalContent .= "<ul style=\"display:block;\">\n";
|
||||
else
|
||||
$GlobalContent .= "<ul style=\"display:none;\">\n";
|
||||
|
||||
if (mysqli_num_rows($ListQuery))
|
||||
{
|
||||
while ($ListData=mysqli_fetch_array($ListQuery))
|
||||
{
|
||||
$GlobalContent .= " <li>\n";
|
||||
if (LockIsActive('Types',$ListData['Id']) || $ParentIsLocked)
|
||||
{
|
||||
$GlobalContent .= ' '.OtherGetIcon('LockActive.png');
|
||||
$ParentIsLocked = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$GlobalContent .= ' <input type="radio" name="EditPartType" value="'.$ListData['Id'].'" '.(($Part['TypeId']==$ListData['Id'])? "checked":"").'>';
|
||||
}
|
||||
$GlobalContent .= " <a href=\"index.php?Page=ShowPart&ToDo=EditType&PartId=$PartId&OpenSublistId=".$ListData['Id']."\">".LangStr2Html($ListData['Name']);
|
||||
if (strlen($ListData['ShortName'])) $GlobalContent .= " [".LangStr2Html($ListData['ShortName'])."]";
|
||||
$GlobalContent .= "</a>";
|
||||
$GlobalContent .= " (".NestedListCountSubElements($ListData['Id'],'Types').")";
|
||||
$GlobalContent .= " \n</li>\n";
|
||||
|
||||
WriteTypeList($ListData['Id'],$ParentIsLocked);
|
||||
}
|
||||
}
|
||||
$GlobalContent .= "</ul>\n";
|
||||
}
|
||||
|
||||
|
||||
if (UserHasRight('EditParts'))
|
||||
{
|
||||
///////////////
|
||||
// open sublist
|
||||
if (isset($_GET['OpenSublistId']) && $_GET['OpenSublistId'])
|
||||
{
|
||||
NestedListVisibilityToggle($_GET['OpenSublistId'], 'EditPartType');
|
||||
}
|
||||
else
|
||||
{
|
||||
NestedListVisibilityUnsetAllElements ('EditPartType');
|
||||
NestedListVisibilitySetAllParents ($Part['TypeId'], 'EditPartType', 'Types');
|
||||
NestedListVisibilitySet ($Part['TypeId'], 'EditPartType');
|
||||
}
|
||||
|
||||
//////////
|
||||
// Content
|
||||
$GlobalContent .= '<h1>'.LangSpellHtml('SentencePleaseSelectPartType').'</h1>';
|
||||
$GlobalContent .= '<form action="index.php?Page=ShowPart&ToDo=SaveType&PartId='.$PartId.'" method="post">';
|
||||
WriteTypeList(0, 0);
|
||||
$GlobalContent .= '<input type="submit" value="'.LangSpellHtml('ButtonSave').'"class="Button">';
|
||||
$GlobalContent .= '</form>';
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageError(LangSpell("ScentenceNoUserRights"));
|
||||
}
|
||||
?>
|
||||
119
pages/show_part_edit_values.php
Executable file
|
|
@ -0,0 +1,119 @@
|
|||
<?php
|
||||
|
||||
if (UserHasRight('EditParts'))
|
||||
{
|
||||
global $GlobalMysqlHandler;
|
||||
global $PartId;
|
||||
global $Part;
|
||||
|
||||
/////////////
|
||||
// Type Array
|
||||
$TypeQuery = "SELECT * FROM `Types` WHERE `Id` = ".$Part['TypeId'];
|
||||
$TypeQuery = mysqli_query($GlobalMysqlHandler, $TypeQuery);
|
||||
$TypeValues = array();
|
||||
if (mysqli_num_rows($TypeQuery))
|
||||
{
|
||||
$TypeItem = mysqli_fetch_array($TypeQuery);
|
||||
$TypeValues[0][0] = $TypeItem['NameValue1'];
|
||||
$TypeValues[0][1] = $TypeItem['UnitValue1'];
|
||||
$TypeValues[1][0] = $TypeItem['NameValue2'];
|
||||
$TypeValues[1][1] = $TypeItem['UnitValue2'];
|
||||
$TypeValues[2][0] = $TypeItem['NameValue3'];
|
||||
$TypeValues[2][1] = $TypeItem['UnitValue3'];
|
||||
}
|
||||
|
||||
//////////////
|
||||
// Value Table
|
||||
|
||||
$GlobalContent .= '<h1>'.LangSpellHtml('SentencePleaseSpecifyPartValues').'</h1>';
|
||||
$GlobalContent .= '<form action="index.php?Page=ShowPart&PartId='.$PartId.'&ToDo=SaveValues" method="post">';
|
||||
$GlobalContent .= '<table>';
|
||||
|
||||
$GlobalContent .= '<tr><th>'.LangSpellHtml('PartsObsolete').'</th><td>';
|
||||
$GlobalContent .= '<input type="checkbox" name="EditValuesObsolete" value="TRUE" '.((strtolower($Part['Obsolete'])=="true")? "checked":"").'"></td></tr>';
|
||||
|
||||
$GlobalContent .= '<tr><th>'.LangSpellHtml('PartsName').'</th><td>';
|
||||
$GlobalContent .= '<input type="text" name="EditValuesName" value="'.$Part['Name'].'"></td></tr>';
|
||||
|
||||
$GlobalContent .= '<tr><td></td><td></td></tr>';
|
||||
|
||||
if ($TypeValues[0][0])
|
||||
{
|
||||
$GlobalContent .= '<tr><th>'.$TypeValues[0][0].'</th><td>';
|
||||
$GlobalContent .= '<input type="text" name="EditValuesValue1" value="'.$Part['Value1'].'"></td>';
|
||||
$GlobalContent .= '<td> '.$TypeValues[0][1].'</td></tr>';
|
||||
}
|
||||
|
||||
if ($TypeValues[1][0])
|
||||
{
|
||||
$GlobalContent .= '<tr><th>'.$TypeValues[1][0].'</th><td>';
|
||||
$GlobalContent .= '<input type="text" name="EditValuesValue2" value="'.$Part['Value2'].'"></td>';
|
||||
$GlobalContent .= '<td> '.$TypeValues[1][1].'</td></tr>';
|
||||
}
|
||||
|
||||
if ($TypeValues[2][0])
|
||||
{
|
||||
$GlobalContent .= '<tr><th>'.$TypeValues[2][0].'</th><td>';
|
||||
$GlobalContent .= '<input type="text" name="EditValuesValue3" value="'.$Part['Value3'].'"></td>';
|
||||
$GlobalContent .= '<td> '.$TypeValues[2][1].'</td></tr>';
|
||||
}
|
||||
|
||||
$GlobalContent .= '<tr><td></td><td></td></tr>';
|
||||
|
||||
$GlobalContent .= '<tr><th>'.LangSpellHtml('PartsShortDescription').'</th><td>';
|
||||
$GlobalContent .= '<input type="text" name="EditValuesShortDesc" value="'.$Part['ShortDesc'].'"></td></tr>';
|
||||
|
||||
$GlobalContent .= '<tr><th>'.LangSpellHtml('PartsLongDescription').'</th><td>';
|
||||
$GlobalContent .= '<textarea name="EditValuesLongDesc">'.$Part['LongDesc'].'</textarea></td></tr>';
|
||||
|
||||
$GlobalContent .= '<tr><td></td><td></td></tr>';
|
||||
|
||||
$GlobalContent .= '<tr><th>'.LangSpellHtml('PartsQuantity').'</th><td>';
|
||||
$GlobalContent .= '<input type="text" name="EditValuesQty" value="'.$Part['Qty'].'"></td></tr>';
|
||||
|
||||
$GlobalContent .= '<tr><th>'.LangSpellHtml('PartsMinQuantity').'</th><td>';
|
||||
$GlobalContent .= '<input type="text" name="EditValuesMinQty" value="'.$Part['MinQty'].'"></td></tr>';
|
||||
|
||||
$GlobalContent .= '<tr><td></td><td></td></tr>';
|
||||
|
||||
$GlobalContent .= '<tr><th>'.LangSpellHtml('PartsPackageUnit').'</th><td>';
|
||||
$GlobalContent .= '<input type="text" name="EditValuesPackageUnit" value="'.$Part['PackageUnit'].'"></td></tr>';
|
||||
|
||||
$GlobalContent .= '<tr><th>'.LangSpellHtml('PartsMinOrderQuantity').'</th><td>';
|
||||
$GlobalContent .= '<input type="text" name="EditValuesMinOrderQty" value="'.$Part['MinOrderQty'].'"></td></tr>';
|
||||
|
||||
$GlobalContent .= '<tr><th>'.LangSpellHtml('PartsPrice').'</th><td>';
|
||||
$GlobalContent .= '<input type="text" name="EditValuesPrice" value="'.OtherFormatPrice($Part['Price']).'"></td></tr>';
|
||||
|
||||
$GlobalContent .= '<tr><td></td><td></td></tr>';
|
||||
|
||||
$GlobalContent .= '<tr><th>'.LangSpellHtml('PartsVendor').'</th><td>';
|
||||
$GlobalContent .= '<select name="EditValuesVendor">';
|
||||
$VendorQuery = "SELECT `Id`,`Name` FROM `Vendors` ORDER BY `Name` ASC";
|
||||
$GlobalContent .= '<option value="0">'.LangSpellHtml('PartsNotSpecified').'</option>';
|
||||
$VendorQuery = mysqli_query($GlobalMysqlHandler, $VendorQuery);
|
||||
while ($VendorData = mysqli_fetch_array($VendorQuery))
|
||||
{
|
||||
$Selected = ($Part['VendorId']==$VendorData['Id'])? "selected":"";
|
||||
$GlobalContent .= '<option value="'.$VendorData['Id'].'" '.$Selected.'>'.$VendorData['Name'].'</option>';
|
||||
}
|
||||
$GlobalContent .= '</select></td></tr>';
|
||||
|
||||
$GlobalContent .= '<tr><th>'.LangSpellHtml('PartsVendorLink').'</th><td>';
|
||||
$GlobalContent .= '<input type="text" name="NewPartVedorLink" value="'.$Part['VendorLink'].'"></td></tr>';
|
||||
|
||||
$GlobalContent .= '<tr><th>'.LangSpellHtml('PartsManufactorLink').'</th><td>';
|
||||
$GlobalContent .= '<input type="text" name="NewPartManufactorLink" value="'.$Part['ManufactorLink'].'"></td></tr>';
|
||||
|
||||
$GlobalContent .= '<tr><th></th><td>';
|
||||
$GlobalContent .= '<input type="submit" value="'.LangSpellHtml('ButtonSave').'"class="Button">';
|
||||
$GlobalContent .= '</td></tr>';
|
||||
|
||||
$GlobalContent .= '</table>';
|
||||
$GlobalContent .= '</form>';
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageError(LangSpell("ScentenceNoUserRights"));
|
||||
}
|
||||
?>
|
||||
178
pages/show_part_show.php
Executable file
|
|
@ -0,0 +1,178 @@
|
|||
<?php
|
||||
|
||||
global $GlobalMysqlHandler;
|
||||
|
||||
|
||||
/////////////////////////////
|
||||
// Type, Package, Store, Name
|
||||
$GlobalContent .= '<div id="ShowPartHead">'."\n";
|
||||
//Part Head
|
||||
$GlobalContent .= '<h1>{'.$Part['Id'].'} '.$Part['Name'].'</h1>'."\n";
|
||||
//Type
|
||||
$TypeId = $Part['TypeId'];
|
||||
$TypeString = "";
|
||||
while ($TypeId)
|
||||
{
|
||||
$LocalTypeString = "";
|
||||
$LocalTypeString = NestedListGetName($TypeId,'Types');
|
||||
$LocalTypeString = '<a href="index.php?Page=PartsByType&ToDo=ToggleTypeSelectorVisibility&SublistId='.$TypeId.'" target="_top">'.$LocalTypeString . "</a>";
|
||||
$TypeId = NestedListGetParentId ($TypeId,'Types');
|
||||
if ($TypeId) $LocalTypeString = " > " . $LocalTypeString;
|
||||
$TypeString = $LocalTypeString . $TypeString;
|
||||
}
|
||||
$GlobalContent .= '<strong>'.LangSpellHtml('PartsType').":</strong> ".$TypeString."<br>"."\n";
|
||||
//Storage
|
||||
$StorageId = $Part['StorageId'];
|
||||
$StorageString = "";
|
||||
while ($StorageId)
|
||||
{
|
||||
$LocalStorageString = "";
|
||||
$LocalStorageString = NestedListGetName($StorageId,'Storages');
|
||||
$LocalStorageString = '<a href="index.php?Page=PartsByStore&ToDo=ToggleTypeSelectorVisibility&SublistId='.$StorageId.'" target="_top">'.$LocalStorageString . "</a>";
|
||||
$StorageId = NestedListGetParentId ($StorageId,'Storages');
|
||||
if ($StorageId) $LocalStorageString = " > " . $LocalStorageString;
|
||||
$StorageString = $LocalStorageString . $StorageString;
|
||||
}
|
||||
$GlobalContent .= '<strong>'.LangSpellHtml('PartsStorage').":</strong> ".$StorageString."<br>"."\n";
|
||||
//Package
|
||||
$PackageId = $Part['PackageId'];
|
||||
$PackageString = "";
|
||||
while ($PackageId)
|
||||
{
|
||||
$LocalPackageString = "";
|
||||
$LocalPackageString = NestedListGetName($PackageId,'Packages');
|
||||
$PackageId = NestedListGetParentId ($PackageId,'Packages');
|
||||
if ($PackageId) $LocalPackageString = " > " . $LocalPackageString;
|
||||
$PackageString = $LocalPackageString . $PackageString;
|
||||
}
|
||||
$GlobalContent .= '<strong>'.LangSpellHtml('PartsPackage').":</strong> ".$PackageString."<br>"."\n";
|
||||
//Edit Button
|
||||
if (UserHasRight('EditParts'))
|
||||
{
|
||||
if (LockIsActive('Parts',$PartId))
|
||||
{
|
||||
$GlobalContent .= '<strong>'.LangSpellHtml('ButtonEdit').':</strong> ';
|
||||
$GlobalContent .= OtherGetIcon('LockActive')."\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
$GlobalContent .= '<strong>'.LangSpellHtml('ButtonEdit').':</strong> '."\n";
|
||||
$GlobalContent .= '<a href="index.php?Page=ShowPart&PartId='.$PartId.'&ToDo=EditType" target="_top" class="Button">'.LangSpellHtml('PartsType').'</a> '."\n";
|
||||
$GlobalContent .= '<a href="index.php?Page=ShowPart&PartId='.$PartId.'&ToDo=EditPackage" target="_top" class="Button">'.LangSpellHtml('PartsPackage').'</a> '."\n";
|
||||
$GlobalContent .= '<a href="index.php?Page=ShowPart&PartId='.$PartId.'&ToDo=EditStorage" target="_top" class="Button">'.LangSpellHtml('PartsStorage').'</a> '."\n";
|
||||
$GlobalContent .= '<a href="index.php?Page=ShowPart&PartId='.$PartId.'&ToDo=EditValues" target="_top" class="Button">'.LangSpellHtml('PartsValues').'</a> '."\n";
|
||||
$GlobalContent .= '<a href="index.php?Page=ShowPart&PartId='.$PartId.'&ToDo=EditDownloads" target="_top" class="Button">'.LangSpellHtml('PartsDownloads').'</a> '."\n";
|
||||
$GlobalContent .= '<a href="index.php?Page=ShowPart&PartId='.$PartId.'&ToDo=EditPicture" target="_top" class="Button">'.LangSpellHtml('PartsPicture').'</a> '."\n";
|
||||
$GlobalContent .= '<a href="index.php?Page=ShowPart&PartId='.$PartId.'&ToDo=DeletePart" target="_top" title="'.LangSpellHtml('TagTitleDelete').'">'.OtherGetIcon('Delete',"Button").'</a> '."\n";
|
||||
}
|
||||
}
|
||||
$GlobalContent .= '</div>'."\n";
|
||||
|
||||
///////////
|
||||
// Pictures
|
||||
$GlobalContent .= '<div id="ShowPartPictures" style="float:left;">'."\n";
|
||||
if ($ToDo=="EditPicture" && UserHasRight('EditParts') && LockActivate('Parts',$PartId))
|
||||
{
|
||||
$GlobalContent .= '<form action="index.php?Page=ShowPart&PartId='.$PartId.'&ToDo=UploadNewPicture" method="post" enctype="multipart/form-data">';
|
||||
$GlobalContent .= '<input type="hidden" name="MAX_FILE_SIZE" value="1000000">';
|
||||
$GlobalContent .= '<input type="file" name="NewPictureFile" value="">';
|
||||
$GlobalContent .= '<input type="submit" value="'.LangSpellHtml('ButtonUpload').'"class="Button">';
|
||||
$GlobalContent .= '</form><br>';
|
||||
}
|
||||
$GlobalContent .= '<img src="'.$GlobalPictureDir.'/'.$Part['PicturePath'].'"><br><br>';
|
||||
echo "IMAGE: " . $Part['PicturePath'] . "<br>\n";
|
||||
$GlobalContent .= '</div>'."\n";
|
||||
|
||||
////////////////
|
||||
// Detail Values
|
||||
$GlobalContent .= '<div id="ShowPartValues" style="float:left; margin-left:10px;">'."\n";
|
||||
$GlobalContent .= '<table>';
|
||||
//Obsolete
|
||||
if (strtolower($Part['Obsolete'])=="true")
|
||||
$GlobalContent .= ' <tr><td colspan="2"><strong>'.LangSpellHtml('PartsObsolete').'</strong></td></tr>';
|
||||
//Value1
|
||||
if ($TypeValues[0][0])
|
||||
$GlobalContent .= ' <tr><th>'.$TypeValues[0][0].'</th><td>'.OtherFloatToSiPrefix($Part['Value1']).$TypeValues[0][1].'</td></tr>';
|
||||
//Value2
|
||||
if ($TypeValues[1][0])
|
||||
$GlobalContent .= ' <tr><th>'.$TypeValues[1][0].'</th><td>'.OtherFloatToSiPrefix($Part['Value2']).$TypeValues[1][1].'</td></tr>';
|
||||
//Value3
|
||||
if ($TypeValues[2][0])
|
||||
$GlobalContent .= ' <tr><th>'.$TypeValues[2][0].'</th><td>'.OtherFloatToSiPrefix($Part['Value3']).$TypeValues[2][1].'</td></tr>';
|
||||
//Empty Row
|
||||
$GlobalContent .= ' <tr><td></td><td></td></tr>';
|
||||
|
||||
//Quantity
|
||||
if (UserHasRight('EditParts') || UserHasRight('EditPartQuantity'))
|
||||
{
|
||||
$GlobalContent .= ' <tr><th>'.LangSpellHtml('PartsQuantity').'</th><td>';
|
||||
$GlobalContent .= '<form action="index.php?Page=ShowPart&PartId='.$PartId.'&ToDo=SaveNewQuantity" method="post">';
|
||||
$GlobalContent .= '<input type="text" name="NewQuantity" value="'.$Part['Qty'].'"> ';
|
||||
$GlobalContent .= '<input type="submit" value="'.LangSpellHtml('ButtonEdit').'" class="Button"></td></tr>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$GlobalContent .= ' <tr><th>'.LangSpellHtml('PartsQuantity').'</th><td>'.$Part['Qty'].'</td></tr>';
|
||||
}
|
||||
//Minimum Quantity
|
||||
$GlobalContent .= ' <tr><th>'.LangSpellHtml('PartsMinQuantity').'</th><td>'.$Part['MinQty'].'</td></tr>';
|
||||
//Empty Row
|
||||
$GlobalContent .= ' <tr><td></td><td></td></tr>';
|
||||
|
||||
//Package Unit
|
||||
$GlobalContent .= ' <tr><th>'.LangSpellHtml('PartsPackageUnit').'</th><td>'.$Part['PackageUnit'].'</td></tr>';
|
||||
//Min Order Quantity
|
||||
$GlobalContent .= ' <tr><th>'.LangSpellHtml('PartsMinOrderQuantity').'</th><td>'.$Part['MinOrderQty'].'</td></tr>';
|
||||
//Price
|
||||
$GlobalContent .= ' <tr><th>'.LangSpellHtml('PartsPrice').'</th><td>'.OtherFormatPrice($Part['Price']).'</td></tr>';
|
||||
//Vendor
|
||||
$VendorQuery = "SELECT `Name` FROM `Vendors` WHERE `Id`= ".$Part['VendorId'];
|
||||
$VendorQuery = mysqli_query($GlobalMysqlHandler, $VendorQuery);
|
||||
if (mysqli_num_rows($VendorQuery))
|
||||
{
|
||||
$Vendor=mysqli_fetch_array($VendorQuery);
|
||||
$GlobalContent .= ' <tr><th>'.LangSpellHtml('PartsVendor').'</th><td>'.$Vendor['Name'].'</td></tr>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$GlobalContent .= ' <tr><th>'.LangSpellHtml('PartsVendor').'</th><td>-</td></tr>';
|
||||
}
|
||||
//Vendor Link
|
||||
$GlobalContent .= ' <tr><th>'.LangSpellHtml('PartsVendorLink').'</th><td>';
|
||||
if ($Part['VendorLink']) $GlobalContent .= '<a href="'.$Part['VendorLink'].'" target="_new">';
|
||||
$GlobalContent .= substr($Part['VendorLink'],0,(strlen($Part['VendorLink'])<=20)? strlen($Part['VendorLink']):20);
|
||||
if ($Part['VendorLink']) $GlobalContent .= '</a>';
|
||||
$GlobalContent .= '</td></tr>';
|
||||
//Manufactor
|
||||
$GlobalContent .= ' <tr><th>'.LangSpellHtml('PartsManufactorLink').'</th><td>';
|
||||
if ($Part['ManufactorLink']) $GlobalContent .= '<a href="'.$Part['ManufactorLink'].'" target="_new">';
|
||||
$GlobalContent .= substr($Part['ManufactorLink'],0,(strlen($Part['ManufactorLink'])<=20)? strlen($Part['ManufactorLink']):20);
|
||||
if ($Part['ManufactorLink']) $GlobalContent .= '</a>';
|
||||
$GlobalContent .= '</td></tr>';
|
||||
//End
|
||||
$GlobalContent .= '</table>';
|
||||
$GlobalContent .= '</div>'."\n";
|
||||
|
||||
/////////////////////////
|
||||
// Description, Downloads
|
||||
$GlobalContent .= '<div id="ShowPartDownloads" style="clear:both;">'."\n";
|
||||
$GlobalContent .= LangStr2Html($Part['ShortDesc']).'<br><br>';
|
||||
$GlobalContent .= LangStr2Html($Part['LongDesc']).'<br><br>';
|
||||
$GlobalContent .= '<strong>'.LangSpellHtml('PartsDownloads').':</strong>'."\n<ul>";
|
||||
$DownloadQuery = "SELECT * FROM `Downloads` WHERE `PartId` = $PartId";
|
||||
$DownloadQuery = mysqli_query($GlobalMysqlHandler, $DownloadQuery);
|
||||
while ($Download = mysqli_fetch_array($DownloadQuery))
|
||||
{
|
||||
$Size="-";
|
||||
$FileExist = (file_exists($GlobalDownloadDir."/".$Download['Path']))? 1:0;
|
||||
if ($FileExist) $Size=sprintf("%.2f",filesize($GlobalDownloadDir."/".$Download['Path'])/(1024*1024))." MB";
|
||||
|
||||
$GlobalContent .= "<li>";
|
||||
if ($FileExist) $GlobalContent .= '<a href="'.$GlobalDownloadDir."/".$Download['Path'].'">';
|
||||
$GlobalContent .= $Download['Name']." (".$Size.")";
|
||||
if ($FileExist) $GlobalContent .= '</a>';
|
||||
$GlobalContent .= "</li>";
|
||||
}
|
||||
$GlobalContent .= '</ul></div>'."\n";
|
||||
|
||||
?>
|
||||
121
pages/user_settings.php
Executable file
|
|
@ -0,0 +1,121 @@
|
|||
<?php
|
||||
|
||||
if (UserGetLogin() && UserGetLogin()!="root")
|
||||
{
|
||||
//////////////////
|
||||
//global content
|
||||
if ($ToDo=="SaveSettings")
|
||||
{
|
||||
//get vars
|
||||
$Login = (isset($_POST['Login'])) ? $_POST['Login']:"";
|
||||
$Password1 = (isset($_POST['Password1']))? $_POST['Password1']:"";
|
||||
$Password2 = (isset($_POST['Password2']))? $_POST['Password2']:"";
|
||||
$Language = (isset($_POST['Language'])) ? $_POST['Language']:"";
|
||||
($Template = (isset($_POST['Template'])) ? $_POST['Template']:"");
|
||||
|
||||
//check vars
|
||||
$Error=0;
|
||||
$UserExistQuery="SELECT * FROM `User` WHERE `Login` LIKE '$Login' AND `Id` != '$Id'";
|
||||
$UserExistQuery=mysqli_query($GlobalMysqlHandler, $UserExistQuery);
|
||||
if ($Login=="" || $Login=="root" || mysqli_num_rows($UserExistQuery))
|
||||
{
|
||||
$Error=1;
|
||||
MessageError(LangSpell('SentenceLoginForbidden'));
|
||||
}
|
||||
if ( ($Password1!=$Password2) || (trim($Password1)!=$Password1) )
|
||||
{
|
||||
$Error=1;
|
||||
MessageError(LangSpell('SentencePasswordForbidden'));
|
||||
}
|
||||
|
||||
if (!$Error)
|
||||
{
|
||||
$UpdateQuery="UPDATE `User` SET `Login` = '$Login'".(($Password1) ? ", `Password` = '".md5($Password1)."'":"").", `Template` = '$Template', `Language` = '$Language' WHERE `User`.`Id` =".UserGetId()." LIMIT 1 ;";
|
||||
if (!mysqli_query($GlobalMysqlHandler, $UpdateQuery))
|
||||
{
|
||||
ErrorLog("[user_settings.php] Database error while update User table at Id = $Id!");
|
||||
MessageError(LangSpell('SentenceDatabaseError'));
|
||||
$Error=1;
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageSuccess(LangSpell('SentenceUserUpdated'));
|
||||
if (trim($Password1)!="")
|
||||
{
|
||||
MessageWarning(LangSpell('SentencePasswordChangedWarning'));
|
||||
}
|
||||
}
|
||||
}
|
||||
UserLoadSettings();
|
||||
}
|
||||
|
||||
//////////////////
|
||||
//global content
|
||||
$UserQuery="SELECT * FROM `User` WHERE `Id` = ".UserGetId();
|
||||
$UserQuery=mysqli_query($GlobalMysqlHandler, $UserQuery);
|
||||
$UserRecord=mysqli_fetch_array($UserQuery);
|
||||
|
||||
$GlobalContent .= '<form action="index.php?Page=UserSettings&ToDo=SaveSettings" method="post">'."\n";
|
||||
$GlobalContent .= '<table>'."\n";
|
||||
|
||||
$GlobalContent .= ' <tr>'."\n";
|
||||
$GlobalContent .= ' <th colspan="2">'.LangSpellHtml('UserSettingsTableHead').'</th>'."\n";
|
||||
$GlobalContent .= ' </tr>'."\n";
|
||||
|
||||
$GlobalContent .= ' <tr>'."\n";
|
||||
$GlobalContent .= ' <th>Id</th>'."\n";
|
||||
$GlobalContent .= ' <td>'.$UserRecord['Id'].'</td>'."\n";
|
||||
$GlobalContent .= ' </tr>'."\n";
|
||||
|
||||
$GlobalContent .= ' <tr>'."\n";
|
||||
$GlobalContent .= ' <th>'.LangSpellHtml('MenuLogin').'</th>'."\n";
|
||||
$GlobalContent .= ' <td><input type="text" name="Login" value="'.$UserRecord['Login'].'" title="'.LangSpellHtml('TagTitleEditUserLogin').'"></td>'."\n";
|
||||
$GlobalContent .= ' </tr>'."\n";
|
||||
|
||||
$GlobalContent .= ' <tr>'."\n";
|
||||
$GlobalContent .= ' <th>'.LangSpellHtml('UserSettingsSetNewPassword').'</th>'."\n";
|
||||
$GlobalContent .= ' <td><input type="password" name="Password1" value="" title="'.LangSpellHtml('TagTitleEditUserPassword').'"></td>'."\n";
|
||||
$GlobalContent .= ' </tr>'."\n";
|
||||
|
||||
$GlobalContent .= ' <tr>'."\n";
|
||||
$GlobalContent .= ' <th>'.LangSpellHtml('UserSettingsConfirmNewPassword').'</th>'."\n";
|
||||
$GlobalContent .= ' <td><input type="password" name="Password2" value="" title="'.LangSpellHtml('TagTitleEditUserPassword').'"></td>'."\n";
|
||||
$GlobalContent .= ' </tr>'."\n";
|
||||
|
||||
$GlobalContent .= ' <tr>'."\n";
|
||||
$GlobalContent .= ' <th>'.LangSpellHtml('UserSettingsLanguage').'</th>'."\n";
|
||||
$GlobalContent .= ' <td><select name="Language" size="1">'."\n";
|
||||
$GlobalContent .= ' <option value="">'.LangSpellHtml('UserSettingsDefault').'</option>'."\n";
|
||||
$LanguageArray=LangGetAvailableLanguages();
|
||||
foreach ($LanguageArray as $Language)
|
||||
{
|
||||
$GlobalContent .= ' <option value="'.$Language.'" '.(($UserRecord['Language']==$Language)? "selected":"").'>'.$Language.'</option>'."\n";
|
||||
}
|
||||
$GlobalContent .= ' </select></td>'."\n";
|
||||
$GlobalContent .= ' </tr>'."\n";
|
||||
|
||||
$GlobalContent .= ' <tr>'."\n";
|
||||
$GlobalContent .= ' <th>'.LangSpellHtml('UserSettingsTemplate').'</th>'."\n";
|
||||
$GlobalContent .= ' <td><select name="Template" size="1">'."\n";
|
||||
$GlobalContent .= ' <option value="">'.LangSpellHtml('UserSettingsDefault').'</option>'."\n";
|
||||
$TemplateArray=OtherGetAvailableTemplates();
|
||||
foreach ($TemplateArray as $Template)
|
||||
{
|
||||
$GlobalContent .= ' <option value="'.$Template.'" '.(($UserRecord['Template']==$Template)? "selected":"").'>'.$Template.'</option>'."\n";
|
||||
}
|
||||
$GlobalContent .= ' </select></td>'."\n";
|
||||
$GlobalContent .= ' </tr>'."\n";
|
||||
|
||||
$GlobalContent .= ' <tr>'."\n";
|
||||
$GlobalContent .= ' <th> </th>'."\n";
|
||||
$GlobalContent .= ' <td><input type="submit" value="'.LangSpellHtml('ButtonSave').'" class="Button"></td>'."\n";
|
||||
$GlobalContent .= ' </tr>'."\n";
|
||||
|
||||
$GlobalContent .= '</table>'."\n";
|
||||
$GlobalContent .= '</form>'."\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageError(LangSpell("ScentenceNoUserRights"));
|
||||
}
|
||||
?>
|
||||
66
pages/version_history.php
Executable file
|
|
@ -0,0 +1,66 @@
|
|||
<?php
|
||||
$GlobalContent .='<ul>'."\n";
|
||||
$GlobalContent .=' <li>'."\n";
|
||||
$GlobalContent .=' Version 0'."\n";
|
||||
$GlobalContent .=' <ul>'."\n";
|
||||
$GlobalContent .=' <li>'."\n";
|
||||
$GlobalContent .=' Subversion 5'."\n";
|
||||
$GlobalContent .=' <ul>'."\n";
|
||||
$GlobalContent .=' <li>2010-11-11 Consistency check - repair incorrect parts type, Guide download (only german DeveloperGuide.pdf at this stage).</li>'."\n";
|
||||
$GlobalContent .=' <li>2010-11-10 Repeat order list, creating only one ErrorLog() out of LogShort() and LogLong().</li>'."\n";
|
||||
$GlobalContent .=' <li>2010-11-09 OtherGetIcon() for better icon control.</li>'."\n";
|
||||
$GlobalContent .=' <li>2010-11-05 Changed milestones, building helpsection as last milestone.</li>'."\n";
|
||||
$GlobalContent .=' <li>2010-11-05 Milestone 3 reached, gradation to subversion 5.</li>'."\n";
|
||||
$GlobalContent .=' </ul>'."\n";
|
||||
$GlobalContent .=' </li>'."\n";
|
||||
$GlobalContent .=' <li>'."\n";
|
||||
$GlobalContent .=' Subversion 4'."\n";
|
||||
$GlobalContent .=' <ul>'."\n";
|
||||
$GlobalContent .=' <li>2010-11-05 Consistency check - create database structure - ready for first testing.</li>'."\n";
|
||||
$GlobalContent .=' <li>2010-11-04 Handling downloads and parts picture, parts by store view.</li>'."\n";
|
||||
$GlobalContent .=' <li>2010-11-03 View and edit part (type, package, store and values).</li>'."\n";
|
||||
$GlobalContent .=' <li>2010-11-02 Adding new parts is possible, first partlist view (parts by type.</li>'."\n";
|
||||
$GlobalContent .=' <li>2010-10-04 Added ViewSTPV Rights.</li>'."\n";
|
||||
$GlobalContent .=' <li>2010-09-20 Milestone 2 reached, gradation to subversion 4.</li>'."\n";
|
||||
$GlobalContent .=' </ul>'."\n";
|
||||
$GlobalContent .=' </li>'."\n";
|
||||
$GlobalContent .=' <li>'."\n";
|
||||
$GlobalContent .=' Subversion 3'."\n";
|
||||
$GlobalContent .=' <ul>'."\n";
|
||||
$GlobalContent .=' <li>2010-09-20 Edit Stores, Types and packages.</li>'."\n";
|
||||
$GlobalContent .=' <li>2010-09-08 Add new stores, delete stores.</li>'."\n";
|
||||
$GlobalContent .=' <li>2010-08-31 Vendor editing.</li>'."\n";
|
||||
$GlobalContent .=' <li>2010-08-26 Milestone 1 reached, gradation to subversion 3.</li>'."\n";
|
||||
$GlobalContent .=' </ul>'."\n";
|
||||
$GlobalContent .=' </li>'."\n";
|
||||
$GlobalContent .=' <li>'."\n";
|
||||
$GlobalContent .=' Subversion 2'."\n";
|
||||
$GlobalContent .=' <ul>'."\n";
|
||||
$GlobalContent .=' <li>2010-08-26 Config editing.</li>'."\n";
|
||||
$GlobalContent .=' <li>2010-08-17 User settings.</li>'."\n";
|
||||
$GlobalContent .=' <li>2010-08-16 User management.</li>'."\n";
|
||||
$GlobalContent .=' <li>2010-08-15 Definition of milestones.'."\n";
|
||||
$GlobalContent .=' <ol>'."\n";
|
||||
$GlobalContent .=' <li>Basic system administration (config editing, user management, user settings).</li>'."\n";
|
||||
$GlobalContent .=' <li>Part administration (stores, types, vendors, packages).</li>'."\n";
|
||||
$GlobalContent .=' <li>Parts handling (view, edit, add, downloads, pictures).</li>'."\n";
|
||||
$GlobalContent .=' <li>Tools (repeat order, stats, check).</li>'."\n";
|
||||
$GlobalContent .=' <li>Global test by creating own partstock.</li>'."\n";
|
||||
$GlobalContent .=' <li>Build final Templates. Guide for publishing.</li>'."\n";
|
||||
$GlobalContent .=' <li>Help section / User Guides.</li>'."\n";
|
||||
$GlobalContent .=' </ol>'."\n";
|
||||
$GlobalContent .=' </li>'."\n";
|
||||
$GlobalContent .=' <li>2010-08-14 Creation of the Version History</li>'."\n";
|
||||
$GlobalContent .=' <li>before: Basic system like template design, login functionality, language functionality, message logging, etc.</li>'."\n";
|
||||
$GlobalContent .=' </ul>'."\n";
|
||||
$GlobalContent .=' </li>'."\n";
|
||||
$GlobalContent .=' <li>'."\n";
|
||||
$GlobalContent .=' Subversion 1'."\n";
|
||||
$GlobalContent .=' <ul>'."\n";
|
||||
$GlobalContent .=' <li>A simple GUI for to the database (some primary testings).</li>'."\n";
|
||||
$GlobalContent .=' </ul>'."\n";
|
||||
$GlobalContent .=' </li>'."\n";
|
||||
$GlobalContent .=' </ul>'."\n";
|
||||
$GlobalContent .=' </li>'."\n";
|
||||
$GlobalContent .='</ul>'."\n";
|
||||
?>
|
||||
BIN
templates/GreenPartstock0/Error.png
Executable file
|
After Width: | Height: | Size: 713 B |
BIN
templates/GreenPartstock0/Ok.png
Executable file
|
After Width: | Height: | Size: 643 B |
BIN
templates/GreenPartstock0/Warning.png
Executable file
|
After Width: | Height: | Size: 607 B |
3
templates/GreenPartstock0/icons/.directory
Executable file
|
|
@ -0,0 +1,3 @@
|
|||
[Dolphin]
|
||||
ShowPreview=true
|
||||
Timestamp=2010,8,30,23,22,50
|
||||
17
templates/GreenPartstock0/icons/1license.txt
Executable file
|
|
@ -0,0 +1,17 @@
|
|||
The icons are free for personal use and also free for commercial use, but we require linking to our web site.
|
||||
|
||||
http://creativecommons.org/licenses/by-sa/3.0/
|
||||
|
||||
You are free:
|
||||
* to Share — to copy, distribute and transmit the work
|
||||
|
||||
Under the following conditions:
|
||||
Attribution — You must attribute the work in the manner specified by the author or licensor (but not in any way that suggests that they endorse you or your use of the work).
|
||||
|
||||
Attribute this work:
|
||||
What does "Attribute this work" mean?
|
||||
The page you came from contained embedded licensing metadata, including how the creator wishes to be attributed for re-use. You can use the HTML here to cite the work. Doing so will also include metadata on your page so that others can find the original work as well.
|
||||
Share Alike — If you alter, transform, or build upon this work, you may distribute the resulting work only under the same, similar or a compatible license.
|
||||
|
||||
led24.de
|
||||
31/05/2009
|
||||
BIN
templates/GreenPartstock0/icons/About.png
Executable file
|
After Width: | Height: | Size: 686 B |
BIN
templates/GreenPartstock0/icons/AdminGuide.png
Executable file
|
After Width: | Height: | Size: 742 B |
BIN
templates/GreenPartstock0/icons/Administration.png
Executable file
|
After Width: | Height: | Size: 742 B |
BIN
templates/GreenPartstock0/icons/Cancel.png
Executable file
|
After Width: | Height: | Size: 957 B |
BIN
templates/GreenPartstock0/icons/Config.png
Executable file
|
After Width: | Height: | Size: 628 B |
BIN
templates/GreenPartstock0/icons/ConsistencyCheck.png
Executable file
|
After Width: | Height: | Size: 711 B |
BIN
templates/GreenPartstock0/icons/Delete.png
Executable file
|
After Width: | Height: | Size: 764 B |
BIN
templates/GreenPartstock0/icons/DeveloperGuide.png
Executable file
|
After Width: | Height: | Size: 727 B |
BIN
templates/GreenPartstock0/icons/Edit.png
Executable file
|
After Width: | Height: | Size: 598 B |
BIN
templates/GreenPartstock0/icons/Help.png
Executable file
|
After Width: | Height: | Size: 744 B |
BIN
templates/GreenPartstock0/icons/Home.png
Executable file
|
After Width: | Height: | Size: 738 B |
BIN
templates/GreenPartstock0/icons/LockActive.png
Executable file
|
After Width: | Height: | Size: 620 B |
BIN
templates/GreenPartstock0/icons/Login.png
Executable file
|
After Width: | Height: | Size: 705 B |
BIN
templates/GreenPartstock0/icons/Logout.png
Executable file
|
After Width: | Height: | Size: 621 B |
BIN
templates/GreenPartstock0/icons/New.png
Executable file
|
After Width: | Height: | Size: 603 B |
BIN
templates/GreenPartstock0/icons/Packages.png
Executable file
|
After Width: | Height: | Size: 559 B |
BIN
templates/GreenPartstock0/icons/PartStatistic.png
Executable file
|
After Width: | Height: | Size: 658 B |
BIN
templates/GreenPartstock0/icons/Parts.png
Executable file
|
After Width: | Height: | Size: 665 B |
BIN
templates/GreenPartstock0/icons/RepeatOrder.png
Executable file
|
After Width: | Height: | Size: 696 B |
BIN
templates/GreenPartstock0/icons/SortDown.png
Executable file
|
After Width: | Height: | Size: 519 B |
BIN
templates/GreenPartstock0/icons/SortUp.png
Executable file
|
After Width: | Height: | Size: 493 B |
BIN
templates/GreenPartstock0/icons/Stores.png
Executable file
|
After Width: | Height: | Size: 529 B |
BIN
templates/GreenPartstock0/icons/Tools.png
Executable file
|
After Width: | Height: | Size: 879 B |
BIN
templates/GreenPartstock0/icons/Types.png
Executable file
|
After Width: | Height: | Size: 511 B |
BIN
templates/GreenPartstock0/icons/UserAdmin.png
Executable file
|
After Width: | Height: | Size: 610 B |
BIN
templates/GreenPartstock0/icons/UserGuide.png
Executable file
|
After Width: | Height: | Size: 705 B |
BIN
templates/GreenPartstock0/icons/UserSettings.png
Executable file
|
After Width: | Height: | Size: 458 B |
BIN
templates/GreenPartstock0/icons/Vendors.png
Executable file
|
After Width: | Height: | Size: 584 B |
BIN
templates/GreenPartstock0/icons/VersionHistory.png
Executable file
|
After Width: | Height: | Size: 637 B |
67
templates/GreenPartstock0/menu.css
Executable file
|
|
@ -0,0 +1,67 @@
|
|||
/***********
|
||||
MainMenu
|
||||
************/
|
||||
div#MainMenu {
|
||||
margin-bottom:0px;
|
||||
padding:1px;
|
||||
white-space:nowrap;
|
||||
display:inline-block;
|
||||
}
|
||||
|
||||
#MainMenu ul {
|
||||
margin:0px;
|
||||
margin-left:4px;
|
||||
padding:0px;
|
||||
list-style-type:none;
|
||||
list-style-position:inside;
|
||||
}
|
||||
|
||||
#MainMenu li {
|
||||
padding-top:0px;
|
||||
display:inline-block;
|
||||
margin:0px;
|
||||
}
|
||||
|
||||
#MainMenu ul li ul {
|
||||
margin:0px;
|
||||
margin-top:1px;
|
||||
position:absolute;
|
||||
visibility:hidden;
|
||||
padding-top:2px;
|
||||
}
|
||||
|
||||
#MainMenu li ul li {
|
||||
display:block;
|
||||
}
|
||||
|
||||
#MainMenu ul li:hover ul {
|
||||
visibility:visible;
|
||||
}
|
||||
|
||||
#MainMenu a {
|
||||
border:1px solid #198533;
|
||||
padding:1px 3px 1px 3px;
|
||||
background-color:#cded9d;
|
||||
font-weight:bold;
|
||||
color:#198533;
|
||||
text-decoration:none;
|
||||
}
|
||||
|
||||
#MainMenu a:hover {
|
||||
background-color:#629e1f;
|
||||
color:#cded9d;
|
||||
}
|
||||
|
||||
#MainMenu ul li ul li a {
|
||||
border-bottom:1px solid #198533;
|
||||
display:block;
|
||||
width:100%;
|
||||
}
|
||||
|
||||
#MainMenu img {
|
||||
border:0px;
|
||||
vertical-align:middle;
|
||||
margin-right:4px;
|
||||
margin-left:2px;
|
||||
/*display:none;*/
|
||||
}
|
||||
49
templates/GreenPartstock0/message.css
Executable file
|
|
@ -0,0 +1,49 @@
|
|||
/*****************
|
||||
Message
|
||||
*****************/
|
||||
#Message {
|
||||
padding:4px;
|
||||
border-bottom:2px solid #198533;
|
||||
}
|
||||
|
||||
#Message #Error{
|
||||
margin:0px;
|
||||
background-image:url(./Error.png);
|
||||
background-repeat:no-repeat;
|
||||
background-position:7px 2px;
|
||||
padding-left:30px;
|
||||
border-width:2px;
|
||||
border-style:solid;
|
||||
border-color:#bb2222;
|
||||
color:#bb2222;
|
||||
background-color:#ffaaaa;
|
||||
font-weight:bold;
|
||||
}
|
||||
|
||||
#Message #Warning {
|
||||
margin:0px;
|
||||
background-image:url(./Warning.png);
|
||||
background-repeat:no-repeat;
|
||||
background-position:7px 2px;
|
||||
padding-left:30px;
|
||||
border-width:2px;
|
||||
border-style:solid;
|
||||
border-color:#ffbb00;
|
||||
color:#ffbb00;
|
||||
background-color:#ffffaa;
|
||||
font-weight:bold;
|
||||
}
|
||||
|
||||
#Message #Success {
|
||||
margin:0px;
|
||||
background-image:url(./Ok.png);
|
||||
background-repeat:no-repeat;
|
||||
background-position:7px 2px;
|
||||
padding-left:30px;
|
||||
border-width:2px;
|
||||
border-style:solid;
|
||||
border-color:#00bb00;
|
||||
color:#00bb00;
|
||||
background-color:#aaffaa;
|
||||
font-weight:bold;
|
||||
}
|
||||
56
templates/GreenPartstock0/partview.css
Executable file
|
|
@ -0,0 +1,56 @@
|
|||
div#PartSelector {
|
||||
float:left;
|
||||
padding:0px;
|
||||
font-size:0.8em;
|
||||
border:1px solid #198533;
|
||||
background-color:#cded9d;
|
||||
margin:0px;
|
||||
margin-right:10px;
|
||||
font-weight:bold;
|
||||
}
|
||||
|
||||
div#PartSelector a {
|
||||
font-weight:normal;
|
||||
}
|
||||
|
||||
div#PartSelector ul {
|
||||
list-style-type:none;
|
||||
padding:2px;
|
||||
margin:0px;
|
||||
}
|
||||
|
||||
div#PartSelector ul ul{
|
||||
margin-left:10px;
|
||||
}
|
||||
|
||||
div#PartFilter {
|
||||
font-size:0.8em;
|
||||
}
|
||||
|
||||
div#PartList {
|
||||
float:none;
|
||||
}
|
||||
|
||||
div#PartList img {
|
||||
border:0px;
|
||||
}
|
||||
|
||||
div#PartList th a {
|
||||
color:#cded9d;
|
||||
}
|
||||
|
||||
div#PartList th a:hover {
|
||||
color:#141;
|
||||
text-decoration:none;
|
||||
}
|
||||
|
||||
|
||||
div#ShowPartHead {
|
||||
margin-bottom:10px;
|
||||
font-size:0.8em;
|
||||
}
|
||||
|
||||
div#ShowPartDownloads {
|
||||
margin-left:20px;
|
||||
margin-right:20px;
|
||||
}
|
||||
137
templates/GreenPartstock0/style.css
Executable file
|
|
@ -0,0 +1,137 @@
|
|||
/*****************
|
||||
Global Design
|
||||
*****************/
|
||||
body {
|
||||
background-color:#bddd8d;
|
||||
color:#198533;
|
||||
font-size:1.0em;
|
||||
color: #198533;
|
||||
}
|
||||
|
||||
table {
|
||||
background-color:#cded9d;
|
||||
text-align:center;
|
||||
}
|
||||
|
||||
th {
|
||||
background-color:#a26e1a;
|
||||
color:#cded9d;
|
||||
margin:1px;
|
||||
padding-left:2px;
|
||||
padding-right:2px;
|
||||
}
|
||||
|
||||
td {
|
||||
padding:2px;
|
||||
border-bottom:1px dashed #629e1f;
|
||||
}
|
||||
|
||||
form {
|
||||
display:inline;
|
||||
}
|
||||
|
||||
input {
|
||||
background-color:#cded9d;
|
||||
border:1px solid #198533;
|
||||
color: #198533;
|
||||
text-align:center;
|
||||
}
|
||||
|
||||
textarea {
|
||||
background-color:#cded9d;
|
||||
border:1px solid #198533;
|
||||
color: #198533;
|
||||
}
|
||||
|
||||
img {
|
||||
vertical-align:middle;
|
||||
}
|
||||
|
||||
li {
|
||||
padding-top: 2px;
|
||||
}
|
||||
|
||||
a{
|
||||
color: #198533;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
a:hover{
|
||||
color: #198533;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size:1.4em;
|
||||
}
|
||||
|
||||
/*submit buttons are in Button-class */
|
||||
.Button {
|
||||
background-color:#cded9d;
|
||||
color:#198533;
|
||||
text-decoration:none;
|
||||
border:1px solid #198533;
|
||||
padding-left:2px;
|
||||
padding-right:2px;
|
||||
}
|
||||
|
||||
.Button:hover {
|
||||
background-color:#629e1f;
|
||||
color:#cded9d;
|
||||
text-decoration:none;
|
||||
}
|
||||
|
||||
div#HeadContainer {
|
||||
border-bottom:2px solid #2f8f00;
|
||||
white-space:nowrap;
|
||||
display:block;
|
||||
margin:0px;
|
||||
padding:0px;
|
||||
}
|
||||
|
||||
|
||||
/*****************
|
||||
Login
|
||||
*****************/
|
||||
div#Login {
|
||||
margin:0px;
|
||||
margin-left:20px;
|
||||
padding:0px;
|
||||
white-space:nowrap;
|
||||
display:inline-block;
|
||||
height:20px;
|
||||
}
|
||||
|
||||
#Login input {
|
||||
max-width:70px;
|
||||
}
|
||||
|
||||
#Login img {
|
||||
border:0px;
|
||||
vertical-align:middle;
|
||||
margin-right:4px;
|
||||
margin-left:2px;
|
||||
}
|
||||
|
||||
#Login a {
|
||||
border:1px solid #198533;
|
||||
padding:1px 3px 1px 3px;
|
||||
background-color:#cded9d;
|
||||
font-weight:bold;
|
||||
color:#198533;
|
||||
text-decoration:none;
|
||||
}
|
||||
|
||||
#Login a:hover {
|
||||
background-color:#629e1f;
|
||||
color:#cded9d;
|
||||
}
|
||||
|
||||
/*****************
|
||||
Body
|
||||
*****************/
|
||||
div#Body {
|
||||
padding:4px;
|
||||
}
|
||||
|
||||
|
||||
21
templates/GreenPartstock0/template.php
Executable file
|
|
@ -0,0 +1,21 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<title>ldPtartstock</title>
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
||||
<link rel="stylesheet" type="text/css" href="./templates/GreenPartstock0/style.css">
|
||||
<link rel="stylesheet" type="text/css" href="./templates/GreenPartstock0/menu.css">
|
||||
<link rel="stylesheet" type="text/css" href="./templates/GreenPartstock0/message.css">
|
||||
<link rel="stylesheet" type="text/css" href="./templates/GreenPartstock0/partview.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="HeadContainer">
|
||||
<?php echo $TemplateMainMenu ?>
|
||||
<?php echo $TemplateLogin ?>
|
||||
</div>
|
||||
<?php echo $TemplateMessage ?>
|
||||
<?php echo $TemplateBody ?>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
4
todo.txt
Executable file
|
|
@ -0,0 +1,4 @@
|
|||
-LED Icons credits ins template einbauen http://led24.de/iconset/
|
||||
-Delete Storages, überlegen ob das immer geht
|
||||
-EditStorages - MoveDown über dropdown selector ???
|
||||
|
||||