DBIx::HTMLView

DBIx::HTMLView is a Perl module for creating web userinterfaces to DBI databases.
Download

DBIx::HTMLView Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Hakan Ardo
  • Publisher web site:
  • http://search.cpan.org/~hakanardo/DBIx-HTMLView-0.1/HTMLView.pm

DBIx::HTMLView Tags


DBIx::HTMLView Description

DBIx::HTMLView is a Perl module for creating web userinterfaces to DBI databases. DBIx::HTMLView is a Perl module for creating web userinterfaces to DBI databases.SYNOPSISrequire DBIx::HTMLView;# Initiate interface object my $v=new HTMLView($db, {}); $v->InitDB($table);# Preform the actions requested by the user $v->Preform($form);# Generate list content of $table in a html table print "< table >n"; foreach ($v->List("SELECT * FROM $table",'< td >')) { print "" . $v->ml("CGIReq.cgi", $_->, "Show") . "< /tr >n"; } print "< /table >n";This is a general propose module to simplify the creation of web userinterfaces to a DBI database, currently it can list, view, add, edit and delete entries in the databse using either or to gather the info. Se the new method description for info on how to define the database format and how the fields should be edited.It's actions is highy customizable by using a database definition where most things are specified and by beeing designed to easily allow subclassing in order to change it's behaviour.It can also edit N2N relations between two tabels using a third table to represent the connections. Eg if you have two tabels with say users and usergroups like this: Users Groups |uid |Name | |gid |Group | +----+------+ +----+----------+ |0 |root | |0 |Superuser | |1 |jhon | |1 |Webauthor | |2 |hakan | |2 |Mailuser | |3 |tom |Now lets say that we have one Superuser (root), three Webauthors (tom, jhon,root) and all four users are Mailusers. To represent this in the databse HTMLView uses a third table, say UsersGroups, linking uid's to gid's like this UsersGroups |id |uid |gid | +---+----+----+ |0 |0 |0 | root is Superuser |1 |0 |1 | root is Webauthor |2 |0 |2 | root is Mailuser |3 |1 |1 | jhon is Webauthor |4 |1 |2 | jhon is Mailuser |5 |2 |2 | hakan is Mailuser |6 |3 |1 | tom is Webauthor |7 |3 |2 | tim is MailuserThis kind of relations are edited using a set of checkboxes in the post editor allowing the user to select any number of groups for each user.Even if we have tried to make this as general as possible there are a few properties required from the database beeing edited. The most inportant one is that each table has to contain and unquire index field. Since the handling of such indexes differs between databses there is a set of methods handling them which could changed by subclassing and overridon those. The methods are: GetIndex - Returns the colum name for the unquire id NextId - Returns a new unquire value that could be used in a new postSee the detailed method descriptions below for more info.The default methods are designed to work with mSQL and mySQL if the tabels are constructued in some specific ways:As for mySQL the index field should be declaered "INT NOT NULL AUTO_INCREMENT" and made "PRIMARY KEY". It can be named anything as HTMLView are able to figgure out the primary key of a table.As for mSQL the index field has to be called id and defined as "INT NOT NULL" in the "CREATE TABLE" request, and that the table contains a sequence (eg "CREATE SEQUENCE ...") from which values are retreved to the index. Is is also adviceable to make an index out of the id, eg "CREATE UNIQUE INDEX idx1 ON Users(uid)", to speed up the database handling, but HTMLView will probabably work anyway.Requirements:· Perl Requirements: · Perl


DBIx::HTMLView Related Software