Commit 3cbb5039d9f9f63f832e733ca612a47617d4b9a7

Authored by Michael Joseph
1 parent 007a29f2

Type: i18n Framework.

Description:		Removed unused functions.
                                Added image localisation function.


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@2845 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing 1 changed file with 19 additions and 74 deletions
presentation/Html.inc
... ... @@ -50,84 +50,10 @@ function statusPage($sTitle, $sHeading, $sText = "", $sCancelAction, $sQueryStri
50 50 return $sToRender;
51 51 }
52 52  
53   -function startTable($border, $width) {
54   - return "<table border=\"$border\" width=\"$width\">\n";
55   -}
56   -
57   -function tableCaption($sCaption) {
58   - return "<caption><b>$sCaption</b></caption>\n";
59   -}
60   -
61   -function stopTable() {
62   - return "</table>\n";
63   -}
64   -
65   -function tableRow($align, $bgcolor, $html) {
66   - return "<tr align=\"$align\" bgcolor=\"$bgcolor\">$html</tr>\n";
67   -}
68   -
69   -
70   -function tableHeading($cssClassName, $colspan, $text) {
71   - return "<th class=\"$cssClassName\" colspan=\"$colspan\">\n
72   - $text\n
73   - </th>\n";
74   -}
75   -
76   -function tableData($html, $iColspan = 1) {
77   - return "<td colspan = $iColspan>$html</td>\n";
78   -}
79   -
80   -function tableCssData($html, $cssClass) {
81   - return "<td><span class=\"$cssClass\">$html</span></td>\n";
82   -}
83   -
84   -function startTableRowCell() {
85   - return "<tr><td>\n";
86   -}
87   -
88   -function textInput($sId, $sValue) {
89   - return "<input type=text id=\"$sId\" value=\"$sValue\" />\n";
90   -}
91   -
92   -function endTableRowCell() {
93   - return "</td></tr>\n";
94   -}
95   -
96 53 function generateImage($sImageSource) {
97 54 return "<img border=\"0\" src=\"$sImageSource\">";
98 55 }
99 56  
100   -function getNumberStringValidationJavaScript() {
101   - return "<script language=\"JavaScript\">\n".
102   - "<!--\n" .
103   - "function validateString(field, msg, min, max) {\n" .
104   - "\tif (!min) { min = 1 }\n" .
105   - "\tif (!max) { max = 65535 }\n\n" .
106   -
107   - "\tif (!field.value || field.value.length < min || field.value.max > max) {\n" .
108   - "\t\talert(msg);\n" .
109   - "\t\tfield.focus();\n" .
110   - "\t\tfield.select();\n" .
111   - "\t\treturn false;\n" .
112   - "\t}\n" .
113   - "\treturn true;\n" .
114   - "}\n\n" .
115   -
116   - "function validateNumber(field, msg, min, max) {\n" .
117   - "\tif (!min) { min = 0 }\n" .
118   - "\tif (!max) { max = 255 }\n" .
119   -
120   - "\tif ( (parseInt(field.value) != field.value) || field.value.length < min || field.value.length > max) {\n" .
121   - "\t\talert(msg);\n" .
122   - "\t\tfield.focus();\n" .
123   - "\t\tfield.select();\n" .
124   - "\t\treturn false;\n" .
125   - "\t}\n" .
126   - "\treturn true;\n" .
127   - "}\n" .
128   - "//-->\n" .
129   - "</script>\n";
130   -}
131 57  
132 58 /**
133 59 * Candy striping helper method
... ... @@ -135,4 +61,23 @@ function getNumberStringValidationJavaScript() {
135 61 function getColour($iColourCount) {
136 62 return ($iColourCount%2 == 0) ? "F5F6EE" : "FFFFFF";
137 63 }
  64 +
  65 +/**
  66 + * Localises images by checking in the relevant locale.
  67 + *
  68 + * @param string the image to be localised.
  69 + */
  70 +function imgSrc($sImage) {
  71 + global $default;
  72 +
  73 + $sLocalisedImage = "/i18n/" . $default->defaultLanguage . "/graphics/$sImage";
  74 +
  75 + // check for the image in the selected locale
  76 + if (file_exists($default->fileSystemRoot . $sLocalisedImage)) {
  77 + return $default->rootUrl . $sLocalisedImage;
  78 + } else {
  79 + // else return the default image
  80 + return $default->graphicsUrl . "/$sImage";
  81 + }
  82 +}
138 83 ?>
... ...