Merge branch 'master' of git+ssh://gitosis@nomeata.de/L-seed
authorSven Hecht <sven@sven-laptop.(none)>
Fri, 26 Jun 2009 16:55:24 +0000 (18:55 +0200)
committerSven Hecht <sven@sven-laptop.(none)>
Fri, 26 Jun 2009 16:55:24 +0000 (18:55 +0200)
Conflicts:
web/setup/script00.sql

21 files changed:
src/Lseed/DB.hs
src/validate.hs
web/cgi/.gitignore [new file with mode: 0644]
web/cgi/validate [deleted file]
web/cgi/validate.exe [deleted file]
web/js/communication.js
web/php/Communication.php
web/php/Controller.php
web/php/Database.php
web/php/Plant.php
web/php/PlantImages.php [new file with mode: 0644]
web/php/Response.php
web/php/SeasonScore.php
web/php/Server.php
web/php/page/createplant.pg
web/php/page/editplant.pg [changed mode: 0755->0644]
web/php/page/myplants.pg
web/php/page/nav.pg
web/php/page/previewplant.pg [new file with mode: 0644]
web/php/page/testplant.pg [deleted file]
web/setup/script00.sql

index c5c8df7..f7b2d0a 100644 (file)
@@ -33,7 +33,7 @@ withLseedDB conf what = do
 
 getCodeToRun :: FilePath -> IO [DBCode]
 getCodeToRun conf = withLseedDB conf $ \conn -> do
-       let getCodeQuery = "SELECT plant.ID AS plantid, user.ID AS userid, code, plant.Name AS plantname, user.Name AS username from plant, user WHERE user.NextSeed = plant.ID;"
+       let getCodeQuery = "SELECT plant.ID AS plantid, user.ID AS userid, code, plant.Name AS plantname, user.Name AS username from plant, user WHERE plant.Valid AND user.NextSeed = plant.ID;"
        stmt <- prepare conn getCodeQuery
        execute stmt []
        result <- fetchAllRowsMap' stmt
@@ -46,7 +46,7 @@ getCodeToRun conf = withLseedDB conf $ \conn -> do
 
 getUpdatedCodeFromDB :: FilePath -> Integer -> IO (Maybe DBCode)
 getUpdatedCodeFromDB conf userid = withLseedDB conf $ \conn -> do
-       let query = "SELECT plant.ID AS plantid, user.ID AS userid, code, plant.Name AS plantname, user.Name AS username from plant, user WHERE user.NextSeed = plant.ID AND user.ID = ?;"
+       let query = "SELECT plant.ID AS plantid, user.ID AS userid, code, plant.Name AS plantname, user.Name AS username from plant, user WHERE plant.Valid AND user.NextSeed = plant.ID AND user.ID = ?;"
        stmt <- prepare conn query
        execute stmt [toSql userid]
        result <- fetchAllRowsMap' stmt
index bd595f4..8fa08d7 100644 (file)
@@ -11,6 +11,7 @@ import Text.Parsec.Error
 import Text.Parsec.Pos
 import Lseed.Grammar.Parse
 import Text.JSON
+import System.Exit
 
 valid = encode $ makeObj [ ("valid", showJSON True) ]
 
@@ -24,4 +25,12 @@ invalid error = encode $ makeObj
                     errorMessages $ error)
        ]
 
