302 lines
7.7 KiB
PHP
Executable File
302 lines
7.7 KiB
PHP
Executable File
<?php
|
|
@session_start();
|
|
|
|
|
|
|
|
|
|
if ( isset( $_GET[ "mandant_name" ] ) )
|
|
{
|
|
$mandant_name = $_GET[ "mandant_name" ];
|
|
}
|
|
if ( isset( $_GET[ "workflow_name" ] ) )
|
|
{
|
|
$workflow_name = $_GET[ "workflow_name" ];
|
|
}
|
|
if ( isset( $_GET[ "maske_name" ] ) )
|
|
{
|
|
$maske_name = $_GET[ "maske_name" ];
|
|
}
|
|
if ( isset( $_GET[ "maske_pos" ] ) )
|
|
{
|
|
$maske_pos = $_GET[ "maske_pos" ];
|
|
}
|
|
if ( isset( $_GET[ "cmd" ] ) )
|
|
{
|
|
$cmd = $_GET[ "cmd" ];
|
|
}
|
|
if ( isset( $_GET[ "aufgerufen" ] ) )
|
|
{
|
|
$aufgerufen = $_GET[ "aufgerufen" ];
|
|
}
|
|
|
|
if ( isset( $_POST[ "mandant_name" ] ) )
|
|
{
|
|
$mandant_name = $_POST[ "mandant_name" ];
|
|
}
|
|
if ( isset( $_POST[ "workflow_name" ] ) )
|
|
{
|
|
$workflow_name = $_POST[ "workflow_name" ];
|
|
}
|
|
if ( isset( $_POST[ "maske_name" ] ) )
|
|
{
|
|
$maske_name = $_POST[ "maske_name" ];
|
|
}
|
|
if ( isset( $_POST[ "maske_pos" ] ) )
|
|
{
|
|
$maske_pos = $_POST[ "maske_pos" ];
|
|
}
|
|
if ( isset( $_POST[ "cmd" ] ) )
|
|
{
|
|
$cmd = $_POST[ "cmd" ];
|
|
}
|
|
if ( isset( $_POST[ "aufgerufen" ] ) )
|
|
{
|
|
$aufgerufen = $_POST[ "aufgerufen" ];
|
|
}
|
|
|
|
|
|
// Die Workflow-Plugins sollen Maskenteile der fertigen Maske bereitstellen.
|
|
|
|
/*
|
|
|
|
Der Rahmen eines Plugins sieht so aus, dass sie auf das cmd=konfig mit einer Ausgabe ihrer Konfigurationsmaske reagieren müssen. Wird das Plugin also folgendermaßen aufgerufen:
|
|
|
|
$( "#ergebnis" ).load( "wfl_plugin_name.php?mandant_name=XXX&workflow_name=YYY&maske_name=ZZZ&maske_pos=02&cmd=konfig" );
|
|
|
|
muss das Plugin mit einer Konfigurationsmaske (die ein Formular enthält) antworten, also beispielsweise:
|
|
|
|
<h2>Konfiguration des Plugins wfl_plugin_name</h2>
|
|
<form name='wfl_plugin_name_konfig' action='wfl_plugin_name.php' ... >
|
|
<input type='hidden' name='mandant_name' value='XXX' />
|
|
<input type='hidden' name='workflow_name' value='YYY' />
|
|
<input type='hidden' name='maske_name' value='ZZZ' />
|
|
<input type='hidden' name='maske_pos' value='02' />
|
|
<input type='hidden' name='cmd' value='save_konfig' />
|
|
<input type='hidden' name='aufgerufen' value='aufgerufen' />
|
|
<table>
|
|
<tr><td>Konfiguration 1</td><td><input type='text' name='alpha_01' /></td></tr>
|
|
|
|
...
|
|
|
|
<input type='submit' value='OK' />
|
|
</form>
|
|
|
|
Logischerweise muss es auch die Antwort, d.h. das Abschicken des Formulars angemessen bearbeiten können. Das bedeutet, dass es die Eingaben in der Tabelle ca_wfl_maske_einstellungen zur späteren Verwendung speichern soll und danach die Seite "Masken-Detailkonfiguration" aufrufen soll.
|
|
|
|
|
|
|
|
|
|
/////////////////////////
|
|
|
|
|
|
|
|
Die eigentliche Arbeit soll dann von einer Arbeitsfunktion erledigt werden. Diese muss zwingend so heißen wie das Plugin (ohne die Endung .php).
|
|
|
|
Ein Plugin wfl_plugin_name.php muss also eine Funktion
|
|
|
|
wfl_plugin_name( $mandant_name, $maske, $maske_pos, $dokument )
|
|
{
|
|
...
|
|
}
|
|
|
|
bereitstellen, welche als Rückgabewert dann die Ausgabe des Plugins (also fertiges HTML) generiert. Diese Funktion bekommt in den Parametern $maske und $dokument das Ergebnis der Funktionen liefere_maskeninformationen und liefere_dokumentinformationen bereitgestellt und muss diese zusammen mit seiner Konfiguration aus der Tabelle ca_wfl_maske_einstellungen zu einem HTML-Output zusammenführen.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
switch( $cmd )
|
|
{
|
|
case "konfig":
|
|
include_once( "../f_admin.php" );
|
|
include_once( "../f_wfl.php" );
|
|
include_once( "../w_fkt.php" );
|
|
include_once( "../su_web.php" );
|
|
$html_output = wfl_plugin_debug_konfig( $mandant_name, $workflow_name, $maske_name, $maske_pos, $aufgerufen, $_POST );
|
|
echo $html_output;
|
|
break;
|
|
default:
|
|
include_once( "f_admin.php" );
|
|
include_once( "f_wfl.php" );
|
|
include_once( "w_fkt.php" );
|
|
include_once( "su_web.php" );
|
|
|
|
break;
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//////////////////////
|
|
// Konfigurationsfunktion
|
|
//////////////////////
|
|
|
|
|
|
function wfl_plugin_debug_konfig( $mandant_name, $workflow_name, $maske_name, $maske_pos, $aufgerufen, $POST )
|
|
{
|
|
$workflow = liefere_workflowinformationen( $mandant_name, $workflow_name );
|
|
$maske = liefere_maskeninformationen( $mandant_name, $workflow_name, $maske_name );
|
|
|
|
if ( $aufgerufen == "aufgerufen" )
|
|
{
|
|
// Verarbeitung der Konfigurationsmaske
|
|
//////////////////////////////////////////////////////////////
|
|
|
|
//xlog( 4, "POST ".json_encode( $POST ) );
|
|
|
|
|
|
|
|
|
|
|
|
$alpha_01 = $POST[ "alpha_01" ];
|
|
|
|
|
|
$STATEMENT = "delete from ca_wfl_maske_einstellungen where workflow_id = ".$workflow[ 0 ]." and maske_id = ".$maske[ 0 ]." and plugin = 'wfl_plugin_debug.php' and pos = '".$maske_pos."'";
|
|
|
|
xdb( $STATEMENT );
|
|
|
|
$STATEMENT = "insert into ca_wfl_maske_einstellungen ( workflow_id, maske_id, plugin, pos, e_01 ) values ( ".$workflow[ 0 ].", ".$maske[ 0 ].", 'wfl_plugin_debug.php', '".$maske_pos."', '".$alpha_01."' )";
|
|
|
|
xdb( $STATEMENT );
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////
|
|
// gespeichert? Dann ist alles gut - es geht zurück zur rufenden Maske.
|
|
|
|
$_SESSION[ "wfl" ] = "detail_0";
|
|
$_SESSION[ "wfl_meld" ] = "Konfiguration gespeichert.";
|
|
|
|
header( "Location: /ca/w_wfl.php" );
|
|
exit;
|
|
}
|
|
else
|
|
{
|
|
$STATEMENT = "select workflow_id, maske_id, pos, plugin, e_01, e_02, e_03, e_04, e_05, e_06, e_07, e_08, e_09, e_10, e_11, e_12, e_13, e_14, e_15 from ca_wfl_maske_einstellungen where workflow_id = ".$workflow[ 0 ]." and maske_id = ".$maske[ 0 ]." and plugin = 'wfl_plugin_debug.php' and pos = '".$maske_pos."'";
|
|
|
|
$ergebnis = xdb( $STATEMENT );
|
|
|
|
$alpha_01 = $ergebnis[ 1 ][ 0 ][ "e_1" ];
|
|
|
|
if ( strlen( $alpha_01 ) == 0 )
|
|
{
|
|
$nein = " selected ";
|
|
$ja = "";
|
|
}
|
|
elseif ( $alpha_01 == "ja" )
|
|
{
|
|
$nein = "";
|
|
$ja = " selected ";
|
|
}
|
|
else
|
|
{
|
|
$nein = " selected ";
|
|
$ja = "";
|
|
}
|
|
|
|
$html_output = "<h4>Konfiguration des Plugins wfl_plugin_debug</h4>";
|
|
|
|
$html_output = $html_output.
|
|
"<form name='wfl_plugin_name_konfig' action='wfl_plugins/wfl_plugin_debug.php' method='post' >
|
|
<input type='hidden' name='mandant_name' value='".$mandant_name."' />
|
|
<input type='hidden' name='workflow_name' value='".$workflow_name."' />
|
|
<input type='hidden' name='maske_name' value='".$maske_name."' />
|
|
<input type='hidden' name='maske_pos' value='".$maske_pos."' />
|
|
<input type='hidden' name='cmd' value='konfig' />
|
|
<input type='hidden' name='aufgerufen' value='aufgerufen' />
|
|
<table>
|
|
<tr>
|
|
<td>Soll eine Test-Ausgabe erfolgen?</td>
|
|
<td><select name='alpha_01' style='width:200px;' >
|
|
<option ".$ja.">ja</option>
|
|
<option ".$nein." >nein</option>
|
|
</select></td>
|
|
</tr>
|
|
|
|
|
|
</table>
|
|
<input type='submit' value='OK' />
|
|
</form>";
|
|
|
|
}
|
|
|
|
|
|
|
|
return $html_output;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//////////////////////
|
|
// Workflow-Arbeitsfunktion
|
|
//////////////////////
|
|
|
|
|
|
function wfl_plugin_debug( $mandant_name, $workflow, $maske, $maske_pos, $dokument )
|
|
{
|
|
$STATEMENT = "select workflow_id, maske_id, pos, plugin, e_01, e_02, e_03, e_04, e_05, e_06, e_07, e_08, e_09, e_10, e_11, e_12, e_13, e_14, e_15 from ca_wfl_maske_einstellungen where workflow_id = ".$workflow[ 0 ]." and maske_id = ".$maske[ 0 ]." and plugin = 'wfl_plugin_debug.php' and pos = '".$maske_pos."'";
|
|
|
|
$ergebnis = xdb( $STATEMENT );
|
|
|
|
//xlog( 4, $STATEMENT );
|
|
|
|
$ausgabe = $ergebnis[ 1 ][ 0 ][ "e_01" ];
|
|
|
|
if ( $ausgabe == "ja" )
|
|
{
|
|
$html_output = "ausgabe = ".$ausgabe." Plugin wfl_plugin_debug - Ruf aus mandant_name=".$mandant_name." workflow_name=".$workflow[ 2 ][ "workflow_name" ]." maske_name=".$maske[ 2 ][ "maske_name" ]." maske_pos=".$maske_pos;
|
|
}
|
|
else
|
|
{
|
|
$html_output = "ausgabe = ".$ausgabe;
|
|
}
|
|
|
|
|
|
return $html_output;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
?>
|