- AddTask:
- use $values[$field] instead of a short variable name for input
- hand over $values array to __handle as array instead of dozens of variables
- ViewTask: use $struct for printing the output
model/DomainHandler.php:
- use 'created' as label for created
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1259 a1433add-5e2c-0410-b055-b7f2511e0802
- read transport options from $handler->getStruct
(instead of $handler->getTransports())
- convert selected transport to to transport name directly
(instead of using $handler->getTransport)
model/DomainHandler.php:
- init_struct: read transport options with Conf::read directly
(instead of using $this->getTransports()
- delete no longer used functions getTransports() and getTransport()
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1256 a1433add-5e2c-0410-b055-b7f2511e0802
- move definition of public and protected variables to DomainHandler.php
- move lots of functions from DomainHandler.php to PFAHandler.php:
- __construct()
- init()
- set()
- store()
- read_from_db()
- view()
- getList()
- getStruct()
- getId_field()
All functions and comments were moved without any modification.
See the history of DomainHandler.php if you need to find out something
about the history of the functions listed above.
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1254 a1433add-5e2c-0410-b055-b7f2511e0802
- new file
- generic edit form template that uses $struct to render the form
templates/admin_edit-domain.tpl:
- deleted, obsoleted by editform.tpl
create-domain.php
- use new editform.tpl
- use $errormsg array instead of join't $errortext
- store/move errors related to a display_in_form field in $fielderror
(they will be displayed next to the field)
- display remaining error messages (not related to a field) with
flash_error()
- use "value_$key" instead of "t$Key" as smarty variable name for field
values
model/DomainHandler.php
- store error messages in $this->errormsg[$field] (instead of $this->errormsg[])
- fix label for default_aliases
model/PFAHandler.php:
- store error messages in $this->errormsg[$field] (instead of $this->errormsg[])
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1252 a1433add-5e2c-0410-b055-b7f2511e0802
- initStruct(): fix alias_count ("something - NULL" is always NULL, now
enforces integer 0 for each JOINt in field with NULL value)
- set() now checks if $this->_field_$fieldname exists and calls it as
additional validator
- split store() into store() (stores $this->values in the database) and
storemore() (stores additional things and/or calls scripts)
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1249 a1433add-5e2c-0410-b055-b7f2511e0802
- get_domain_properties(): use DomainHandler (function result mostly
unchanged, only difference: instead of quota_sum in bytes it now
returns total_quota in MB)
- allowed_quota(): adopt to slightly changed return value of
get_domain_properties()
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1248 a1433add-5e2c-0410-b055-b7f2511e0802
- pacol(): new parameter $dont_write_to_db - needed to skip JOINt in
columns which (of course) aren't available on INSERT or UPDATE
model/DomainHandler.php:
- initStruct(): mark JOINt in columns with the dont_write_to_db flag
- store(): skip columns with the dont_write_to_db flag set (not_in_db
columns are also/still skipped)
In non-technical terms: create-domain works now :-)
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1244 a1433add-5e2c-0410-b055-b7f2511e0802
- changed pVacation_result_removed from 'Auto response for %s has been
removed!' to '... has been disabled!'
*.lang:
- add %s in pVacation_result_removed and pVacation_result (+ translator note)
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1243 a1433add-5e2c-0410-b055-b7f2511e0802
- read_from_db(): provide a working $colformat['ts'] for postgresql
_and_ mysql (the only mysql/pgsql-specific code in DomainHandler,
everything else works with both)
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1242 a1433add-5e2c-0410-b055-b7f2511e0802
- assign smarty values only for fields that have the display_in_form flag
model/DomainHandler.php:
- initStruct(): make default_aliases display_in_form dependant on $this->new
(it's useless in edit mode)
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1235 a1433add-5e2c-0410-b055-b7f2511e0802
- use a new SELECT query syntax (sub-SELECTs) that gets all needed
information (including alias count, mailbox count and total quota)
in one query and is fast as light.
Better don't ask how long it took me to write this query, and I
seriously hope it works with postgresql. Otherwise...!
- add alias_count, mailbox_count and total_quota (including the required
SQL magic) to $struct
- add support for funny[tm] query tricks in $struct:
- replacement for field name in SELECT statement
- additional SQL after the FROM xy clause - useful for JOINs
- new function getList($condition) to get a list of domains
- order SELECT results by $this->id_field (needed for getList)
- add comment about the values used in $struct[*][type]
functions.inc.php:
- add two more optional parameters to pacrypt(): $select and $extrafrom
scripts/shells/domain.php:
- display number of existing aliases and mailboxes
- display quota sum
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1230 a1433add-5e2c-0410-b055-b7f2511e0802
- split view() into
- read_from_db (with param $condition, can also be used with other
conditions than "domain = $this->username")
- view() - fetches one row
(as preparation before implementing a function to list all domains)
- read_from_db():
- replace $bool_fields with $colformat['bool'] - now the database
results for bool fields are always 0/1 (by using CASE in the query),
and have an additional _$field with yes/no
- resultset is now an array of rows (instead of a single row)
- use db_assoc() instead of db_array()
- view(): use read_from_db()
- store(): change a comment that confused vim autofolding
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1229 a1433add-5e2c-0410-b055-b7f2511e0802
- new function db_where_clause($condition, $struct) to create a WHERE clause.
bool values are converted with db_get_boolean() based on $struct
model/DomainHandler.php - view():
- build WHERE clause with db_where_clause()
- new array $colformat for columns which need special handling in the field list
(that's more readable than tons of elseif on the long term, and allows easier
customization (hook/$CONF value?))
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1228 a1433add-5e2c-0410-b055-b7f2511e0802
- deleted (obsoleted by create-domain.php)
create-domain.php:
- fixed wrong variable name that broke saving an edited domain
configs/menu.conf, templates/adminlistdomain.tpl
- changed to use create-domain.php?edit= instead of edit-domain?domain=
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1226 a1433add-5e2c-0410-b055-b7f2511e0802
create-domain.php:
- add edit mode (use ?edit=example.com)
- use $id_field instead of hardcoded 'domain'
- redirect to list-domain after saving in edit mode
- rename some variables
edit-domain.php:
- rename some smarty variables
templates/admin_edit-domain.tpl:
- rename some smarty variables
- add two hidden fields "edit" and "domain", both contain $tDomain
(only in edit mode)
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1225 a1433add-5e2c-0410-b055-b7f2511e0802
- store() can now handle INSERT and UPDATE (depending on $this->new) :-)
- store some texts in $this->msg[] (replaced several $this->variable)
to make functions easier reuseable
- new function initMsg to fill $this->msg[] (can depend on $this->new)
- convert values to a DB-understandable format in store(), not in set()
(affects only bool for now, another candidate is pacrypt()ing passwords)
- check if all fields are set (on new)
- unset all not_in_db fields in $db_values in foreach loop
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1223 a1433add-5e2c-0410-b055-b7f2511e0802
- assign $values to smarty in a foreach loop
edit-domain.php, templates/admin_edit-domain.tpl:
- rename some smarty variables to match column name
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1221 a1433add-5e2c-0410-b055-b7f2511e0802
create-domain.php
- replace old $form_fields with $handler->getStruct()
- rewrite handling POST data to make it easier to understand
- move reading POST input to the section handling POST
- remove condition on POST (we are in the POST block now)
- check if editing of a field is allowed (use default value if not)
- move validation of 'enum' fields to PFAHandler
- allow changing the "active" state (instead of hardcoding it)
model/PFAHandler.php:
- add check for 'enum' fields
model/DomainHandler.php:
- change default for "active" and "default_aliases" to 1
templates/admin_edit-domain.tpl:
- don't hide the "Active" checkbox on new
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1220 a1433add-5e2c-0410-b055-b7f2511e0802
- split __construct to
- __construct($new=0) - init $struct etc. and
- init($username) - validate $username
This allows reading of $struct before doing any check on the username,
and will also avoid problems when I implement a function to list all
domains
- init(): use direct return values instead of $this->return
scripts/shells/domain.php, create-domain.php
- update to use new DomainHandler->init()
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1219 a1433add-5e2c-0410-b055-b7f2511e0802
create-domain.php:
- rename "fField" form fields to just "field" to match the column names
in the database
- remove list of template and POST variables in the header - the code is
self-documenting on this, one useless comment block less to maintain ;-)
- rename $default to $field - matches the usage better
- use $values[$key] instead $$key (this also avoids the need to fill
$values before calling $handler->set)
- remove some validation that is already done in DomainHandler
- use $handler->set even if creating $handler results in an error to
make error messages for all fields visible
- set $values to defaults at the end of the file if $error == 0 (and
use a foreach loop) instead of doing it for GET at the beginning and
again after successful POST
- remove some unused variables
- various other changes
edit-domain.php, templates/admin_edit-domain.tpl:
- rename "fField" form fields to just "field" to match the column names
in the database
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1218 a1433add-5e2c-0410-b055-b7f2511e0802
for create-domain.php...
create-domain.php:
- finally: use DomainHandler :-))
edit-domain.php, create-domain.php,
templates/admin_edit-domain.tpl:
- use 0/1 instead of off/on for checkboxes
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1217 a1433add-5e2c-0410-b055-b7f2511e0802
- new: public function getStruct()
- make store() public explicitely
- store domain_postcreation error message in $this->errormsg
- use existing error message instead of "invalid domain"
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1216 a1433add-5e2c-0410-b055-b7f2511e0802
- init Lang and Config classes in common.php instead of postfixadmin-cli.php -
they need to be available in the web interface also
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1215 a1433add-5e2c-0410-b055-b7f2511e0802
- merge with scripts/common.php
- don't start/use session in CLI mode
- don't load smarty.inc.php in CLI mode
- hardcode language to 'en' in CLI mode (was done in postfixadmin-cli.php before)
scripts/postfixadmin-cli.php - __bootstrap():
- use common.php instead of scripts/common.php
- don't load languages/language.php and languages/en.lang (already
done via common.php)
- don't call language_hook (already done via common.php)
scripts/common.php:
- deleted
- dropped helper functions low(), up(), r() and pr() which were just
shortnames for existing PHP functions
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1214 a1433add-5e2c-0410-b055-b7f2511e0802
- use strtolower()/strtoupper() instead of low()/up() shortnames.
This makes the code slightly longer, but easier to understand because
strtolower()/strtoupper() are well-known function names
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1213 a1433add-5e2c-0410-b055-b7f2511e0802
Class Lang uses exactly the same code as Class Config - therefore
I replaced its code with a simple "extends Config".
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1212 a1433add-5e2c-0410-b055-b7f2511e0802