-main = interact $ either invalid (const valid) . parseGrammar "stdin"
+main = do
+       file <- getContents
+       case (parseGrammar "stdin" file) of
+               Left err -> do
+                       putStr (invalid err)
+                       exitWith (ExitFailure 1)
+               Right _ -> do
+                       putStr valid
+                       exitWith ExitSuccess
diff --git a/web/cgi/.gitignore b/web/cgi/.gitignore
new file mode 100644 (file)
index 0000000..291530f
--- /dev/null
@@ -0,0 +1,2 @@
+renderAsPNG
+validate
diff --git a/web/cgi/validate b/web/cgi/validate
deleted file mode 100755 (executable)
index a96d454..0000000
Binary files a/web/cgi/validate and /dev/null differ
diff --git a/web/cgi/validate.exe b/web/cgi/validate.exe
deleted file mode 100644 (file)
index 876f2c4..0000000
Binary files a/web/cgi/validate.exe and /dev/null differ
index 79451ff..2573367 100644 (file)
@@ -67,7 +67,7 @@ Lseed.Communication = function() {
                                case 'Content':
                                        this.stopWaitingForPage();
                                        
-                                       this.showContent(obj.content, obj.contentname);
+                                       this.showContent(obj);
                                        break;
                        }
                } catch (e) {
@@ -97,15 +97,20 @@ Lseed.Communication = function() {
 
        // ----- Application -----
        
-       this.showContent = function (content, contentname) {
-               switch(contentname) {
+       this.showContent = function (contentmsg) {
+               switch(contentmsg.contentname) {
                        case "nav":
                        case "adminnav":
-                               this.loadNavigation(content);
+                               this.loadNavigation(contentmsg.content);
                                break;
                        default:
-                               this.loadTab(content, contentname);
-                               if (contentname == "editplant") {
+                               content = contentmsg.content;
+                               if (contentmsg.contentname == "previewplant") {
+
+                                       content.html = '<img src="php/PlantImages.php?plantid='+contentmsg.plantid+'"/>';
+                               }
+                               this.loadTab(content, contentmsg.contentname);
+                               if (contentmsg.contentname == "editplant") {
                                        editor.EditCallback();
                                }
                                break;
@@ -380,7 +385,20 @@ Lseed.Communication = function() {
                        cmp.removeAll();
                        cmp.add(elem);
                } else {
-                       console.error("Lseed.Communication.clearNavigation: 'navTree' does not exist.");
+                       console.error("Lseed.Communication.closeAllTabs: 'contentTabPanel' does not exist.");
+               }
+       };
+       
+       this.closeTab = function(tabname) {
+               var cmp = Ext.getCmp('contentTabPanel');
+               if (cmp) {
+                       var tab = this.getTab(tabname);
+                       if (tab) {
+                               console.error("Lseed.Communication.closeTab: '"+tabname+"' does not exist.");
+                       }
+                       cmp.remove(tab);
+               } else {
+                       console.error("Lseed.Communication.closeTab: 'contentTabPanel' does not exist.");
                }
        };
        
@@ -488,9 +506,10 @@ Lseed.Communication = function() {
                this.AddCallback("GetPlantList", this.GetPlantListCallback.createDelegate(this));
                this.AddCallback("GetSeasonList", this.GetSeasonListCallback.createDelegate(this));
                
+               this.AddCallback("CheckSyntax", editor.HandleSyntaxCheckAnswerForEditor.createDelegate(editor));
+               
                this.AddCallback("SavePlant", editor.SaveCallback.createDelegate(editor));
                this.AddCallback("DeletePlant", editor.DeleteCallback.createDelegate(editor));
-               this.AddCallback("ValidatePlant", editor.HandleSyntaxCheckAnswerForEditor.createDelegate(editor));
                this.AddCallback("ActivatePlant", editor.ActivateCallback.createDelegate(editor));
                
                this.sendMessage(Lseed.MessageCommands.RPC, {func: 'IsLoggedIn'});
@@ -505,7 +524,6 @@ Lseed.Editor = function() {
        };
        
        this.Save = function(plant) {
-               
                communication.sendMessage(Lseed.MessageCommands.RPC, { 
                        func: 'SavePlant'
                        ,plant: plant.data.Name
@@ -539,6 +557,12 @@ Lseed.Editor = function() {
                }
        };
        
+       this.Preview = function(plant) {
+               communication.sendMessage(Lseed.MessageCommands.ContentRequest, {content: 'previewplant', plantid: plant.data.ID} );
+       };
+       this.PreviewCallback = function() {
+       };
+       
        this.Edit = function(plant) {
                communication.sendMessage(Lseed.MessageCommands.ContentRequest, {content: 'editplant'});
                this.LastEditPlant = plant;
@@ -561,13 +585,9 @@ Lseed.Editor = function() {
        this.TestCallback = function() {
        };
        
-       this.CheckSyntax = function(plant, callback) {
-               if (typeof callback != 'undefined' && callback != null) {
-                       this.CheckSyntaxCallback = callback;
-               }
-               
+       this.CheckSyntax = function(plant) {
                communication.sendMessage(Lseed.MessageCommands.RPC, { 
-                       func: 'ValidatePlant'
+                       func: 'CheckSyntax'
                        ,plant: plant.data.Name
                        ,code: plant.data.Code
                });
@@ -582,7 +602,11 @@ Lseed.Editor = function() {
                                ,icon: Ext.MessageBox.Info
                        });
                } else {
+                       // This is a hack for now:
                        var pdEditor = Ext.getCmp("plantdefinitioneditor");
+                       if (!pdEditor) {
+                               var pdEditor = Ext.getCmp("editplantdefinitioneditor");
+                       }
                        if (pdEditor) {
                                communication.stopWaitingForPage();
                                Ext.MessageBox.show({
@@ -646,6 +670,9 @@ Lseed.Plant = Ext.data.Record.create([{
 }, {
        name: 'Code'
        ,type: 'string'
+}, {
+       name: 'IsValid'
+       ,type: 'boolean'
 }, {
        name: 'IsActive'
        ,type: 'boolean'
index 733ba5a..c23ef46 100644 (file)
                                $pw = $_POST["pw"];
                                $plantname = $_POST["plant"];
                                $code = $_POST["code"];
-                               $response = $controller->HandleRemoteProcedureCall($_POST["func"], $username, $pw, $plantname, $code);
+                               $plantid = $_POST["id"];
+                               $response = $controller->HandleRemoteProcedureCall($_POST["func"], $username, $pw, $plantname, $code, $plantid);
                                break;
 
                        case "ContentRequest":
                                if ($controller->IsLoggedIn() != "false") {
-                                       $response = new ContentMessage($_POST["content"]);
+                                       $response = new ContentMessage($_POST["content"], $_POST["plantid"]);
                                } else {
                                        $func = "function() { this.showLoginDialog(); this.showMessage('Sie sind nicht eingeloggt bitte einloggen', 'error'); }";
                                        $response = new RemoteProcedureCall($func);
index f70cf01..f0577ec 100644 (file)
                        return $result;
                }
 
-               public function HandleRemoteProcedureCall($func, $username, $pw, $plantname, $code) {
+               public function HandleRemoteProcedureCall($func, $username, $pw, $plantname, $code, $plantid) {
                        $plant = null;
                        if ($this->m_User == null) {
                                $this->m_User = $this->m_Database->GetUser($username);
                        }
                        if ($this->m_User != null) {
-                               $plant = $this->m_User->GetPlant($plantname);
+                               if ($plantid != null) {
+                                       $plant = $this->m_User->GetPlantById($plantid);
+                               } else {
+                                       $plant = $this->m_User->GetPlant($plantname);
+                               }
                        }
                        
                        $res = "";
                                case "TestPlant":
                                        break;
 
-                               case "ValidatePlant":
-                                       if ($plant != null) {
-                                               $res = $plant->Validate();
-                                       } else {
-                                               $res = "{ success: false, msg: \"Keine Pflanze mit dem Namen '".$plantname."' für den Nutzer '".$username."' gefunden.\" }";
-                                       }
+                               case "CheckSyntax":
+                                       # Create a temporary plant              
+                                       $plant = new Plant(0,0,$plantname,$code,0,0);
+                                       $res = $plant->Validate();
                                        break;
 
                                default:
index 19e5abe..ed29af0 100644 (file)
                }
                public function InsertNewPlant($userid, $name, $code) {
                        $result = false;
+
+                       $plant = new Plant(0,$userid,$plantname,$code,0,this);
+                       $valid = $plant->IsValid();
                        
-                       $stmt = $this->m_Connection->prepare("INSERT INTO plant (UserID, Name, Code) VALUES (?, ?, ?)");
+                       $stmt = $this->m_Connection->prepare("INSERT INTO plant (UserID, Name, Code, Valid) VALUES (?, ?, ?, ?)");
                        
                        if ($stmt) {
-                               $stmt->bind_param("dss", $userid, $name, $code);
+                               $stmt->bind_param("dssi", $userid, $name, $code, $valid);
                                $stmt->execute();
                                
                                if ($stmt->affected_rows == 1) {
                public function GetPlantByID($userid, $plantid) {
                        $result = null;
 
-                       $stmt = $this->m_Connection->prepare("SELECT ID, UserID, Name, Code FROM plant WHERE UserID=? AND ID=?");
+                       $stmt = $this->m_Connection->prepare("SELECT ID, UserID, Name, Code, Valid FROM plant WHERE UserID=? AND ID=?");
                        
                        if ($stmt) {
                                $stmt->bind_param("ds", $userid, $plantid);
                                $stmt->execute();
-                               $stmt->bind_result( $id, $theuserid, $thename, $code);
+                               $stmt->bind_result( $id, $theuserid, $thename, $code, $isvalid);
                                
                                if ($stmt->fetch()) {
-                                       $result = new Plant($id, $theuserid, $thename, $code, $this);
+                                       $result = new Plant($id, $theuserid, $thename, $code, $isvalid, $this);
                                } else {
                                        //echo "nope no plant like that found.";
                                }
                public function UpdatePlant($plant) {
                        $result = false;
                        
-                       $stmt = $this->m_Connection->prepare("UPDATE plant SET Code=? WHERE ID=?");
-                       
+                       $stmt = $this->m_Connection->prepare("UPDATE plant SET Code=?, Valid=? WHERE ID=?");
+
                        if ($stmt) {
-                               $stmt->bind_param("sd", $plant->Code, $plant->ID);
+                               $stmt->bind_param("sid", $plant->Code, $plant->IsValid(), $plant->ID);
                                $stmt->execute();
 
                                if ($stmt->affected_rows == 1) {
index 7c97090..0449c08 100644 (file)
@@ -9,18 +9,19 @@
                public $IsActive;
                public $m_Database;
 
-               public function __construct($id, $userid, $name, $code, $database) {
+               public function __construct($id, $userid, $name, $code, $valid, $database) {
                        $this->ID = $id;
                        $this->UserID = $userid;
                        $this->Name = $name;
                        $this->Code = $code;
                        $this->IsActive = false;
+                       $this->Valid = $valid;
                        $this->m_Database = $database;
                        if (!isset($GLOBALS['ValidatorFile'])) {
-                               $GLOBALS['ValidatorFile'] = '../cgi/validate';
-                               if ($GLOBALS['WINDOWS']) {
-                                       $GLOBALS['ValidatorFile'] = '../cgi/validate.exe';
-                               }
+                               $GLOBALS['ValidatorFile'] = '/home/lseed/.cabal/bin/validate';
+                               #if ($GLOBALS['WINDOWS']) {
+                               #       $GLOBALS['ValidatorFile'] = '../cgi/validate.exe';
+                               #}
                        }
                }
 
@@ -28,7 +29,7 @@
                        
                        $active = 'false';
                        if ($this->IsActive) { $active = 'true'; } else { $active = 'false'; }
-                       return "{ ID: " . $this->ID . ", Name: '" . $this->Name . "', Code: '" . $this->Code . "', IsActive: " . $active . " }";
+                       return "{ ID: " . $this->ID . ", Name: '" . $this->Name . "', Code: '" . $this->Code . "', IsValid: " . $this->Valid . ", IsActive: " . $active . " }";
                }
 
                public function ToJsonArray() {
                }
                
                public function Validate() {
-                       return $this->ValidateCode();
+                       $arr = $this->ValidateCode();
+                       return $arr[1];
+               }
+
+               public function IsValid() {
+                       $arr =  $this->ValidateCode();
+                       return $arr[0];
                }
                
                public function ValidateCode() {
                        $result = "{valid: false, line: 0, column: 0, msg: 'Interner Server Fehler'}";
+                       $result_ok = 0;
                        
                        $descriptorspec = array(
                           0 => array("pipe", "r"),  // STDIN ist eine Pipe, von der das Child liest
@@ -84,7 +92,7 @@
                           2 => array("pipe", "w")   // STDERR
                        );
 
-                       $cwd = realpath("..\\cgi");
+                       $cwd = realpath(".");
 
                        $process = proc_open($GLOBALS['ValidatorFile'], $descriptorspec, $pipes, $cwd, array());
 
                                $return_value = proc_close($process);
                                
                                //echo $return_value;
-                               if ($return_value == 0) {
-                                       $result = $output;
-                               }
+                               $result = $output;
+                               $result_ok = 1;
                        }
 
-                       return $result;
+                       return array($result_ok, $result);
                }
                
                public function Activate() {
diff --git a/web/php/PlantImages.php b/web/php/PlantImages.php
new file mode 100644 (file)
index 0000000..0705106
--- /dev/null
@@ -0,0 +1,71 @@
+<?php
+       session_start();
+       if (get_magic_quotes_gpc()) { $_POST = array_map( 'stripslashes', $_POST ); }
+       
+       $_GLOBALS['WINDOWS'] = false;
+       
+       include("Plant.php");
+       include("User.php");
+       include("Season.php");
+       include("SeasonScore.php");
+       include("Controller.php");
+       include("Database.php");
+
+       function main()
+       {
+               $controller = new Controller();
+
+               $user = $controller->GetUser();
+               if ($user == null) {
+                       header("HTTP/1.0 404 Not Found");
+                       header("Content-type: text/plain; charset=utf-8");
+                       echo "User not found";
+                       return;
+               }
+
+               $plantid = $_GET[plantid];
+               if ($plantid == null) {
+                       header("HTTP/1.0 404 Not Found");
+                       header("Content-type: text/plain; charset=utf-8");
+                       echo "No Plant id given";
+                       return;
+               }
+
+               $plant = $user->GetPlantById($plantid);
+               if ($plant == null) {
+                       header("HTTP/1.0 404 Not Found");
+                       header("Content-type: text/plain; charset=utf-8");
+                       echo "No Plant found";
+                       return;
+               }
+
+               $descriptorspec = array(
+                  0 => array("pipe", "r"),
+                  1 => array("pipe","w"),
+                  2 => array("pipe","w"),
+               );
+
+               $cwd = realpath(".");
+
+               $process = proc_open("../cgi/renderAsPNG ".escapeshellarg($plant->Name), $descriptorspec, $pipes, $cwd, array());
+
+               if (is_resource($process)) {
+                       // $pipes sieht nun so aus:
+                       // 0 => Schreibhandle, das auf das Child STDIN verbunden ist
+                       // 1 => Lesehandle, das auf das Child STDOUT verbunden ist
+                       // Jedwede Fehlerausgaben werden an /tmp/error-output.txt angefügt
+                       header("Content-type: image/png");
+
+                       fwrite($pipes[0], $plant->Code);
+                       fclose($pipes[0]);
+
+                       echo stream_get_contents($pipes[1]);
+                        fclose($pipes[1]);
+                        fclose($pipes[2]);
+
+                       $return_value = proc_close($process);
+               }
+       }
+
+       main();
+?>
index 18809c8..049c7e7 100644 (file)
                public $m_Type;
                public $m_ContentName;
                
-               public function __construct($name) {
+               public function __construct($name, $plantid) {
                        parent::__construct("Content");
                        $this->m_ContentName = $name;
+                       $this->m_PlantID = $plantid;
                }
                
                public function send() {
                        echo "{ cmd: '".$this->m_Command."', contentname: '".$this->m_ContentName."', content: ";
                        readfile( "page/".$this->m_ContentName.".pg" );
+                       if ($this->m_PlantID != null) {
+                               echo ", plantid: ".$this->m_PlantID;
+                       };
                        echo "}";
                }
        }
index dffc97e..3281fac 100644 (file)
@@ -27,4 +27,3 @@
                }
        }
 ?>
-
index 462545b..0fb802e 100644 (file)
@@ -12,6 +12,7 @@
                        switch ($content) {
                                case "myplants":
                                case "createplant":
+                               case "editplant":
                                case "testplant":
                                        new ContentMessage($content).send();
                                        break;
index d347416..e078057 100644 (file)
@@ -24,6 +24,8 @@
                                        ,Code: planteditor.getValue()
                                });
                                editor.Save(plant);
+                               editor.Edit(plant);
+                               communication.closeTab("createplant");
                        } else {
                                communication.showMessage("Ihre Pflanze benötigt einen Namen.", "error");
                        }
@@ -39,7 +41,7 @@
                        if (pdEditor && pnEditor) {
                                var name = pnEditor.getValue();
                                var code = pdEditor.getValue();
-                               editor.CheckSyntax({data:{Code:code, Name:name}}, editor.HandleSyntaxCheckAnswerForEditor); 
+                               editor.CheckSyntax({data:{Code:code, Name:name}});
                        } else {
                                console.error("Lseed.Editor.CheckSyntaxCallback_Callback: 'plantdefinitioneditor' Could not be found.");
                        }
old mode 100755 (executable)
new mode 100644 (file)
index f207407..c70d490
@@ -1,5 +1,5 @@
 {
-       id: 'ContentPanel_createplant'
+       id: 'ContentPanel_editplant'
        ,closable: true
        ,style: 'padding: 5px;'
        ,title: 'Pflanze editieren'
@@ -39,7 +39,7 @@
                        if (pdEditor && pnEditor) {
                                var name = pnEditor.getValue();
                                var code = pdEditor.getValue();
-                               editor.CheckSyntax({data:{Code:code, Name:name}}, editor.HandleSyntaxCheckAnswerForEditor); 
+                               editor.CheckSyntax({data:{Code:code, Name:name}}); 
                        } else {
                                console.error("Lseed.Editor.CheckSyntaxCallback_Callback: 'plantdefinitioneditor' Could not be found.");
                        }
index fb9b23c..b68a2dc 100644 (file)
                                    grid.getStore().remove(r);
                                }
                        }
-               },{
-                       id: 'plantlistCheckPlantSyntax'
-                       ,text: 'Check Syntax'
-                       ,icon: 'img/icons/accept.png'
-                       ,cls: 'x-btn-text-icon'
-                       ,disabled: true
-                       ,handler: editor.CheckSyntax.createDelegate(editor, ['plantlistgrid'], true)
                },{
                        id: 'plantlistActivatePlant'
                        ,text: 'Activate'
                                    editor.Activate(selected[0]);
                                }
                        }
+               },{
+                       id: 'plantlistPreviewPlant'
+                       ,text: 'Preview'
+                       ,icon: 'img/icons/edit.png'
+                       ,cls: 'x-btn-text-icon'
+                       ,disabled: true
+                       ,handler: function(){
+                               var grid = Ext.getCmp("plantlistgrid");
+                               var selected = grid.getSelectionModel().getSelections();
+                               if(selected.length > 0) {
+                                   editor.Preview(selected[0]);
+                               }
+                       }
                },{
                        id: 'plantlistEditPlant'
                        ,text: 'Edit'
                ,columns: [
                        new Ext.grid.RowNumberer()
                        ,{
-                               id: 'ID'
-                               ,header: 'ID'
-                               ,width: 200
-                               ,sortable: true
-                               ,dataIndex: 'ID'
-                       },{
                                id: 'Name'
                                ,header: 'Name'
                                ,width: 200
                                        xtype: 'textfield'
                                        ,allowBlank: true
                                }
+                       },{
+                               id: 'IsValid'
+                               ,header: 'Valid'
+                               ,width: 50
+                               ,sortable: true
+                               ,dataIndex: 'IsValid'
+                               ,renderer: function (value, metadata, record, rowindex, colindex, store) {
+                                       if (value) {
+                                               return '<img src="img/icons/accept.png"/>';
+                                       } else {
+                                               return '<img src="img/icons/cross.png"/>';
+                                       }
+                               }
                        },{
                                id: 'IsActive'
                                ,header: 'IsActive'
-                               ,width: 200
+                               ,width: 50
                                ,sortable: true
                                ,dataIndex: 'IsActive'
+                               ,renderer: function (value, metadata, record, rowindex, colindex, store) {
+                                       if (value) {
+                                               return '<img src="img/icons/award.png"/>';
+                                       } else {
+                                               return '';
+                                       }
+                               }
                        }
                ]
                ,sm: new Ext.grid.RowSelectionModel({
                        ,listeners: {
                                rowselect: function() {
                                        Ext.getCmp("plantlistDeletePlant").enable();
-                                       Ext.getCmp("plantlistCheckPlantSyntax").enable();
                                        Ext.getCmp("plantlistActivatePlant").enable();
                                        Ext.getCmp("plantlistEditPlant").enable();
+                                       Ext.getCmp("plantlistPreviewPlant").enable();
                                }
                                ,rowdeselect: function() {
                                        Ext.getCmp("plantlistDeletePlant").disable();
-                                       Ext.getCmp("plantlistCheckPlantSyntax").disable();
                                        Ext.getCmp("plantlistActivatePlant").disable();
+                                       Ext.getCmp("plantlistPreviewPlant").disable();
                                        Ext.getCmp("plantlistEditPlant").disable();
                                }
                        }
index c973d87..3d45435 100644 (file)
                id: 'myplants'
                ,text: "Meine Pflanzen"
                ,leaf: true
-       },{
-               id: 'testplant'
-               ,text: "Pflanze testen"
-               ,leaf: true
        },{
                id: 'season'
                ,text: "Aktuelle Staffel"
diff --git a/web/php/page/previewplant.pg b/web/php/page/previewplant.pg
new file mode 100644 (file)
index 0000000..e9504d7
--- /dev/null
@@ -0,0 +1,6 @@
+{
+       id: 'ContentPanel_previewplant'
+       ,closable: true
+       ,style: 'padding: 5px;'
+       ,title: 'Pflanze anschauen'
+}
diff --git a/web/php/page/testplant.pg b/web/php/page/testplant.pg
deleted file mode 100644 (file)
index 09a0506..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-{
-       id: 'ContentPanel_testplant'
-       ,closable: true
-       ,style: 'padding: 5px;'
-       ,title: 'Pflanze testen'
-       ,html: 'TODO'
-}
\ No newline at end of file
index 43f8c4a..aee2584 100644 (file)
@@ -1,41 +1,42 @@
-CREATE DATABASE `lseed` ;
-
-CREATE USER 'lseed'@'localhost' IDENTIFIED BY 'GCp:rtAaN8nwTFMP';
-
-REVOKE ALL PRIVILEGES ON * . * FROM 'lseed'@'localhost';
-REVOKE GRANT OPTION ON * . * FROM 'lseed'@'localhost';
-GRANT SELECT, INSERT, UPDATE, DELETE ON * . *
-TO 'lseed'@'localhost'
-WITH MAX_QUERIES_PER_HOUR 0
-MAX_CONNECTIONS_PER_HOUR 0
-MAX_UPDATES_PER_HOUR 0
-
-CREATE TABLE `user` (
-       `ID` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
-       `Name` VARCHAR( 255 ) NOT NULL ,
-       `Password` VARCHAR( 255 ) NOT NULL ,
-       `IsAdmin` BOOL NOT NULL ,
-       `NextSeed` Int NULL,
-       INDEX ( `Name` )
-) ENGINE = MYISAM ;
-
-CREATE TABLE `plant` (
-       `ID` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
-       `UserID` INT NOT NULL ,
-       `Name` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL ,
-       `Code` VARCHAR( 2048 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL ,
-       INDEX ( `UserID` )
-) ENGINE = MYISAM ;
-
-CREATE TABLE `season` (
-       `ID` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
-       `IsRunning` BOOL NOT NULL
-) ENGINE = MYISAM ;
-
-CREATE TABLE `seasonscore` (
-       `ID` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
-       `UserID` INT NOT NULL ,
-       `SeasonID` INT NOT NULL ,
-       `Score` DOUBLE NOT NULL, 
-       UNIQUE INDEX ( `UserID`, `SeasonID` )
-) ENGINE = MYISAM ;
+DROP DATABASE IF EXISTS `lseed`;\r
+CREATE DATABASE `lseed` ;\r
+\r
+CREATE USER 'lseed'@'localhost' IDENTIFIED BY 'GCp:rtAaN8nwTFMP';\r
+\r
+REVOKE ALL PRIVILEGES ON * . * FROM 'lseed'@'localhost';\r
+REVOKE GRANT OPTION ON * . * FROM 'lseed'@'localhost';\r
+GRANT SELECT, INSERT, UPDATE, DELETE ON * . * TO 'lseed'@'localhost'\r
+WITH MAX_QUERIES_PER_HOUR 0\r
+MAX_CONNECTIONS_PER_HOUR 0\r
+MAX_UPDATES_PER_HOUR 0;\r
+\r
+CREATE TABLE `user` (\r
+       `ID` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,\r
+       `Name` VARCHAR( 255 ) NOT NULL ,\r
+       `Password` VARCHAR( 255 ) NOT NULL ,\r
+       `IsAdmin` BOOL NOT NULL ,\r
+       `NextSeed` Int NULL,\r
+       INDEX ( `Name` )\r
+) ENGINE = MYISAM ;\r
+\r
+CREATE TABLE `plant` (\r
+       `ID` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,\r
+       `UserID` INT NOT NULL ,\r
+       `Name` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL ,\r
+       `Code` VARCHAR( 2048 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL ,\r
+       `Valid` BOOL NOT NULL,\r
+       INDEX ( `UserID` )\r
+) ENGINE = MYISAM ;\r
+\r
+CREATE TABLE `season` (\r
+       `ID` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,\r
+       `IsRunning` BOOL NOT NULL\r
+) ENGINE = MYISAM ;\r
+\r
+CREATE TABLE `seasonscore` (\r
+       `ID` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,\r
+       `UserID` INT NOT NULL ,\r
+       `SeasonID` INT NOT NULL ,\r
+       `Score` DOUBLE NOT NULL, \r
+       UNIQUE INDEX ( `UserID`, `SeasonID` )\r
+) ENGINE = MYISAM ;\r