Project

General

Profile

GUI standard » History » Version 1

Max Milbers, 02/25/2011 04:50 PM

1 1 Max Milbers
h1. GUI standard
2
3
Here follows a list of best practices when working develop a virtuemart view.
4
5
h2. Using javascript
6
7
Administrators should have js enabled. We can expect that administrators have js enabled. Therefore the backend can have features that only reachable with js.
8
9
But the shoppers are sometimes afraid to use js and dont trust a shop that is only working with js. So the whole frontend should be workable without js. This does not mean that every feature for comfort must be accessible without js, but the base functions.
10
11
h2. Use of of JText and hardcoded formats and simular
12
13
@echo JText::_('VM_FILES_LIST_THUMBNAIL_IMG').": ";@
14
This is very bad and mustn't done. The ":" is hardcoded in the code. The right solution here is to write
15
16
@echo JText::_('VM_FILES_LIST_THUMBNAIL_IMG');@
17
and to add the colon to the language file.
18
19
h2. Clicking cancel
20
21
When the user clicks cancel, the user is taken back from the editing screen to the page listing. No cancellation message will be shown.
22
23
h2. Delete button on row
24
25
The page listings should not contain a delete button per row. A single delete button needs to be placed in the toolbar.
26
27
h2. Database ID numbers
28
29
The page listings should not contain a database ID number.
30
31
h2. Sortable columns
32
33
A column should, where possible be made sortable by clicking on the column header.
34
35
h2. List order fields
36
37
A list order field should for new entries be disabled and shown the text string containing: "New items default to the last place. Ordering can be changed after this item is saved." For existing entries, the List order dropdown will be shown, this will allow the user to choose where to place the item.
38
39
h1. Some coding standards
40
41
h2. Standard publishing fields use:
42
43
- published with 0 and 1 formatted in the db as tinyInt(1) with standard 0
44
- publish_up and publish_down formatted in the db as datetime with standard 0000-00-00 00:00:00
45
46
The standard query is then 
47
48
	@ $db = &JFactory::getDBO();
49
	$this->_nullDate = $db->getNullDate();
50
	$this->_now        = JFactory::getDate()->toMySQL();
51
52
 $query  = 'SELECT * FROM `#__sometable` WHERE yourexampel ="myexampelvalue" AND ';
53
 $query .= ' ( publish_up = '.$this->_db->Quote($this->_nullDate).' OR publish_up <= '.$this->_db->Quote($this->_now).' )' .
54
 ' AND ( publish_down = '.$this->_db->Quote($this->_nullDate).' OR publish_down >= '.$this->_db->Quote($this->_now).' ) '; @