1<?php
2/********************************
3OSBib:
4A collection of PHP classes to create and manage bibliographic formatting for OS bibliography software
5using the OSBib standard.
6
7Released through http://bibliophile.sourceforge.net under the GPL licence.
8Do whatever you like with this -- some credit to the author(s) would be appreciated.
9
10If you make improvements, please consider contacting the administrators at bibliophile.sourceforge.net
11so that your improvements can be added to the release package.
12
13Adapted from WIKINDX: http://wikindx.sourceforge.net
14
15Mark Grimshaw 2005
16http://bibliophile.sourceforge.net
17********************************/
18/**
19*	Help file
20*
21*	@author Mark Grimshaw
22*
23*	$Header: /cvsroot/bibliophile/OSBib/create/HELPSTYLE.php,v 1.2 2005/06/20 22:47:32 sirfragalot Exp $
24*/
25class HELPSTYLE
26{
27// Constructor
28	function HELPSTYLE()
29	{
30		include_once("MISC.php");
31////////////////////////////////////////////////////////////////////////////////////
32// TRANSLATORS start here.  Translate ONLY the second string in each define().
33define("TEXT4", "You can create a new style based on an existing one by copying the existing style. To remove a style from the list available to your users, simply remove that style's directory from " . OSBIB_STYLE_DIR . ".");
34// 'Short Name' and 'Long Name' should match the name given in MESSAGES.php style array.
35define("TEXT5", "Each style has a set of options that define the heading style of titles, how to display numbers and dates etc. and then a separate style definition for each resource type that OSBib handles. The 'Short Name' is used by OSBib as both the folder and file name and for this reason should not only be a unique name within " . OSBIB_STYLE_DIR . ", but should also have no spaces or any other characters that may cause confusion with your operating system (i.e. alphanumeric characters only). The 'Long Name' is the description of the style that is displayed to OSBib users.");
36// 'generic style' should be whatever you set for $style['generic'] in MESSAGES.php.
37define("TEXT6", "The three 'generic style' definitions are required and are used to display any resource type for which there does not yet exist a style definition. This allows you to build up your style definitions bit by bit.  Furthermore, some bibliographic styles provide no formatting guidelines for particular types of resource in which case the generic styles will provide some formatting for those resources according to the general guidelines for that bibliographic style. Each resource for which there is no style definition will fall back to the chosen generic style. The generic styles try their best but if formatting is strange for a particular resource type then you should explicitly define a style definition for that type. ");
38// Don't translate HTML tags!
39define("TEXT7", "Each style definition has a range of available fields listed to the right of each input box. These fields are <strong>case-sensitive</strong> and need not all be used. However, with some of the more esoteric styles, the more database fields that have been populated for each resource in the OSBib-compatible bibliographic database, the more likely it is that the formatting will be correct.");
40define("TEXT9", "The formatting of the names, edition and page numbers and the capitalization of the title depends on the global settings provided for your bibliographic style.");
41define("TEXT8", "If the value entered for the edition of a resource contains non-numeric characters, then, despite having set the global setting for the edition format to ordinal (3rd. etc.), no conversion will take place.");
42// 'Editor switch' should be whatever you set for $style['editorSwitchHead'] in MESSAGES.php.
43// 'Yes' should be whatever you set for $style['yes'] in MESSAGES.php.
44define("TEXT10", "The 'Editor switch' requires special attention. Some bibliographic styles require that for books and book chapters, where there exists an editor but no author, that the position occupied by the author is taken by the editor. If you select 'Yes' here, you should then supply a replacement editor field. Please note that if the switch occurs, the editor(s) formatting will be inherited from the global settings you supplied for the author. See the examples below.");
45define("TEXT11", "Tip: In most cases, you will find it easiest to attach punctuation and spacing at the end of the preceding field rather than at the start of the following field. This is especially the case with finite punctuation such as full stops.");
46
47define("SYNTAX_HEADING", "SYNTAX");
48define("SYNTAX1", "The style definition syntax uses a number of rules and special characters:");
49define("SYNTAX2", "The character '|' separates fields from one another.");
50define("SYNTAX3", "If a field does not exist or is blank in the database, none of the definition for that field is printed.");
51define("SYNTAX4", "Field names are case-sensitive");
52// follows on from above in the same sentence...
53define("SYNTAX5", "and need not all be used.");
54define("SYNTAX6", "Within a field, you can add any punctuation characters or phrases you like before and after the field name.");
55define("SYNTAX7", "Any word that you wish to be printed and that is the same (even a partial word) as a field name should be enclosed in backticks '`'.");
56// Do not translate |^p.^pp.^pages|, 'pages', 'pp.' and 'p.'
57define("SYNTAX8", "For creator lists (editors, revisers, directors etc.) and pages, alternative singular and plural text can be specified with '^' (e.g. |^p.^pp.^pages| would print the field 'pages' preceded by 'pp.' if there were multiple pages or 'p.' if not).");
58define("SYNTAX9", "BBCode [u]..[/u], [i]..[/i] and [b]..[/b] can be used to specify underline, italics and bold.");
59// Do not translate HTML tags!
60define("SYNTAX10", "The character '%' enclosing any text or punctuation <em>before</em> the field name states that that text or those characters will only be printed if the <em>preceeding</em> field exists or is not blank in the database. The character '%' enclosing any text or punctuation <em>after</em> the field name states that that text or those characters will only be printed if the <em>following</em> field exists or is not blank in the database. It is optional to have a second pair in which case the construct should be read 'if target field exists, then print this, else, if target field does not exist, print that'.  For example, '%: %' will print ': ' if the target field exists else nothing if it doesn't while '%: %. %' will print ': ' if the target field exists else '. ' if it does not.");
61// Do not translate HTML tags!
62/* The following is an alternative version for SYNTAX11:
63"You may enclose groups of fields in characters, such as paired parentheses, stipulating that these characters are only to be printed if at least one of the enclosed fields exists.  To do this, place the characters into their own fields (delimited by '|' but without a fieldname) surrounding the target fields.  If such special fields exist in isolation (i.e.  are not paired to enclose other fields), unintended results may occur.
64*/
65define("SYNTAX11", "Characters in fields that do not include a field name should be paired with another set and together enclose a group of fields. If these special fields are not paired unintended results may occur. These are intended to be used for enclosing groups of fields in brackets where <em>at least</em> one of the enclosed fields exists or is not blank in the database.");
66// Don't translate <code>|%,\"%\". %|xxxxx|xxxxx|%: %; %|</code> or other HTML tags
67define("SYNTAX12", "The above two rules can combine to aid in defining particularly complex bibliographic styles (see examples below). The pair <br /><code>|%,\"%\". %|xxxxx|xxxxx|%: %; %|</code><br /> states that if at least one of the intervening fields exists, then the comma and colon will be printed; if an intervening field does not exist, then the full stop will be printed <em>only</em> if the <em>preceeding</em> field exists (else nothing will be printed) and the semicolon will be printed <em>only</em> if the <em>following</em> field exists (else nothing will be printed).");
68define("SYNTAX13", "If the final set of characters in the style definition is '|.' for example, the '.' is taken as the ultimate punctuation printed at the very end.");
69define("EXAMPLE_HEADING", "EXAMPLES");
70// Do not translate HTML tags!
71define("EXAMPLE2", "<em>might produce:</em>");
72define("EXAMPLE4", "<em>and, if there were no publisher location or edition entered for that resource and only one page number given, it would produce:</em>");
73define("EXAMPLE9", "<em>and, if there were no publisher location or publication year entered for that resource, it would produce:</em>");
74// don't translate 'editor ^ed.^eds.^ '
75define("EXAMPLE13", "<em>and, if there were no author entered for that resource and the replacement editor field were 'editor ^ed.^eds.^ ', it would produce:</em>");
76define("EXAMPLE15", "Consider the following (IEEE-type) generic style definition and what it does with a resource type lacking certain fields:");
77// don't translate HTML tags
78define("EXAMPLE18", "<em>and, when applied to a resource type with editor and edition fields:</em>");
79define("EXAMPLE20", "Clearly there is a problem here, notably at the end of the resource title. The solution is to use rule no. 10 above:");
80define("EXAMPLE23", "<em>and:</em>");
81define("EXAMPLE25", "Bibliographic styles requiring this complexity are few and far between.");
82// TRANSLATORS end here
83////////////////////////////////////////////////////////////////////////////////////
84// Do not translate these:
85define("EXAMPLE1", "author. |publicationYear. |title. |In [i]book[/i], |edited by editor (^ed^eds^). |publisherLocation%:% |publisherName. |edition ed%,%.% |(Originally published originalPublicationYear) |^p.^pp.^pages|.");
86
87define("EXAMPLE3", "de Maus, Mickey. 2004. An amusing diversion. In <em>A History of Cartoons</em>, Donald D. A. F. F. Y. Duck, and Bugs Bunny (eds). London: Animatron Publishing. 10th ed, (Originally published 2000) pp.20-9.");
88
89define("EXAMPLE5", "de Maus, Mickey. 2004. An amusing diversion. In <em>A History of Cartoons</em>, Donald D. A. F. F. Y. Duck, and Bugs Bunny (eds). Animatron Publishing. (Originally published 2000) p.20.");
90
91define("EXAMPLE7", "author. |[i]title[/i]. |(|publisherLocation%: %|publisherName%, %|publicationYear.|) |ISBN|.");
92define("EXAMPLE8", "de Maus, Mickey. <em>A big book</em> (London: Animatron Publishing, 1999.) 1234-09876.");
93define("EXAMPLE10", "de Maus, Mickey. <em>A big book</em>. (Animatron Publishing.) 1234-09876.");
94
95define("EXAMPLE11", "author. |publicationYear. |[i]title[/i]. |Edited by editor. |edition ed. |publisherLocation%:%.% |publisherName. |Original `edition`, originalPublicationYear|.");
96define("EXAMPLE12", "Duck, Donald D. A. F. F. Y. 2004. <em>How to Make it Big in Cartoons</em>. Edited by M. de Maus and Goofy. 3rd ed. Selebi Phikwe: Botswana Books. Original edition, 2003.");
97define("EXAMPLE14", "de Maus, Mickey and Goofy eds. 2004. <em>How to Make it Big in Cartoons</em>. 3rd ed. Selebi Phikwe: Botswana Books. Original edition, 2003.");
98
99define("EXAMPLE16", "creator, |\"title,\"| in [i]collection[/i], |editor, ^Ed.^Eds.^, |edition ed|. publisherLocation: |publisherName, |publicationYear, |pp. pages|.");
100define("EXAMPLE17", "ed Software, \"Mousin' Around,\". Gaborone: Computer Games 'r' Us, 1876.");
101define("EXAMPLE19", "Donald D. A. F. F. Y. de Duck, \"How to Make it Big in Cartoons,\"Mickey de Maus and Goofy, Eds., 3rd ed. Selebi Phikwe: Botswana Books, 2003.");
102define("EXAMPLE21", "creator, |\"title|%,\" %.\" %|in [i]collection[/i]|%, %editor, ^Ed.^Eds.^|%, %edition ed|%. %|publisherLocation: |publisherName, |publicationYear, |pp. pages|.");
103define("EXAMPLE22", "ed Software, \"Mousin' Around.\" Gaborone: Computer Games 'r' Us, 1876.");
104define("EXAMPLE24", "Donald D. A. F. F. Y. de Duck, \"How to Make it Big in Cartoons,\" Mickey de Maus and Goofy, Eds., 3rd ed. Selebi Phikwe: Botswana Books, 2003.");
105
106		include_once("MESSAGES.php");
107		$this->messages = new MESSAGES();
108		include_once("../UTF8.php");
109		$this->utf8 = new UTF8();
110	}
111// Help page
112	function display()
113	{
114		$this->pString = MISC::h($this->messages->text("heading", "helpStyles"), FALSE, 3);
115		$this->pString .= MISC::aName("top");
116		$this->pString .= MISC::p(TEXT4);
117		$this->pString .= MISC::p(TEXT5);
118		$this->pString .= MISC::p(TEXT10);
119		$this->pString .= MISC::p(TEXT6);
120		$this->pString .= MISC::p(TEXT7);
121		$this->pString .= MISC::p(MISC::hr());
122		$this->pString .= MISC::h(SYNTAX_HEADING);
123		$this->pString .= MISC::p(SYNTAX1);
124		$this->pString .= MISC::ol(
125			MISC::li(SYNTAX2) .
126			MISC::li(SYNTAX3) .
127			MISC::li(MISC::b(SYNTAX4) . ' ' . SYNTAX5) .
128			MISC::li(SYNTAX6) .
129			MISC::li(SYNTAX7) .
130			MISC::li(SYNTAX8) .
131			MISC::li(SYNTAX9) .
132			MISC::li(SYNTAX10) .
133			MISC::li(SYNTAX11) .
134			MISC::li(SYNTAX12) .
135			MISC::li(SYNTAX13)
136			);
137		$this->pString .= MISC::p(TEXT11);
138		$this->pString .= MISC::p(MISC::hr());
139		$this->pString .= MISC::h(EXAMPLE_HEADING);
140		$this->pString .= MISC::p("<code>" . EXAMPLE1 . "</code>" . MISC::BR() .
141			EXAMPLE2 . "</code>" . MISC::BR() . "<code>" . EXAMPLE3 . "</code>" );
142		$this->pString .= MISC::p(EXAMPLE4 . MISC::BR() . "<code>" . EXAMPLE5 . "</code>");
143		$this->pString .= MISC::hr();
144		$this->pString .= MISC::p("<code>" . EXAMPLE7 . "</code>" . MISC::BR() .
145			EXAMPLE2 . "</code>" . MISC::BR() . "<code>" . EXAMPLE8 . "</code>" );
146		$this->pString .= MISC::p(EXAMPLE9 . MISC::BR() . "<code>" . EXAMPLE10 . "</code>");
147		$this->pString .= MISC::hr();
148		$this->pString .= MISC::p("<code>" . EXAMPLE11 . "</code>" . MISC::BR() .
149			EXAMPLE2 . "</code>" . MISC::BR() . "<code>" . EXAMPLE12 . "</code>" );
150		$this->pString .= MISC::p(EXAMPLE13 . MISC::BR() . "<code>" . EXAMPLE14 . "</code>");
151		$this->pString .= MISC::hr();
152		$this->pString .= MISC::p(EXAMPLE15 . MISC::BR() . "<code>" . EXAMPLE16 . "</code>" . MISC::BR() .
153			EXAMPLE2 . MISC::BR() . "<code>" . EXAMPLE17 . "</code>" . MISC::br() .
154			EXAMPLE18 . MISC::br() . "<code>" . EXAMPLE19 . "</code>");
155		$this->pString .= MISC::p(EXAMPLE20 . MISC::BR() . "<code>" . EXAMPLE21 . "</code>" . MISC::BR() .
156			EXAMPLE2 . MISC::BR() . "<code>" . EXAMPLE22 . "</code>" . MISC::br() .
157			EXAMPLE23 . MISC::br() . "<code>" . EXAMPLE24 . "</code>");
158		$this->pString .= MISC::p(EXAMPLE25);
159		$this->pString .= MISC::hr();
160		$this->pString .= MISC::p(TEXT8);
161		$this->pString .= MISC::p(TEXT9);
162		$this->pString .= MISC::p(MISC::a("link",
163			$this->utf8->decodeUtf8($this->messages->text("misc", "top")), "#top"), "small", "right");
164		return $this->pString;
165	}
166}
167