3x5 Cards git
Status: Beta
Brought to you by:
rkowen
This document gives some of the relevant details related to the 3x5 card project. Project Name: 3x5 Cards Purpose: The 3x5 Cards project provides an intuitive web interface to a database. The metaphor is the 3"x5" index card. Each card has a number, a title, and the contents of the card itself. The cards can be arranged by either the number or the title, and can be collected in batches. Unlike the 3"x5" index card ... an individual 3x5 card can exist in multiple batches, and the characteristics of a batch can be related to another. Access can be granted, through a password mechanism, to allow full administrative access, writing and creating cards, appending information to existing cards only, or the most restrictive of read-only. Requires: Apache2 - web server PHP7 - embedded scripting and display Postgres 10.x - database (with plpgsql - Postgres procedural language - for triggers) Principle Author: R.K. Owen, Ph.D. Initial Date: 05/12/2002 The current version number is given in the cards.inc file. All configurable color and site values are given in cards.inc . INSTALLATION: Apache2 - Should be running as user/group "www-data" or the equivalent non-privileged user/group, The Ubuntu distribution uses "www-data". The user/group is defined in apache2/envvars. This can be changed by editing the envvars or apache2.conf and editing it to: User www-data Group www-data Or if this is not feasible then edit the 3x5.sql file replacing "www-data" with whatever user the httpd daemon runs as. Postgres - Needs the procedural language to be loaded, which is now loaded by default. Check by executing psql and giving \dL at the prompt. Should see plpgsql in the list. Older versions of Postgres required installing the PL/PostgreSQL procedural language manually with something like: createlang plpgsql template1 Read src/pl/plpgsql/src/INSTALL in the PostgreSQL sources for further info. Create the database with (must be a user that can do this ... if not as yourself, then as the postgres user.) createdb i3x5 Create a user "www-data", the default user the httpd daemon user, which will be given access to the i3x5 schema: createuser -D -A www-data Create tables by starting the PostgreSQL interactive terminal and invoking the sql scripts. The prompt is given as "i3x5=#". psql i3x5 i3x5=# \i 3x5.sql (ignore the errors if starting from scratch) i3x5=# \i 3x5_help.sql i3x5=# \q ------------------------------------------------------------------------ Most hosting services do not provide an adequate environment for running psql from the commandline. However, most offer phpPgAdmin from the CPanel web interface. This should be sufficient for creating and populating the necessary tables. You will find in the far upper right hand corner "SQL | History | Find". Click on "SQL" and in the dialog box use the "or upload an SQL script" to choose the appropriate .sql script to process. ------------------------------------------------------------------------ PHP - The configuration options are given here (tailor the path to your own site) configure \ --with-apxs --prefix=/php_path/php/7.2 \ --with-config-file-path=/php_path/php/7.2/lib \ --with-exec-dir=/php_path/php/7.2/bin --with-openssl \ --without-pear --enable-xml --enable-wddx \ --with-pgsql --with-gdbm Or use packages. The following are the list for Ubuntu. php php-common php-pgsql Which can be installed with apt install php php-common php-pgsql You may want to increase the value for session.gc_maxlifetime in /etc/php/X.Y/apache2/php.ini . The default time is 24 minutes. Increase this time and a person can be "logged" in longer. However, this can't be reliably changed if hosted elsewhere. ======================================================================== Install the libjs-jquery-ui package and dependencies apt install libjs-jquery-ui The interface now uses jQuery to dynamically set some heights and widths. Note that iframes default to 150x300 pixels, and no CSS appears to change this unless values are explicitly given. I.e. it doesn't recognize 100%. ======================================================================== Database Connection The database connection string can be defined in a couple of ways. 1) The .htaccess file can be used to define the DATABASE_URL and DB_CRYPT environment variables. If DB_CRYPT is set then it's automatically assumed encryption is enabled. (This sets $db_encode .) If you use Heroku there is no need to edit the .htaccess file and define the DATABASE_URL. This is defined for you already when you created the PostgreSQL addon with something like: heroku addons:create --app i3x5 heroku-postgresql:hobby-dev The DB_CRYPT environment variable is defined for your i3x5 app with something like this: heroku config:set DB_CRYPT=SomeString If you're using environment variables, then there's no need to edit the given db_connect.inc file. 2) If environment variables are not used then you will need to edit db_connect.inc and give the database password and connection values there. The db_connect.inc has an example of the keyword type of connection string. .htaccess has an example of the postgresql URL connection string. In either case if your system has the pgcrypto extenstion then you can set $db_encode to true and define some encryption string with $db_crypt. Not all webhosting services provide this as part of their basic service (e.g. BlueHost). This encodes the user passwords for the many levels. However, note that passwords are still stored within the database, but just encrypted. So a casual browser of the database won't be able to view these passwords unless they have the encryption key. The extra/ directory has convenient SQL scripts for converting from encoded to unencoded or back. ======================================================================== Web page layout: page and [iframe] index.php [_parent] +----------------+-----------------------------------------------------+ | | | | indexT.php | indexM.php | | (title) | and all others | | | [main] | +----------------+ | | | | | indexB.php | | | (options) | | | | | +----------------+ | | | | | context | | | sensitive | | | help | | | [helptext] | | | | | +----------------+-----------------------------------------------------+ ======================================================================== The following are attributions for various items used in 3x5, which are gratefully acknowledged. Calendar icon: office-calendar-icon.png Artist: Papirus Development Team Iconset: Papirus Apps Icons (1418 icons) License: GNU General Public License v3.0 Commercial usage: Allowed