Browse Source

Changed Pattern to allwo more than 2 Character per part

Manuel Gall 4 years ago
parent
commit
0295cef0b7
5 changed files with 9 additions and 5 deletions
  1. BIN
      server/database/stations.db
  2. 1 1
      server/was.rb
  3. 2 1
      ui/css/design.css
  4. 2 2
      ui/index.html
  5. 4 1
      ui/js/design.js

BIN
server/database/stations.db


+ 1 - 1
server/was.rb

@@ -961,7 +961,7 @@ def createDB(opts)
   
   #  Unique pattern
   #  $db.execute "CREATE TABLE IF NOT EXISTS station(station INT, patternID INT, pattern CHARACTER(20), description TEXT, date TEXT, P0 VARCHAR(2), P1 VARCHAR(2), P2 VARCHAR(2), P3 VARCHAR(2), P4 VARCHAR(2), P5 VARCHAR(2), P6 VARCHAR(2), P7 VARCHAR(2), P8 VARCHAR(2), P9 VARCHAR(2), P10 VARCHAR(2), PRIMARY KEY(station,patternID), UNIQUE(station, pattern))"
-  $db.execute "CREATE TABLE IF NOT EXISTS station(station INT, patternID INT, pattern CHARACTER(20), description TEXT, date TEXT, P0 VARCHAR(2), P1 VARCHAR(2), P2 VARCHAR(2), P3 VARCHAR(2), P4 VARCHAR(2), P5 VARCHAR(2), P6 VARCHAR(2), P7 VARCHAR(2), P8 VARCHAR(2), P9 VARCHAR(2), P10 VARCHAR(2), PRIMARY KEY(station,patternID), UNIQUE(station, patternID))"
+  $db.execute "CREATE TABLE IF NOT EXISTS station(station INT, patternID INT, pattern CHARACTER(256), description TEXT, date TEXT, P0 VARCHAR(10), P1 VARCHAR(10), P2 VARCHAR(10), P3 VARCHAR(10), P4 VARCHAR(10), P5 VARCHAR(10), P6 VARCHAR(10), P7 VARCHAR(10), P8 VARCHAR(10), P9 VARCHAR(10), P10 VARCHAR(10), PRIMARY KEY(station,patternID), UNIQUE(station, patternID))"
   
   
   

+ 2 - 1
ui/css/design.css

@@ -140,8 +140,9 @@ td {
 	
 }
 .patternPartInput{
-	width: 3em !important;
+	width: auto !important;
 	text-align: center;
+  padding: 0.5em 0 !important;
 }
 
 

+ 2 - 2
ui/index.html

@@ -111,7 +111,7 @@
             <template id="patternClone">
               <div class="patternPart">
                 <a href="#" onclick="removePatternPart($(this))">[⨯]</a>
-                <input data-class='part' type="text" class="patternPartInput" maxlength="2" size="2" name="pattern" value="*" required>
+                <input data-class='part' type="text" class="patternPartInput" maxlength="10" size="2" name="pattern" value="*" required>
               </div>
             </template>
             
@@ -120,7 +120,7 @@
               </div>
               <div class="wasRight">
                 <span id="patternInput">
-                  <input  type="text" class="patternPart" maxlength="2" size="2" name="pattern" value="*" required>
+                  <input  type="text" class="patternPart" maxlength="10" size="2" name="pattern" value="*" required>
                 </span>
                 <a href="#" onclick="addPatternPart(true)">[+]</a>
               </div>

+ 4 - 1
ui/js/design.js

@@ -147,11 +147,13 @@ function getPattern(stationID, patternID){ //Get DB 2 HTML
           {
             if(i == 0){
               $("#patternInput .patternPartInput").val(pattern[i]);
+              $("#patternInput .patternPartInput").attr('size', pattern[i].length);
             }
             else{
               var clone = document.importNode(document.querySelector('#patternClone').content,true);
               $('[data-class=part]',clone).val(pattern[i]);
               $('[data-class=part]',clone).limitkeypress({ rexp: keypressRegex() });
+              $('[data-class=part]',clone).attr('size', pattern[i].length);
               
               $("#patternInput").append(clone);
             }
@@ -177,7 +179,8 @@ function getPattern(stationID, patternID){ //Get DB 2 HTML
 
 
 function keypressRegex(){ //Helper Function
-	return /^[A-Za-z0-9\*]*$/;
+	return /^.{1,10}$/;
+	//return /^[A-Za-z0-9\*]*$/; //Ohne Sonderzeichen
 }
 
 function removePatternPart(value) { //HTML