File: title_masks.txt

package info (click to toggle)
opendb 0.81p18-2
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 4,716 kB
  • ctags: 6,787
  • sloc: php: 50,213; sql: 3,098; sh: 272; makefile: 54; xml: 48
file content (109 lines) | stat: -rw-r--r-- 4,024 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
Title Mask functionality
------------------------

1)	Title mask functionality is available in listings, borrow and 
	site plugins.  This functionality allows you to configure what
	attributes are displayed [with OR instead of] the item title 
	in the item title column/field.

2)	Mask Structure

	Each variable mask element is enclosed in curly braces, this is
	required for simple variables as well as for mask functions.

2.1) Variables

	All should be lowercase and match the s_attribute_type of the 
	item_attribute you want included.

	In the most basic example, you would include the ALT_TITLE
	attribute of an item thus:
		{alt_title}
		
2.2) Lookup table variable options

	As well as normal variables, you can also specify that you
	want to display the attribute in a particular format.

	This will only work for attributes that are sourced from
	a lookup widget.  (A widget that is populated from the
	s_attribute_type_lookup table)

	At item_attribute.attribute_val, you can use 
	'img', 'value' and 'display', thus:
	
		{s_attribute_type.img}
		{s_attribute_type.value}
		{s_attribute_type.display}

	These correspond to the s_attribute_type_lookup columns of
	the same name, for the item_attribute.

	At s_item_type, you can use 'prompt', which will return the
	s_item_attribute_type.prompt, or s_attribute_type if not defined.
	
		{s_attribute_type.prompt}	

2.3) Mask functions

	There are currently two functions that you can use.

2.3.1)	ifdef(varname, 'if_mask'[,'else_mask'])

	If the specified s_attribute_type is set in the item
	as an item_attribute, then the 'mask' parameter. which
	can have embedded mask variables (but not mask functions)
	will be displayed, otherwise nothing.

	You CANNOT specify 'title', 's_status_type', 's_item_type',
	'item_id' or 'instance_no' for varname.

2.3.2) if(varname op value, 'if_mask'[,'else_mask'])

	The op is one of '<=', '<', '>=', '>', '==', '!='. 
	
	If either the varname value or value is empty/null this 
	function will evaluate to FALSE.

	If you want to test for emptiness, use 'ifdef', as this is 
	exactly what this function tests.  In actuality the 'ifdef'
	function actually test if an item_attribute record for the
	specified type even exists, but because the item_input.php
	does not insert records that have an empty value AND deletes
	those that are set to empty, the ifdef does provide the same
	functionaliy as an 'isnull' function might.

	You CAN specify 's_item_type', 's_status_type', 'instance_no'
	for varname.  You CANNOT specify 'title' or 'item_id' though.

2.3.3)	switch(varname, value, statement[value, statement][,...][,default_statement])
	Does a simple comparison of the value of varname, to each of the value strings
	in the switch, and when a match is made, the corresponding statement is
	evaluated and the value returned.  If no matches, and a default_statement is
	defined, this is evaluated instead.  Be sure to get the order right, as an
	incorrect order will have unpredictable results.
	
	The switch value, must be a simple string, it cannot be a submask statement
	in and of itself, nor a if comparison for instance, this is a simple
	C like switch statement.

2.3.4)	theme_img(img, prompt_expression)
	The img, should be a relative path image, that can be found
	using the functions/theme.php::_theme_image_src($src) function
	algorithm.
	
	The prompt_expression, can be any expression that returns a
	string, which means embedding another call to theme_img is
	not a good idea, and will not be handled properly.  Examples
	of what to specify include:
		year.value			- Will return the year of the current item.
		dvd_extras.prompt	- The system data prompt, for example 'Extras'.

	Any theme_img which can be resolved at s_item_type level will be included
	in the help section of listings.php.  This is configurable with the
	$CONFIG_VARS['listings.title_mask_macro_theme_img_help'] variable.
		
3.0) Tips

	In order to use embedded functions in if, ifdef function calls you
	need to enclose them in {...} brackets.