Mercurial > hg > fapweb
diff createdb.php @ 139:75cf14ee99a7
More work on party information system.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Tue, 22 Oct 2013 23:58:41 +0300 |
parents | 5837b9333964 |
children | 20ca8edfb01a |
line wrap: on
line diff
--- a/createdb.php Tue Oct 22 22:05:00 2013 +0300 +++ b/createdb.php Tue Oct 22 23:58:41 2013 +0300 @@ -144,8 +144,27 @@ "attendees" => "id INTEGER PRIMARY KEY AUTOINCREMENT, regtime INT, name VARCHAR(64), groups VARCHAR(64), oneliner VARCHAR(64), email VARCHAR(80), key_id INT DEFAULT NULL", "votekeys" => "id INTEGER PRIMARY KEY AUTOINCREMENT, key VARCHAR(64), active INT DEFAULT 0", - "votes" => "id INTEGER PRIMARY KEY AUTOINCREMENT, entry_id INT DEFAULT NULL, voter_id INT DEFAULT NULL, value INT DEFAULT 0", + + "displayVars" => "key VARCHAR(32) PRIMARY KEY, vtype INT, vstr VARCHAR(128), vtext TEXT, vint INT, desc VARCHAR(128)", + "displayPages" => "id INTEGER PRIMARY KEY AUTOINCREMENT, title VARCHAR(128), text VARCHAR(4096)", + "displayListData" => "id INTEGER PRIMARY KEY AUTOINCREMENT, name VARCHAR(128)", + "displayListPages" => "id INTEGER PRIMARY KEY AUTOINCREMENT, list_id INT DEFAULT 0, page_id INT DEFAULT 0", +); + +$siteDisplayVars = array( + "tempPageDuration" => array(VT_INT, 120, "Temporary page display time (seconds)"), + "tempPage" => array(VT_INT, 0, "Temporary page ID"), + + "showMode" => array(VT_INT, 0, "Currently active display mode"), + + "activePageMode" => array(VT_INT, 0, "Current active page display mode"), + "activePage" => array(VT_INT, 0, "Current active page"), + "activePageExpire" => array(VT_INT, 0, "Expiration timestamp of current page"), + + "rotateDuration" => array(VT_INT, 60, "Page rotation time per page (seconds)"), + "rotateList" => array(VT_INT, 0, "Current rotation list ID"), + "rotateListIndex" => array(VT_INT, 0, "Current index in rotation list"), ); $siteTestData = array( @@ -188,6 +207,29 @@ array("penis song", "reed/flt", 2, "penis.mod"), array("jenkka", "aegis", 2, "jenkka.mod"), ), + + "displayPages" => array( + "title,text", + "%s,%s", + array("Next Up", "<h1>Next up: 4k intro</h1><h2>4k intro compo is about to begin</h2>... in about 10 minutes."), + array("Astu to infodesk", "<h1>Astu</h1>Please come to orga info desk!"), + array("Gentle Eye mainos", "<h1>Buy Amiga stuff!</h1><h2>Gentle Eye Oy is selling Amiga-related stuff near organizer desk!"), + ), + + "displayListData" => array( + "name", + "%s", + array("Main rotation"), + array("Next Up"), + ), + + "displayListPages" => array( + "list_id,page_id", + "%d,%d", + array(1,2), + array(1,3), + array(2,1), + ), ); @@ -255,12 +297,11 @@ } -function stAddSettings() +function stAddSettings($settings, $table) { - global $siteDefaults; - echo "Adding settings to settings table.\n"; + echo "Adding settings to '".$table."' table.\n"; - foreach ($siteDefaults as $key => $data) + foreach ($settings as $key => $data) { switch ($data[0]) { @@ -272,7 +313,7 @@ } $sql = stPrepareSQL( - "INSERT INTO settings (key,vtype,".$var.",desc) VALUES (%s,%d,".$type.",%s)", + "INSERT INTO ".$table." (key,vtype,".$var.",desc) VALUES (%s,%d,".$type.",%s)", $key, $data[0], $data[1], $data[2]); stExecSQL($sql); @@ -352,7 +393,10 @@ case "new": if (stCreateTables()) - stAddSettings(); + { + stAddSettings($siteDefaults, "settings"); + stAddSettings($siteDisplayVars, "displayVars"); + } if ($addData) stAddTestData();