diff --git a/sql/schema.sql b/sql/schema.sql index dbabf67..0cb39b4 100644 --- a/sql/schema.sql +++ b/sql/schema.sql @@ -123,7 +123,7 @@ comment on column "action"."apply_object" is 'column specifies whether an acti create table "stat"( "uid" serial not null, "owner" int not null default 1, - "group" int not null default 2, -- 1 is a root usergroup, 2 is 'users' set as default + "group" int not null default 2, -- 1 is a root usergroup, 2 is 'users' set as default "unixperms" int not null default unix_to_numeric('764'), "status" int not null default 0, "name" text NOT NULL check( length(name) < 4096 ), @@ -175,12 +175,11 @@ create table "user" ( "config" json DEFAULT ('{}'), "avatar" text, "email" varchar(256) not null, - "status" integer not null, constraint "pk_user_uid" primary key ("uid"), constraint "ux_user_name" unique ("name"), constraint "ux_user_email" unique ("email") ) INHERITS (stat); -create trigger update_user_last_update before update on "user" FOR EACH ROW EXECUTE PROCEDURE last_update_column(); +create trigger "update_user_last_update" before update on "user" FOR EACH ROW EXECUTE PROCEDURE last_update_column(); create table "user_action" ( @@ -261,7 +260,7 @@ create or replace function update_category_parent_path() returns trigger as $$ IF NEW.parent_id IS NULL THEN NEW.parent_path = 'root'::ltree; ELSEIF TG_OP = 'INSERT' OR OLD.parent_id IS NULL OR OLD.parent_id != NEW.parent_id THEN - SELECT parent_path || uid::text FROM categories WHERE uid = NEW.parent_id INTO path; + SELECT parent_path || uid::text FROM "category" WHERE uid = NEW.parent_id INTO path; IF path IS NULL THEN RAISE exception 'Invalid parent_uid %', NEW.parent_id; END IF; @@ -281,7 +280,6 @@ create table "category"( ) INHERITS (stat); create index "ix_category_parent_path" on "category" using GIST ("parent_path"); create unique index "ux_category_name" on "category" ( "parent_id", "name" ); -create unique index "ux_category_parent" on "category" ( "parent_id", "uid" ); create trigger "update_category_last_update" before update on "category" FOR EACH ROW EXECUTE PROCEDURE last_update_column(); create trigger "update_category_parent_path" before insert or update on "category" FOR EACH ROW EXECUTE PROCEDURE update_category_parent_path(); comment on table "category" is 'categories of items'; @@ -289,6 +287,7 @@ comment on column "category"."parent_id" is ''; comment on column "category"."description" is ''; comment on column "category"."parent_path" is ''; + /* create table "measurands"( "id" serial not null unique primary key, @@ -354,13 +353,13 @@ comment on column parameters.ptype IS '''stored'' parameter is a parameter whic */ create table "item"( - "category_id" int NOT NULL, - "symbol" text NOT NULL, - "original_symbol" text, - "producer" text, --- name_scope VARCHAR(64) DEFAULT 'std' NOT NULL, - "attributes" jsonb NOT NULL DEFAULT('{}'), - description TEXT, + "category_id" int NOT NULL, + "symbol" text NOT NULL, + "original_symbol" text, + "producer" text, + "visibility" VARCHAR(64) DEFAULT 'global' NOT NULL, + "attributes" jsonb NOT NULL DEFAULT('{}'), + "description" TEXT, constraint "pk_items" primary key ("uid"), constraint "fk_item_category" foreign key ("category_id") references "category"("uid") on delete cascade deferrable initially deferred, constraint "fk_item_user" foreign key ("owner") REFERENCES "user"("uid") deferrable initially IMMEDIATE @@ -368,6 +367,9 @@ create table "item"( create index "ix_item_attributes" on "item" USING GIN ("attributes"); create unique index "ux_item" on "item"("name", "symbol"); create trigger update_item_last_update before update on item FOR EACH ROW EXECUTE PROCEDURE last_update_column(); +comment on table "item" is ''; +comment on column "item"."category_id" is ''; +comment on column "item"."visibility" is ''; create table "inventory"( diff --git a/src/app/main.cpp b/src/app/main.cpp index 48064b8..b486443 100644 --- a/src/app/main.cpp +++ b/src/app/main.cpp @@ -87,7 +87,7 @@ class AuthApplication : public Wt::WApplication { // Create a navigation bar with a link to a web page. Wt::WNavigationBar * navigation = new Wt::WNavigationBar(container); - navigation->setTitle("Corpy Inc.", "http://www.google.com/search?q=corpy+inc"); + navigation->setTitle("eedb", "http://eedb.pl"); navigation->setResponsive(true); Wt::WStackedWidget * contentsStack = new Wt::WStackedWidget(container); @@ -192,8 +192,6 @@ class AuthApplication : public Wt::WApplication { std::unique_ptr< eedb::auth::PgUserAuth > userDatabase_; Wt::Auth::Login login_; Wt::Auth::AuthWidget * _loginWidget; - Wt::WWidget * homePage_; - Wt::WContainerWidget * sideBarContent_; }; Wt::WApplication * createApplication(const Wt::WEnvironment & env) { diff --git a/src/eedb/widgets/LoginWidget.cpp b/src/eedb/widgets/LoginWidget.cpp new file mode 100644 index 0000000..e69de29 diff --git a/src/eedb/widgets/LoginWidget.hpp b/src/eedb/widgets/LoginWidget.hpp new file mode 100644 index 0000000..e69de29 diff --git a/src/eedb/widgets/MainWindow.cpp b/src/eedb/widgets/MainWindow.cpp index e69de29..67d44b1 100644 --- a/src/eedb/widgets/MainWindow.cpp +++ b/src/eedb/widgets/MainWindow.cpp @@ -0,0 +1,3 @@ +#include + +namespace eedb {} diff --git a/src/eedb/widgets/MainWindow.hpp b/src/eedb/widgets/MainWindow.hpp index 78aa425..4e51824 100644 --- a/src/eedb/widgets/MainWindow.hpp +++ b/src/eedb/widgets/MainWindow.hpp @@ -1,72 +1,6 @@ #include namespace eedb { -class Home : public WWidget { - public: - Home(const WEnvironment & env, Wt::Dbo::SqlConnectionPool & blogDb, const std::string & title, const std::string & resourceBundle, - const std::string & cssPath); - - virtual ~Home(); - - void googleAnalyticsLogger(); - - protected: - virtual WWidget * examples() = 0; - virtual WWidget * createQuoteForm() = 0; - virtual WWidget * sourceViewer(const std::string & deployPath) = 0; - virtual std::string filePrefix() const = 0; - - void init(); - - void addLanguage(const Lang & l) { - languages.push_back(l); - } - WWidget * linkSourceBrowser(const std::string & examplePath); - - WTabWidget * examplesMenu_; - - WString tr(const char * key); - std::string href(const std::string & url, const std::string & description); - - WTable * releases_; - void readReleases(WTable * releaseTable); - - private: - Wt::Dbo::SqlConnectionPool & blogDb_; - WWidget * homePage_; - WWidget * sourceViewer_; - - WStackedWidget * contents_; - - void createHome(); - - WWidget * introduction(); - WWidget * blog(); - WWidget * status(); - WWidget * features(); - WWidget * documentation(); - WWidget * community(); - WWidget * otherLanguage(); - WWidget * download(); - WWidget * quoteForm(); - - WMenu * mainMenu_; - - int language_; - - void readNews(WTable * newsTable, const std::string & newsfile); - - WWidget * wrapView(WWidget * (Home::*createFunction)()); - - void updateTitle(); - void setLanguage(int language); - void setLanguageFromPath(); - void setup(); - void logInternalPath(const std::string & path); - void chatSetUser(const WString & name); - - WContainerWidget * sideBarContent_; - - std::vector< Lang > languages; +class Home : public Wt::WWidget { }; }