Changeset 545

Show
Ignore:
Timestamp:
04/14/05 11:13:05 (8 years ago)
Author:
benoitg
Message:

2005-04-14 Benoit Gr�goire <bock@…>

  • First part of the future content delivery infrastructure. Many files added.
Location:
trunk/wifidog-auth
Files:
11 added
23 modified

Legend:

Unmodified
Added
Removed
  • trunk/wifidog-auth/ChangeLog

    r544 r545  
     12005-04-14 Benoit Grégoire  <bock@step.polymtl.ca> 
     2        * First part of the future content delivery infrastructure.  Many files added. 
     3 
    142005-04-01 François Proulx  <francois.proulx@gmail.com> 
    25        * Modified gen.sh script to match UTF-8 
  • trunk/wifidog-auth/sql/dump_initial_data_postgres.sh

    r530 r545  
    1010 
    1111pg_dump -a -D --username=wifidog -t schema_info 
    12  
     12pg_dump -a -D --username=wifidog -t locales 
    1313echo "COMMIT;" 
  • trunk/wifidog-auth/sql/sync_sql_for_cvs.sh

    r523 r545  
    11#!/bin/sh 
    2 echo "Note:  When prompted for a password, enter the wifidog database user's password" 
     2echo "Note:  You will be prompted for a password several times; enter the wifidog database user's password" 
    33sh dump_initial_data_postgres.sh > wifidog-postgres-initial-data.sql 
    44chmod a+r wifidog-postgres-initial-data.sql 
  • trunk/wifidog-auth/sql/wifidog-postgres-initial-data.sql

    r530 r545  
    1313 
    1414-- 
    15 -- Data for TOC entry 2 (OID 144784) 
     15-- Data for TOC entry 2 (OID 192400) 
    1616-- Name: token_status; Type: TABLE DATA; Schema: public; Owner: wifidog 
    1717-- 
     
    3434 
    3535-- 
    36 -- Data for TOC entry 2 (OID 144818) 
     36-- Data for TOC entry 2 (OID 192434) 
    3737-- Name: venue_types; Type: TABLE DATA; Schema: public; Owner: wifidog 
    3838-- 
     
    8686 
    8787-- 
    88 -- Data for TOC entry 2 (OID 144816) 
     88-- Data for TOC entry 2 (OID 192432) 
    8989-- Name: node_deployment_status; Type: TABLE DATA; Schema: public; Owner: wifidog 
    9090-- 
     
    111111 
    112112-- 
    113 -- Data for TOC entry 2 (OID 144828) 
     113-- Data for TOC entry 2 (OID 192444) 
    114114-- Name: schema_info; Type: TABLE DATA; Schema: public; Owner: wifidog 
    115115-- 
    116116 
    117 INSERT INTO schema_info (tag, value) VALUES ('schema_version', '5'); 
     117INSERT INTO schema_info (tag, value) VALUES ('schema_version', '6'); 
     118 
     119 
     120-- 
     121-- PostgreSQL database dump 
     122-- 
     123 
     124SET client_encoding = 'UNICODE'; 
     125SET check_function_bodies = false; 
     126 
     127SET SESSION AUTHORIZATION 'wifidog'; 
     128 
     129SET search_path = public, pg_catalog; 
     130 
     131-- 
     132-- Data for TOC entry 2 (OID 214063) 
     133-- Name: locales; Type: TABLE DATA; Schema: public; Owner: wifidog 
     134-- 
     135 
     136INSERT INTO locales (locales_id) VALUES ('fr'); 
     137INSERT INTO locales (locales_id) VALUES ('en'); 
    118138 
    119139 
  • trunk/wifidog-auth/sql/wifidog-postgres-schema.sql

    r530 r545  
    2222 
    2323-- 
    24 -- TOC entry 5 (OID 144781) 
     24-- TOC entry 5 (OID 192397) 
    2525-- Name: administrators; Type: TABLE; Schema: public; Owner: wifidog 
    2626-- 
     
    3232 
    3333-- 
    34 -- TOC entry 6 (OID 144784) 
     34-- TOC entry 6 (OID 192400) 
    3535-- Name: token_status; Type: TABLE; Schema: public; Owner: wifidog 
    3636-- 
     
    4242 
    4343-- 
    44 -- TOC entry 7 (OID 144788) 
     44-- TOC entry 7 (OID 192404) 
    4545-- Name: connections; Type: TABLE; Schema: public; Owner: wifidog 
    4646-- 
     
    6464 
    6565-- 
    66 -- TOC entry 8 (OID 144794) 
     66-- TOC entry 8 (OID 192410) 
    6767-- Name: nodes; Type: TABLE; Schema: public; Owner: wifidog 
    6868-- 
     
    8989 
    9090-- 
    91 -- TOC entry 9 (OID 144804) 
     91-- TOC entry 9 (OID 192420) 
    9292-- Name: users; Type: TABLE; Schema: public; Owner: wifidog 
    9393-- 
     
    102102    username text, 
    103103    account_origin text NOT NULL, 
     104    never_show_username boolean DEFAULT false, 
     105    real_name text, 
     106    website text, 
     107    prefered_locale text, 
    104108    CONSTRAINT check_account_origin_not_empty CHECK ((account_origin <> ''::text)), 
    105109    CONSTRAINT check_user_not_empty CHECK (((user_id)::text <> ''::text)) 
     
    108112 
    109113-- 
    110 -- TOC entry 10 (OID 144814) 
     114-- TOC entry 10 (OID 192430) 
    111115-- Name: node_owners; Type: TABLE; Schema: public; Owner: wifidog 
    112116-- 
     
    119123 
    120124-- 
    121 -- TOC entry 11 (OID 144816) 
     125-- TOC entry 11 (OID 192432) 
    122126-- Name: node_deployment_status; Type: TABLE; Schema: public; Owner: wifidog 
    123127-- 
     
    129133 
    130134-- 
    131 -- TOC entry 12 (OID 144818) 
     135-- TOC entry 12 (OID 192434) 
    132136-- Name: venue_types; Type: TABLE; Schema: public; Owner: wifidog 
    133137-- 
     
    139143 
    140144-- 
    141 -- TOC entry 13 (OID 144823) 
     145-- TOC entry 13 (OID 192439) 
    142146-- Name: venues; Type: TABLE; Schema: public; Owner: wifidog 
    143147-- 
     
    150154 
    151155-- 
    152 -- TOC entry 14 (OID 144828) 
     156-- TOC entry 14 (OID 192444) 
    153157-- Name: schema_info; Type: TABLE; Schema: public; Owner: wifidog 
    154158-- 
     
    161165 
    162166-- 
    163 -- TOC entry 18 (OID 144841) 
     167-- TOC entry 15 (OID 214063) 
     168-- Name: locales; Type: TABLE; Schema: public; Owner: wifidog 
     169-- 
     170 
     171CREATE TABLE locales ( 
     172    locales_id text NOT NULL 
     173); 
     174 
     175 
     176-- 
     177-- TOC entry 16 (OID 214077) 
     178-- Name: content; Type: TABLE; Schema: public; Owner: wifidog 
     179-- 
     180 
     181CREATE TABLE content ( 
     182    content_id text NOT NULL, 
     183    content_type text NOT NULL, 
     184    title text, 
     185    description text, 
     186    project_info text, 
     187    sponsor_info text, 
     188    creation_timestamp timestamp without time zone DEFAULT now(), 
     189    CONSTRAINT content_type_not_empty_string CHECK ((content_type <> ''::text)) 
     190); 
     191 
     192 
     193-- 
     194-- TOC entry 17 (OID 214102) 
     195-- Name: content_has_owners; Type: TABLE; Schema: public; Owner: wifidog 
     196-- 
     197 
     198CREATE TABLE content_has_owners ( 
     199    content_id text NOT NULL, 
     200    user_id text NOT NULL, 
     201    is_author boolean NOT NULL, 
     202    owner_since timestamp without time zone DEFAULT now() 
     203); 
     204 
     205 
     206-- 
     207-- TOC entry 18 (OID 214118) 
     208-- Name: langstring_entries; Type: TABLE; Schema: public; Owner: wifidog 
     209-- 
     210 
     211CREATE TABLE langstring_entries ( 
     212    langstring_entries_id text NOT NULL, 
     213    langstrings_id text, 
     214    locales_id text, 
     215    value text DEFAULT ''::text 
     216); 
     217 
     218 
     219-- 
     220-- TOC entry 19 (OID 214134) 
     221-- Name: content_group; Type: TABLE; Schema: public; Owner: wifidog 
     222-- 
     223 
     224CREATE TABLE content_group ( 
     225    content_group_id text NOT NULL, 
     226    is_artistic_content boolean DEFAULT false NOT NULL, 
     227    is_locative_content boolean DEFAULT false NOT NULL, 
     228    content_selection_mode text 
     229); 
     230 
     231 
     232-- 
     233-- TOC entry 20 (OID 214145) 
     234-- Name: content_group_element; Type: TABLE; Schema: public; Owner: wifidog 
     235-- 
     236 
     237CREATE TABLE content_group_element ( 
     238    content_group_element_id text NOT NULL, 
     239    content_group_id text NOT NULL, 
     240    display_order integer DEFAULT 1, 
     241    displayed_content_id text, 
     242    force_only_allowed_node boolean 
     243); 
     244 
     245 
     246-- 
     247-- TOC entry 21 (OID 214166) 
     248-- Name: content_group_element_portal_display_log; Type: TABLE; Schema: public; Owner: wifidog 
     249-- 
     250 
     251CREATE TABLE content_group_element_portal_display_log ( 
     252    user_id text NOT NULL, 
     253    content_group_element_id text NOT NULL, 
     254    display_timestamp timestamp without time zone DEFAULT now() NOT NULL, 
     255    node_id text 
     256); 
     257 
     258 
     259-- 
     260-- TOC entry 22 (OID 214186) 
     261-- Name: user_has_content; Type: TABLE; Schema: public; Owner: wifidog 
     262-- 
     263 
     264CREATE TABLE user_has_content ( 
     265    user_id text NOT NULL, 
     266    content_id text NOT NULL, 
     267    subscribe_timestamp timestamp without time zone DEFAULT now() NOT NULL 
     268); 
     269 
     270 
     271-- 
     272-- TOC entry 23 (OID 214202) 
     273-- Name: node_has_content; Type: TABLE; Schema: public; Owner: wifidog 
     274-- 
     275 
     276CREATE TABLE node_has_content ( 
     277    node_id text NOT NULL, 
     278    content_id text NOT NULL, 
     279    subscribe_timestamp timestamp without time zone DEFAULT now() NOT NULL 
     280); 
     281 
     282 
     283-- 
     284-- TOC entry 24 (OID 214218) 
     285-- Name: network_has_content; Type: TABLE; Schema: public; Owner: wifidog 
     286-- 
     287 
     288CREATE TABLE network_has_content ( 
     289    network_id text NOT NULL, 
     290    content_id text NOT NULL, 
     291    subscribe_timestamp timestamp without time zone DEFAULT now() NOT NULL 
     292); 
     293 
     294 
     295-- 
     296-- TOC entry 25 (OID 214271) 
     297-- Name: content_group_element_has_allowed_nodes; Type: TABLE; Schema: public; Owner: wifidog 
     298-- 
     299 
     300CREATE TABLE content_group_element_has_allowed_nodes ( 
     301    content_group_element_id text NOT NULL, 
     302    node_id text NOT NULL, 
     303    allowed_since timestamp without time zone DEFAULT now() 
     304); 
     305 
     306 
     307-- 
     308-- TOC entry 29 (OID 214009) 
    164309-- Name: idx_token; Type: INDEX; Schema: public; Owner: wifidog 
    165310-- 
     
    169314 
    170315-- 
    171 -- TOC entry 19 (OID 144842) 
     316-- TOC entry 30 (OID 214010) 
    172317-- Name: idx_token_status_and_user_id; Type: INDEX; Schema: public; Owner: wifidog 
    173318-- 
     
    177322 
    178323-- 
    179 -- TOC entry 21 (OID 144843) 
     324-- TOC entry 32 (OID 214011) 
    180325-- Name: idx_unique_username_and_account_origin; Type: INDEX; Schema: public; Owner: wifidog 
    181326-- 
     
    185330 
    186331-- 
    187 -- TOC entry 15 (OID 144844) 
     332-- TOC entry 44 (OID 214165) 
     333-- Name: idx_content_group_element_content_group_id; Type: INDEX; Schema: public; Owner: wifidog 
     334-- 
     335 
     336CREATE INDEX idx_content_group_element_content_group_id ON content_group_element USING btree (content_group_id); 
     337 
     338 
     339-- 
     340-- TOC entry 26 (OID 214012) 
    188341-- Name: administrators_pkey; Type: CONSTRAINT; Schema: public; Owner: wifidog 
    189342-- 
     
    194347 
    195348-- 
    196 -- TOC entry 16 (OID 144846) 
     349-- TOC entry 27 (OID 214014) 
    197350-- Name: token_status_pkey; Type: CONSTRAINT; Schema: public; Owner: wifidog 
    198351-- 
     
    203356 
    204357-- 
    205 -- TOC entry 17 (OID 144848) 
     358-- TOC entry 28 (OID 214016) 
    206359-- Name: connections_pkey; Type: CONSTRAINT; Schema: public; Owner: wifidog 
    207360-- 
     
    212365 
    213366-- 
    214 -- TOC entry 20 (OID 144850) 
     367-- TOC entry 31 (OID 214018) 
    215368-- Name: nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: wifidog 
    216369-- 
     
    221374 
    222375-- 
    223 -- TOC entry 22 (OID 144852) 
     376-- TOC entry 33 (OID 214020) 
    224377-- Name: users_pkey; Type: CONSTRAINT; Schema: public; Owner: wifidog 
    225378-- 
     
    230383 
    231384-- 
    232 -- TOC entry 23 (OID 144854) 
     385-- TOC entry 34 (OID 214022) 
    233386-- Name: node_owners_pkey; Type: CONSTRAINT; Schema: public; Owner: wifidog 
    234387-- 
     
    239392 
    240393-- 
    241 -- TOC entry 24 (OID 144856) 
     394-- TOC entry 35 (OID 214024) 
    242395-- Name: node_deployment_status_pkey; Type: CONSTRAINT; Schema: public; Owner: wifidog 
    243396-- 
     
    248401 
    249402-- 
    250 -- TOC entry 25 (OID 144858) 
     403-- TOC entry 36 (OID 214026) 
    251404-- Name: venue_types_pkey; Type: CONSTRAINT; Schema: public; Owner: wifidog 
    252405-- 
     
    257410 
    258411-- 
    259 -- TOC entry 26 (OID 144860) 
     412-- TOC entry 37 (OID 214028) 
    260413-- Name: schema_info_pkey; Type: CONSTRAINT; Schema: public; Owner: wifidog 
    261414-- 
     
    266419 
    267420-- 
    268 -- TOC entry 28 (OID 144862) 
     421-- TOC entry 38 (OID 214068) 
     422-- Name: locales_pkey; Type: CONSTRAINT; Schema: public; Owner: wifidog 
     423-- 
     424 
     425ALTER TABLE ONLY locales 
     426    ADD CONSTRAINT locales_pkey PRIMARY KEY (locales_id); 
     427 
     428 
     429-- 
     430-- TOC entry 39 (OID 214084) 
     431-- Name: content_pkey; Type: CONSTRAINT; Schema: public; Owner: wifidog 
     432-- 
     433 
     434ALTER TABLE ONLY content 
     435    ADD CONSTRAINT content_pkey PRIMARY KEY (content_id); 
     436 
     437 
     438-- 
     439-- TOC entry 40 (OID 214108) 
     440-- Name: content_has_owners_pkey; Type: CONSTRAINT; Schema: public; Owner: wifidog 
     441-- 
     442 
     443ALTER TABLE ONLY content_has_owners 
     444    ADD CONSTRAINT content_has_owners_pkey PRIMARY KEY (content_id, user_id); 
     445 
     446 
     447-- 
     448-- TOC entry 41 (OID 214124) 
     449-- Name: langstring_entries_pkey; Type: CONSTRAINT; Schema: public; Owner: wifidog 
     450-- 
     451 
     452ALTER TABLE ONLY langstring_entries 
     453    ADD CONSTRAINT langstring_entries_pkey PRIMARY KEY (langstring_entries_id); 
     454 
     455 
     456-- 
     457-- TOC entry 42 (OID 214139) 
     458-- Name: content_group_pkey; Type: CONSTRAINT; Schema: public; Owner: wifidog 
     459-- 
     460 
     461ALTER TABLE ONLY content_group 
     462    ADD CONSTRAINT content_group_pkey PRIMARY KEY (content_group_id); 
     463 
     464 
     465-- 
     466-- TOC entry 43 (OID 214151) 
     467-- Name: content_group_element_pkey; Type: CONSTRAINT; Schema: public; Owner: wifidog 
     468-- 
     469 
     470ALTER TABLE ONLY content_group_element 
     471    ADD CONSTRAINT content_group_element_pkey PRIMARY KEY (content_group_element_id); 
     472 
     473 
     474-- 
     475-- TOC entry 45 (OID 214172) 
     476-- Name: content_group_element_portal_display_log_pkey; Type: CONSTRAINT; Schema: public; Owner: wifidog 
     477-- 
     478 
     479ALTER TABLE ONLY content_group_element_portal_display_log 
     480    ADD CONSTRAINT content_group_element_portal_display_log_pkey PRIMARY KEY (user_id, content_group_element_id, display_timestamp); 
     481 
     482 
     483-- 
     484-- TOC entry 46 (OID 214192) 
     485-- Name: user_has_content_pkey; Type: CONSTRAINT; Schema: public; Owner: wifidog 
     486-- 
     487 
     488ALTER TABLE ONLY user_has_content 
     489    ADD CONSTRAINT user_has_content_pkey PRIMARY KEY (user_id, content_id); 
     490 
     491 
     492-- 
     493-- TOC entry 47 (OID 214208) 
     494-- Name: node_has_content_pkey; Type: CONSTRAINT; Schema: public; Owner: wifidog 
     495-- 
     496 
     497ALTER TABLE ONLY node_has_content 
     498    ADD CONSTRAINT node_has_content_pkey PRIMARY KEY (node_id, content_id); 
     499 
     500 
     501-- 
     502-- TOC entry 48 (OID 214224) 
     503-- Name: network_has_content_pkey; Type: CONSTRAINT; Schema: public; Owner: wifidog 
     504-- 
     505 
     506ALTER TABLE ONLY network_has_content 
     507    ADD CONSTRAINT network_has_content_pkey PRIMARY KEY (network_id, content_id); 
     508 
     509 
     510-- 
     511-- TOC entry 49 (OID 214277) 
     512-- Name: content_group_element_has_allowed_nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: wifidog 
     513-- 
     514 
     515ALTER TABLE ONLY content_group_element_has_allowed_nodes 
     516    ADD CONSTRAINT content_group_element_has_allowed_nodes_pkey PRIMARY KEY (content_group_element_id, node_id); 
     517 
     518 
     519-- 
     520-- TOC entry 51 (OID 214030) 
    269521-- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: wifidog 
    270522-- 
     
    275527 
    276528-- 
    277 -- TOC entry 27 (OID 144866) 
     529-- TOC entry 50 (OID 214034) 
    278530-- Name: administrators_ibfk_1; Type: FK CONSTRAINT; Schema: public; Owner: wifidog 
    279531-- 
     
    284536 
    285537-- 
    286 -- TOC entry 29 (OID 144870) 
     538-- TOC entry 52 (OID 214038) 
    287539-- Name: fk_users; Type: FK CONSTRAINT; Schema: public; Owner: wifidog 
    288540-- 
     
    293545 
    294546-- 
    295 -- TOC entry 30 (OID 144874) 
     547-- TOC entry 53 (OID 214042) 
    296548-- Name: fk_nodes; Type: FK CONSTRAINT; Schema: public; Owner: wifidog 
    297549-- 
     
    302554 
    303555-- 
    304 -- TOC entry 33 (OID 144878) 
     556-- TOC entry 57 (OID 214046) 
    305557-- Name: fk_users; Type: FK CONSTRAINT; Schema: public; Owner: wifidog 
    306558-- 
     
    311563 
    312564-- 
    313 -- TOC entry 34 (OID 144882) 
     565-- TOC entry 58 (OID 214050) 
    314566-- Name: fk_nodes; Type: FK CONSTRAINT; Schema: public; Owner: wifidog 
    315567-- 
     
    320572 
    321573-- 
    322 -- TOC entry 31 (OID 144886) 
     574-- TOC entry 54 (OID 214054) 
    323575-- Name: fk_node_deployment_status; Type: FK CONSTRAINT; Schema: public; Owner: wifidog 
    324576-- 
     
    329581 
    330582-- 
    331 -- TOC entry 32 (OID 144890) 
     583-- TOC entry 55 (OID 214058) 
    332584-- Name: fk_venue_types; Type: FK CONSTRAINT; Schema: public; Owner: wifidog 
    333585-- 
     
    338590 
    339591-- 
     592-- TOC entry 56 (OID 214073) 
     593-- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: wifidog 
     594-- 
     595 
     596ALTER TABLE ONLY users 
     597    ADD CONSTRAINT "$1" FOREIGN KEY (prefered_locale) REFERENCES locales(locales_id) ON UPDATE CASCADE ON DELETE SET NULL; 
     598 
     599 
     600-- 
     601-- TOC entry 59 (OID 214086) 
     602-- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: wifidog 
     603-- 
     604 
     605ALTER TABLE ONLY content 
     606    ADD CONSTRAINT "$1" FOREIGN KEY (title) REFERENCES content(content_id) ON UPDATE CASCADE ON DELETE RESTRICT; 
     607 
     608 
     609-- 
     610-- TOC entry 60 (OID 214090) 
     611-- Name: $2; Type: FK CONSTRAINT; Schema: public; Owner: wifidog 
     612-- 
     613 
     614ALTER TABLE ONLY content 
     615    ADD CONSTRAINT "$2" FOREIGN KEY (description) REFERENCES content(content_id) ON UPDATE CASCADE ON DELETE RESTRICT; 
     616 
     617 
     618-- 
     619-- TOC entry 61 (OID 214094) 
     620-- Name: $3; Type: FK CONSTRAINT; Schema: public; Owner: wifidog 
     621-- 
     622 
     623ALTER TABLE ONLY content 
     624    ADD CONSTRAINT "$3" FOREIGN KEY (project_info) REFERENCES content(content_id) ON UPDATE CASCADE ON DELETE RESTRICT; 
     625 
     626 
     627-- 
     628-- TOC entry 62 (OID 214098) 
     629-- Name: $4; Type: FK CONSTRAINT; Schema: public; Owner: wifidog 
     630-- 
     631 
     632ALTER TABLE ONLY content 
     633    ADD CONSTRAINT "$4" FOREIGN KEY (sponsor_info) REFERENCES content(content_id) ON UPDATE CASCADE ON DELETE RESTRICT; 
     634 
     635 
     636-- 
     637-- TOC entry 63 (OID 214110) 
     638-- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: wifidog 
     639-- 
     640 
     641ALTER TABLE ONLY content_has_owners 
     642    ADD CONSTRAINT "$1" FOREIGN KEY (content_id) REFERENCES content(content_id) ON UPDATE CASCADE ON DELETE CASCADE; 
     643 
     644 
     645-- 
     646-- TOC entry 64 (OID 214114) 
     647-- Name: $2; Type: FK CONSTRAINT; Schema: public; Owner: wifidog 
     648-- 
     649 
     650ALTER TABLE ONLY content_has_owners 
     651    ADD CONSTRAINT "$2" FOREIGN KEY (user_id) REFERENCES users(user_id) ON UPDATE CASCADE ON DELETE CASCADE; 
     652 
     653 
     654-- 
     655-- TOC entry 65 (OID 214126) 
     656-- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: wifidog 
     657-- 
     658 
     659ALTER TABLE ONLY langstring_entries 
     660    ADD CONSTRAINT "$1" FOREIGN KEY (langstrings_id) REFERENCES content(content_id) ON UPDATE CASCADE ON DELETE CASCADE; 
     661 
     662 
     663-- 
     664-- TOC entry 66 (OID 214130) 
     665-- Name: $2; Type: FK CONSTRAINT; Schema: public; Owner: wifidog 
     666-- 
     667 
     668ALTER TABLE ONLY langstring_entries 
     669    ADD CONSTRAINT "$2" FOREIGN KEY (locales_id) REFERENCES locales(locales_id) ON UPDATE CASCADE ON DELETE RESTRICT; 
     670 
     671 
     672-- 
     673-- TOC entry 67 (OID 214141) 
     674-- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: wifidog 
     675-- 
     676 
     677ALTER TABLE ONLY content_group 
     678    ADD CONSTRAINT "$1" FOREIGN KEY (content_group_id) REFERENCES content(content_id) ON UPDATE CASCADE ON DELETE CASCADE; 
     679 
     680 
     681-- 
     682-- TOC entry 68 (OID 214153) 
     683-- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: wifidog 
     684-- 
     685 
     686ALTER TABLE ONLY content_group_element 
     687    ADD CONSTRAINT "$1" FOREIGN KEY (content_group_element_id) REFERENCES content(content_id) ON UPDATE CASCADE ON DELETE CASCADE; 
     688 
     689 
     690-- 
     691-- TOC entry 69 (OID 214157) 
     692-- Name: $2; Type: FK CONSTRAINT; Schema: public; Owner: wifidog 
     693-- 
     694 
     695ALTER TABLE ONLY content_group_element 
     696    ADD CONSTRAINT "$2" FOREIGN KEY (content_group_id) REFERENCES content_group(content_group_id) ON UPDATE CASCADE ON DELETE CASCADE; 
     697 
     698 
     699-- 
     700-- TOC entry 70 (OID 214161) 
     701-- Name: $3; Type: FK CONSTRAINT; Schema: public; Owner: wifidog 
     702-- 
     703 
     704ALTER TABLE ONLY content_group_element 
     705    ADD CONSTRAINT "$3" FOREIGN KEY (displayed_content_id) REFERENCES content(content_id) ON UPDATE CASCADE ON DELETE CASCADE; 
     706 
     707 
     708-- 
     709-- TOC entry 71 (OID 214174) 
     710-- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: wifidog 
     711-- 
     712 
     713ALTER TABLE ONLY content_group_element_portal_display_log 
     714    ADD CONSTRAINT "$1" FOREIGN KEY (user_id) REFERENCES users(user_id) ON UPDATE CASCADE ON DELETE CASCADE; 
     715 
     716 
     717-- 
     718-- TOC entry 72 (OID 214178) 
     719-- Name: $2; Type: FK CONSTRAINT; Schema: public; Owner: wifidog 
     720-- 
     721 
     722ALTER TABLE ONLY content_group_element_portal_display_log 
     723    ADD CONSTRAINT "$2" FOREIGN KEY (content_group_element_id) REFERENCES content_group_element(content_group_element_id) ON UPDATE CASCADE ON DELETE CASCADE; 
     724 
     725 
     726-- 
     727-- TOC entry 73 (OID 214182) 
     728-- Name: $3; Type: FK CONSTRAINT; Schema: public; Owner: wifidog 
     729-- 
     730 
     731ALTER TABLE ONLY content_group_element_portal_display_log 
     732    ADD CONSTRAINT "$3" FOREIGN KEY (node_id) REFERENCES nodes(node_id) ON UPDATE CASCADE ON DELETE CASCADE; 
     733 
     734 
     735-- 
     736-- TOC entry 74 (OID 214194) 
     737-- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: wifidog 
     738-- 
     739 
     740ALTER TABLE ONLY user_has_content 
     741    ADD CONSTRAINT "$1" FOREIGN KEY (user_id) REFERENCES users(user_id) ON UPDATE CASCADE ON DELETE CASCADE; 
     742 
     743 
     744-- 
     745-- TOC entry 75 (OID 214198) 
     746-- Name: $2; Type: FK CONSTRAINT; Schema: public; Owner: wifidog 
     747-- 
     748 
     749ALTER TABLE ONLY user_has_content 
     750    ADD CONSTRAINT "$2" FOREIGN KEY (content_id) REFERENCES content(content_id) ON UPDATE CASCADE ON DELETE CASCADE; 
     751 
     752 
     753-- 
     754-- TOC entry 76 (OID 214210) 
     755-- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: wifidog 
     756-- 
     757 
     758ALTER TABLE ONLY node_has_content 
     759    ADD CONSTRAINT "$1" FOREIGN KEY (node_id) REFERENCES nodes(node_id) ON UPDATE CASCADE ON DELETE CASCADE; 
     760 
     761 
     762-- 
     763-- TOC entry 77 (OID 214214) 
     764-- Name: $2; Type: FK CONSTRAINT; Schema: public; Owner: wifidog 
     765-- 
     766 
     767ALTER TABLE ONLY node_has_content 
     768    ADD CONSTRAINT "$2" FOREIGN KEY (content_id) REFERENCES content(content_id) ON UPDATE CASCADE ON DELETE CASCADE; 
     769 
     770 
     771-- 
     772-- TOC entry 78 (OID 214226) 
     773-- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: wifidog 
     774-- 
     775 
     776ALTER TABLE ONLY network_has_content 
     777    ADD CONSTRAINT "$1" FOREIGN KEY (content_id) REFERENCES content(content_id) ON UPDATE CASCADE ON DELETE CASCADE; 
     778 
     779 
     780-- 
     781-- TOC entry 79 (OID 214279) 
     782-- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: wifidog 
     783-- 
     784 
     785ALTER TABLE ONLY content_group_element_has_allowed_nodes 
     786    ADD CONSTRAINT "$1" FOREIGN KEY (content_group_element_id) REFERENCES content_group_element(content_group_element_id) ON UPDATE CASCADE ON DELETE CASCADE; 
     787 
     788 
     789-- 
     790-- TOC entry 80 (OID 214283) 
     791-- Name: $2; Type: FK CONSTRAINT; Schema: public; Owner: wifidog 
     792-- 
     793 
     794ALTER TABLE ONLY content_group_element_has_allowed_nodes 
     795    ADD CONSTRAINT "$2" FOREIGN KEY (node_id) REFERENCES nodes(node_id) ON UPDATE CASCADE ON DELETE CASCADE; 
     796 
     797 
     798-- 
    340799-- TOC entry 3 (OID 2200) 
    341800-- Name: SCHEMA public; Type: COMMENT; Schema: -; Owner: postgres 
  • trunk/wifidog-auth/wifidog/admin/admin_common.php

    r400 r545  
    2727require_once BASEPATH.'classes/Security.php'; 
    2828 
    29 $security = new Security(); 
    30 $security->requireAdmin(); 
    3129?> 
  • trunk/wifidog-auth/wifidog/admin/hotspot.php

    r512 r545  
    2525define('BASEPATH','../'); 
    2626require_once 'admin_common.php'; 
     27 
     28$security = new Security(); 
     29$security->requireAdmin(); 
     30 
    2731require_once BASEPATH.'classes/Node.php'; 
    2832require_once BASEPATH.'classes/User.php'; 
  • trunk/wifidog-auth/wifidog/admin/hotspot_log.php

    r401 r545  
    2525define('BASEPATH','../'); 
    2626require_once 'admin_common.php'; 
     27 
     28$security = new Security(); 
     29$security->requireAdmin(); 
    2730 
    2831$db->ExecSql("SELECT node_id, name, (NOW()-last_heartbeat_timestamp) AS since_last_heartbeat, last_heartbeat_ip, CASE WHEN ((NOW()-last_heartbeat_timestamp) < interval '5 minutes') THEN true ELSE false END AS is_up, creation_date FROM nodes ORDER BY node_id", $node_results, false); 
  • trunk/wifidog-auth/wifidog/admin/hotspot_owner.php

    r512 r545  
    2727define('BASEPATH','../'); 
    2828require_once 'admin_common.php'; 
     29 
     30$security = new Security(); 
     31$security->requireAdmin(); 
     32 
    2933require_once BASEPATH.'classes/Node.php'; 
    3034require_once BASEPATH.'classes/User.php'; 
  • trunk/wifidog-auth/wifidog/admin/import_user_database.php

    r512 r545  
    2424define('BASEPATH','../'); 
    2525require_once 'admin_common.php'; 
     26 
     27$security = new Security(); 
     28$security->requireAdmin(); 
    2629 
    2730/** Affiche les informations sur le fichier envoy� par le client 
  • trunk/wifidog-auth/wifidog/admin/index.php

    r398 r545  
    2525define('BASEPATH','../'); 
    2626require_once 'admin_common.php'; 
     27require_once BASEPATH.'classes/Content.php'; 
    2728 
    2829$smarty->display("admin/templates/main.html"); 
  • trunk/wifidog-auth/wifidog/admin/online_users.php

    r409 r545  
    2626require_once BASEPATH.'classes/Node.php'; 
    2727 
     28$security = new Security(); 
     29$security->requireAdmin(); 
     30 
    2831try { 
    2932    $online_users = Node::getAllOnlineUsers(); 
  • trunk/wifidog-auth/wifidog/admin/templates/main.html

    r394 r545  
    11{include file="templates/header.html"} 
    22 
    3 {"For now, you need to be logged in at a hotspot or to fake a login from one of the HotSpot login pages to have your administrative clearance recognised."|_} 
    43<ul> 
    54<li><a href='user_log.php'>{"User logs"|_}</a></li> 
     
    109<li><a href='hotspot.php'>{"Hotspot creation and configuration"|_}</a> - Beta</li> 
    1110<li><a href='owner_sendfiles.php'>{"Hotspot owner administration"|_}</a> - Beta</li> 
     11<li><a href='content_admin.php'>{"Content administration"|_}</a> - Beta</li> 
    1212</ul> 
    1313 
  • trunk/wifidog-auth/wifidog/admin/user_log.php

    r516 r545  
    2525define('BASEPATH', '../'); 
    2626require_once 'admin_common.php'; 
     27 
     28$security = new Security(); 
     29$security->requireAdmin(); 
     30 
    2731require_once BASEPATH.'classes/User.php'; 
    2832 
  • trunk/wifidog-auth/wifidog/admin/user_stats.php

    r411 r545  
    2525define('BASEPATH','../'); 
    2626require_once 'admin_common.php'; 
     27 
     28$security = new Security(); 
     29$security->requireAdmin(); 
     30 
    2731require_once BASEPATH.'classes/Statistics.php'; 
    2832 
  • trunk/wifidog-auth/wifidog/classes/AbstractDbPostgres.php

    r402 r545  
    317317                                echo "<p>ExecuterSqlUpdate(): DEBUG: ".pg_affected_rows($result)." rang�e(s) affect�e(s)</p><hr />\n"; 
    318318                        } 
    319                         return $result; 
    320                 } 
     319                } 
     320                return $result; 
    321321        } 
    322322 
  • trunk/wifidog-auth/wifidog/classes/Node.php

    r516 r545  
    9999    $this->mRow = $row; 
    100100    $this->mId = $row['node_id']; 
    101   }                             //End class 
     101  }      
    102102 
    103103  /** Return the name of the node  
  • trunk/wifidog-auth/wifidog/classes/Security.php

    r516 r545  
    2828 */ 
    2929class Security { 
    30   var $session; 
     30  private $session; 
    3131 
    3232  function Security() { 
  • trunk/wifidog-auth/wifidog/classes/User.php

    r532 r545  
    4141                return $object; 
    4242        } 
    43  
     43         
     44        /** Instantiate the current user 
     45         * @return a User object, or null if there was an error 
     46         */ 
     47        public static function getCurrentUser() 
     48        { 
     49                require_once BASEPATH.'classes/Session.php'; 
     50                $session = new Session(); 
     51                $user=null; 
     52                try 
     53                { 
     54                        $user = new User($session->get(SESS_USER_ID_VAR)); 
     55                } 
     56                catch(Exception $e) 
     57                { 
     58                        /**If any problem occurs, the user should be considered logged out*/ 
     59                        $session->set(SESS_USER_ID_VAR, null); 
     60                } 
     61                return $user; 
     62        } 
     63         
    4464        /** Instantiate a user object  
    4565         * @param $username The username of the user 
     
    240260        } 
    241261 
     262/**What locale (language) does the user prefer? 
     263 * @todo Save in the database */ 
     264        public function getPreferedLocale() 
     265        { 
     266                global $session; 
     267                //return $this->mRow['prefered_locale']; 
     268                $locale = $session->get('SESS_LANGUAGE_VAR'); 
     269                if(empty($locale)) 
     270                { 
     271                        $locale=DEFAULT_LANG; 
     272                } 
     273                return $locale; 
     274        } 
     275 
    242276        public function getPasswordHash() 
    243277        { 
  • trunk/wifidog-auth/wifidog/config.php

    r530 r545  
    77 * 
    88 *     $Log$ 
     9 *     Revision 1.31  2005/04/14 15:12:35  benoitg 
     10 *     2005-04-14 Benoit Gr�goire  <bock@step.polymtl.ca> 
     11 *      * First part of the future content delivery infrastructure.  Many files added. 
     12 * 
    913 *     Revision 1.30  2005/04/01 21:38:23  fproulx 
    1014 *     2005-04-01 Francois Proulx  <francois.proulx@gmail.com> 
     
    225229define('DEFAULT_NODE_ID', 'default'); 
    226230 define('DEFAULT_LANG', 'fr_FR'); 
    227   
    228 /*** FOR TESTING ONLY *** UNCOMMENT THE NEXT LINES 
    229  *** WHEN READY TO TEST ************************** 
    230  *** This code define two (2) global variables: 
    231  *** HTTP_HEADER_LANG will return the language of the 
    232  *** user's browser stripped from its country code. For 
    233  *** instance, if the HTTP_ACCEPT_LANGUAGE header is  
    234  *** something like 'en-ca, en-us, en, fr-ca, fr', the 
    235  *** first two characters is picked and used as language 
    236  *** selector. 
    237  *** The other global variable is the FILE_NAME_SUFFIX. 
    238  *** for english it is empty, for any other language it is 
    239  *** the two character code used to set the language. When 
    240  *** choosing the template (let's say login.html), we simply 
    241  *** have to replace in the code and add  
    242  *** "login.html".$FILE_NAME_SUFFIX to get the right  
    243  *** template (assuming that login.html.fr exists for 
    244  *** French). 
    245 if (if (substr($_SERVER["HTTP_ACCEPT_LANGUAGE"],0,2) == "en") { 
    246     define('HTTP_HEADER_LANG', 'en'); 
    247     define('FILE_NAME_SUFFIX', '');    
    248 } else { 
    249     define('HTTP_HEADER_LANG', substr($_SERVER["HTTP_ACCEPT_LANGUAGE"],0,2)); 
    250     define('FILE_NAME_SUFFIX', substr($_SERVER["HTTP_ACCEPT_LANGUAGE"],0,2)); 
    251 } 
    252  
    253 */  
     231 
     232 
    254233} 
    255234?> 
  • trunk/wifidog-auth/wifidog/include/common_interface.php

    r530 r545  
    4242try 
    4343{ 
    44   $current_user = new User($session->get(SESS_USER_ID_VAR)); 
    45   $smarty->assign("auth_user", $current_user->getUsername()); 
     44  $username = null; 
     45  $current_user = User::getCurrentUser(); 
     46  if($current_user!=null) 
     47  {$username=$current_user->getUsername(); 
     48  } 
     49   
     50  $smarty->assign("auth_user", $username); 
    4651} 
    4752catch (Exception $e)  
  • trunk/wifidog-auth/wifidog/include/schema_validate.php

    r534 r545  
    2929require_once BASEPATH.'classes/AbstractDb.php'; 
    3030require_once BASEPATH.'classes/Session.php'; 
    31 define('REQUIRED_SCHEMA_VERSION', 5); 
     31define('REQUIRED_SCHEMA_VERSION', 6); 
    3232 
    3333/** Check that the database schema is up to date.  If it isn't, offer to update it. */ 
     
    123123                $schema_version = $row['value']; 
    124124                $sql = ''; 
    125                 if ($schema_version < 2) 
    126                 { 
    127                         $new_schema_version = 2; 
    128                         echo "<h2>Preparing SQL statements to update schema to version  $new_schema_version</h2>"; 
    129                         $sql .= "UPDATE schema_info SET value='$new_schema_version' WHERE tag='schema_version';\n"; 
     125                $new_schema_version = 2; 
     126                if ($schema_version < $new_schema_version) 
     127                { 
     128 
     129                        echo "<h2>Preparing SQL statements to update schema to version  $new_schema_version</h2>"; 
     130                        $sql .= "\n\nUPDATE schema_info SET value='$new_schema_version' WHERE tag='schema_version';\n"; 
    130131                        $sql .= "ALTER TABLE users ADD COLUMN username text;\n"; 
    131132                        $sql .= "ALTER TABLE users ADD COLUMN account_origin text;\n"; 
     
    139140                        $sql .= "CREATE UNIQUE INDEX idx_unique_email_and_account_origin ON users USING btree (email, account_origin);\n"; 
    140141                } 
    141                 else 
    142                         if ($schema_version < 3) 
    143                         { 
    144                                 $new_schema_version = 3; 
    145                                 echo "<h2>Preparing SQL statements to update schema to version  $new_schema_version</h2>"; 
    146                                 $sql .= "UPDATE schema_info SET value='$new_schema_version' WHERE tag='schema_version';\n"; 
    147                                 $sql .= "DROP INDEX idx_unique_email_and_account_origin;\n"; 
    148                                 $sql .= "ALTER TABLE users DROP CONSTRAINT check_email_not_empty;\n"; 
    149                         } //  $db -> ExecSqlUpdate("BEGIN;\n$sql\nROLLBACK;\n", true); 
    150  
    151                 else 
    152                         if ($schema_version < 4) 
    153                         { 
    154                                 $new_schema_version = 4; 
    155                                 echo "<h2>Preparing SQL statements to update schema to version  $new_schema_version</h2>"; 
    156                                 $sql .= "UPDATE schema_info SET value='$new_schema_version' WHERE tag='schema_version';\n"; 
    157                                 $sql .= "ALTER TABLE users ALTER COLUMN account_origin SET NOT NULL;\n"; 
    158                                 $sql .= "ALTER TABLE users ADD CONSTRAINT check_account_origin_not_empty CHECK (account_origin::text <> ''::text);\n"; 
    159                         } 
    160                         else 
    161                                 if ($schema_version < 5) 
    162                                 { 
    163                                         $new_schema_version = 5; 
    164                                         echo "<h1>Recoding database from ISO-8859-1 to UTF-8</h1>"; 
    165                                         echo "<h1>YOU MUST EXECUTE THESE COMMANDS IN COMMAND_LINE</h1>"; 
    166                                         echo "pg_dump wifidog -U wifidog > wifidog_dump.sql<br>"; 
    167                                         echo "dropdb wifidog -U wifidog <br>"; 
    168                                         echo "createdb --encoding=UNICODE --template = template0 -U wifidog wifidog<br>"; 
    169                                         echo "psql wifidog -U wifidog < wifidog_dump.sql<br><br>"; 
    170                                         echo "THEN use psql to modify to schema_version manually<br><br>"; 
    171                                         echo "UPDATE schema_info SET value='$new_schema_version' WHERE tag='schema_version'<p>"; 
    172                                         exit; 
    173                                 } 
     142 
     143                $new_schema_version = 3; 
     144                if ($schema_version < $new_schema_version) 
     145                { 
     146                        echo "<h2>Preparing SQL statements to update schema to version  $new_schema_version</h2>"; 
     147                        $sql .= "\n\nUPDATE schema_info SET value='$new_schema_version' WHERE tag='schema_version';\n"; 
     148                        $sql .= "DROP INDEX idx_unique_email_and_account_origin;\n"; 
     149                        $sql .= "ALTER TABLE users DROP CONSTRAINT check_email_not_empty;\n"; 
     150                } 
     151 
     152                $new_schema_version = 4; 
     153                if ($schema_version < $new_schema_version) 
     154                { 
     155                        echo "<h2>Preparing SQL statements to update schema to version  $new_schema_version</h2>"; 
     156                        $sql .= "\n\nUPDATE schema_info SET value='$new_schema_version' WHERE tag='schema_version';\n"; 
     157                        $sql .= "ALTER TABLE users ALTER COLUMN account_origin SET NOT NULL;\n"; 
     158                        $sql .= "ALTER TABLE users ADD CONSTRAINT check_account_origin_not_empty CHECK (account_origin::text <> ''::text);\n"; 
     159 
     160                        //We must skip all other updates because schema 5 must be manually updated: 
     161                        $schema_version = 1000000; 
     162                } 
     163 
     164                $new_schema_version = 5; 
     165                if ($schema_version == $new_schema_version -1) 
     166                { 
     167                        echo "<h1>Recoding database from ISO-8859-1 to UTF-8</h1>"; 
     168                        echo "<h1>YOU MUST EXECUTE THESE COMMANDS FROM THE COMMAND_LINE:</h1>"; 
     169                        echo "pg_dump wifidog -U wifidog > wifidog_dump.sql;<br>"; 
     170                        echo "dropdb wifidog -U wifidog; <br>"; 
     171                        echo "createdb --encoding=UNICODE --template=template0 -U wifidog wifidog;<br>"; 
     172                        echo "psql wifidog -U wifidog < wifidog_dump.sql;<br>\n"; 
     173                        echo " (Note: You may ignore the following errors:  \"ERROR:  permission denied to set session authorization\" and \"ERROR:  must be owner of schema public\")<br>"; 
     174                        echo "psql wifidog -U wifidog -c \"UPDATE schema_info SET value='$new_schema_version' WHERE tag='schema_version'\";<br>"; 
     175                        exit; 
     176                } 
     177                $new_schema_version = 6; 
     178                if ($schema_version < $new_schema_version) 
     179                { 
     180 
     181                        echo "<h2>Preparing SQL statements to update schema to version  $new_schema_version</h2>"; 
     182                        $sql .= "\n\nUPDATE schema_info SET value='$new_schema_version' WHERE tag='schema_version';\n"; 
     183                        $sql .= "CREATE TABLE locales ( \n"; 
     184                        $sql .= "  locales_id text PRIMARY KEY \n"; 
     185                        $sql .= "  ); \n"; 
     186                        $sql .= "  INSERT INTO locales VALUES ('fr'); \n"; 
     187                        $sql .= "  INSERT INTO locales VALUES ('en'); \n"; 
     188                        $sql .= "ALTER TABLE users ADD COLUMN never_show_username bool;\n"; 
     189                        $sql .= "ALTER TABLE users ALTER COLUMN never_show_username SET DEFAULT FALSE;\n"; 
     190                        $sql .= "ALTER TABLE users ADD COLUMN real_name text;\n"; 
     191                        $sql .= "ALTER TABLE users ALTER COLUMN real_name SET DEFAULT NULL;\n"; 
     192                        $sql .= "ALTER TABLE users ADD COLUMN website text;\n"; 
     193                        $sql .= "ALTER TABLE users ALTER COLUMN website SET DEFAULT NULL;\n"; 
     194                        $sql .= "ALTER TABLE users ADD COLUMN prefered_locale text REFERENCES locales ON DELETE SET NULL ON UPDATE CASCADE;\n"; 
     195 
     196                        $sql .= "                        
     197                        CREATE TABLE content 
     198                        ( 
     199                        content_id text NOT NULL PRIMARY KEY, 
     200                        content_type text NOT NULL  CONSTRAINT content_type_not_empty_string CHECK (content_type != ''), 
     201                        title text REFERENCES content ON DELETE RESTRICT ON UPDATE CASCADE, 
     202                        description text REFERENCES content ON DELETE RESTRICT ON UPDATE CASCADE, 
     203                        project_info text REFERENCES content ON DELETE RESTRICT ON UPDATE CASCADE, 
     204                        sponsor_info text REFERENCES content ON DELETE RESTRICT ON UPDATE CASCADE, 
     205                        creation_timestamp timestamp DEFAULT now() 
     206                        ); 
     207 
     208                        CREATE TABLE content_has_owners 
     209                        ( 
     210                        content_id text NOT NULL REFERENCES content ON DELETE CASCADE ON UPDATE CASCADE, 
     211                        user_id text NOT NULL REFERENCES users ON DELETE CASCADE ON UPDATE CASCADE, 
     212                        is_author bool NOT NULL, 
     213                        owner_since timestamp DEFAULT now(), 
     214                        PRIMARY KEY  (content_id, user_id) 
     215                        ); 
     216                         
     217                        CREATE TABLE langstring_entries ( 
     218                          langstring_entries_id text NOT NULL PRIMARY KEY, 
     219                          langstrings_id text REFERENCES content ON DELETE CASCADE ON UPDATE CASCADE, 
     220                          locales_id text REFERENCES locales ON DELETE RESTRICT ON UPDATE CASCADE, 
     221                          value text  DEFAULT '' 
     222                        ); 
     223                         
     224                        CREATE TABLE content_group ( 
     225                          content_group_id text NOT NULL PRIMARY KEY REFERENCES content ON DELETE CASCADE ON UPDATE CASCADE, 
     226                          is_artistic_content bool NOT NULL DEFAULT FALSE, 
     227                          is_locative_content bool NOT NULL DEFAULT FALSE, 
     228                          content_selection_mode text 
     229                        ); 
     230                         
     231                        CREATE TABLE content_group_element ( 
     232                          content_group_element_id text NOT NULL PRIMARY KEY REFERENCES content ON DELETE CASCADE ON UPDATE CASCADE, 
     233                          content_group_id text NOT NULL REFERENCES content_group ON DELETE CASCADE ON UPDATE CASCADE, 
     234                          display_order integer DEFAULT '1', 
     235                          displayed_content_id text REFERENCES content ON DELETE CASCADE ON UPDATE CASCADE, 
     236                          force_only_allowed_node bool 
     237                        ); 
     238                        CREATE INDEX idx_content_group_element_content_group_id ON content_group_element (content_group_id); 
     239                         
     240                        CREATE TABLE content_group_element_has_allowed_nodes 
     241                        ( 
     242                        content_group_element_id text NOT NULL REFERENCES content_group_element ON DELETE CASCADE ON UPDATE CASCADE, 
     243                        node_id text NOT NULL REFERENCES nodes ON DELETE CASCADE ON UPDATE CASCADE, 
     244                        allowed_since timestamp DEFAULT now(), 
     245                        PRIMARY KEY  (content_group_element_id, node_id) 
     246                        ); 
     247                         
     248                        CREATE TABLE content_group_element_portal_display_log ( 
     249                          user_id text NOT NULL REFERENCES users ON DELETE CASCADE ON UPDATE CASCADE, 
     250                          content_group_element_id text NOT NULL REFERENCES content_group_element ON DELETE CASCADE ON UPDATE CASCADE, 
     251                          display_timestamp timestamp NOT NULL DEFAULT now(), 
     252                          node_id text REFERENCES nodes ON DELETE CASCADE ON UPDATE CASCADE, 
     253                          PRIMARY KEY  (user_id,content_group_element_id, display_timestamp) 
     254                        ); 
     255                         
     256                        CREATE TABLE user_has_content ( 
     257                          user_id text NOT NULL REFERENCES users ON DELETE CASCADE ON UPDATE CASCADE, 
     258                          content_id text NOT NULL REFERENCES content ON DELETE CASCADE ON UPDATE CASCADE, 
     259                          subscribe_timestamp timestamp NOT NULL DEFAULT now(), 
     260                          PRIMARY KEY  (user_id,content_id) 
     261                        ); 
     262                         
     263                        CREATE TABLE node_has_content ( 
     264                          node_id text NOT NULL REFERENCES nodes ON DELETE CASCADE ON UPDATE CASCADE, 
     265                          content_id text NOT NULL REFERENCES content ON DELETE CASCADE ON UPDATE CASCADE, 
     266                          subscribe_timestamp timestamp NOT NULL DEFAULT now(), 
     267                          PRIMARY KEY  (node_id,content_id) 
     268                        ); 
     269                         
     270                        CREATE TABLE network_has_content ( 
     271                          network_id text NOT NULL, 
     272                          content_id text NOT NULL REFERENCES content ON DELETE CASCADE ON UPDATE CASCADE, 
     273                          subscribe_timestamp timestamp NOT NULL DEFAULT now(), 
     274                          PRIMARY KEY  (network_id,content_id) 
     275                        );"; 
     276                } 
     277                 
     278                /* 
     279                $new_schema_version = 7; 
     280                if ($schema_version < $new_schema_version) 
     281                { 
     282 
     283                        echo "<h2>Preparing SQL statements to update schema to version  $new_schema_version</h2>"; 
     284                        $sql .= "\n\nUPDATE schema_info SET value='$new_schema_version' WHERE tag='schema_version';\n"; 
     285                                        } 
     286                                        */ 
    174287                $db->ExecSqlUpdate("BEGIN;\n$sql\nCOMMIT;\n", true); 
    175288                echo "</html></head>"; 
     
    178291} 
    179292?> 
     293 
     294 
  • trunk/wifidog-auth/wifidog/local_content/default/stylesheet.css

    r452 r545  
    163163#std_table td.item { font-weight: bold; } 
    164164 
     165/* The content container */ 
     166.content { border: 2px solid gray;  
     167                        width:auto;} 
     168/* The admin container */ 
     169.admin_container { border: 1px solid grey;  
     170margin: 3px; 
     171width:auto; } 
     172 /* The class name of the container */ 
     173.admin_class { /*float: left;*/  
     174                                          color:grey; 
     175                                                border: none; 
     176display: none; 
     177} 
     178.admin_section_container { border: 2px solid blue;  
     179margin: 3px; 
     180width:auto; } 
     181.admin_section_title { font-weight: bold;  } 
     182.admin_section_tools { clear: none;} 
     183 
     184.user_ui_container{ border: none;  } 
     185.user_ui_object_class{ display: none;  } 
    165186{/literal}