Project

General

Profile

« Previous | Next » 

Revision 3728

add servletContextUrl to make absolute paths from relative paths when constructing skins from the js/iframe template

View differences:

lib/style/common/branding.js
79 79
 * includes a colspan
80 80
 *  TEMPLATE_FOOTERROW_CLASS
81 81
 */
82
 
83
function prependUrl(prefix, path) {
82 84

  
85
	var retUrl = path;
86
	if ( !_isBlank(path) ) {
87
		if ( !_isBlank(prefix) ) {
88
			if (path.indexOf("http") < 0) {
89
				retUrl = prefix + "/" + path;
90
			}
91
		}
92
	}
93
	return retUrl;
94
}
83 95

  
84 96

  
85 97
/**
......
87 99
 *  content, including the the optional header and left column areas
88 100
 *  referenced by the HEADER_URL and LEFTCOL_URL settings
89 101
 */
90
function insertTemplateOpening() {
102
function insertTemplateOpening(serverContextUrl) {
91 103

  
92 104
  //table opening tag
93 105
  document.write("<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" "
......
95 107
  //first row is header
96 108
  document.write("<tr><td "+_getColSpanString()+" class=\""+TEMPLATE_HEADERROW_CLASS+"\">");
97 109

  
110
  //make any relative paths into absolute paths
111
  HEADER_URL = prependUrl(serverContextUrl, HEADER_URL);
112
	
98 113
  //content for the header (if any)
99 114
  _createIFrameWithURL(HEADER_URL, IFRAME_HEADER_CLASS);
100 115

  
......
105 120

  
106 121
    document.write("<td class=\""+TEMPLATE_LEFTCOL_CLASS+"\">");
107 122

  
123
	//make any relative paths into absolute paths
124
	LEFTCOL_URL = prependUrl(serverContextUrl, LEFTCOL_URL);
125
  
108 126
    _createIFrameWithURL(LEFTCOL_URL, IFRAME_LEFTCOL_CLASS);
109 127

  
110 128
    document.write("</td>");
......
119 137
 *  content, including the optional right column and footer areas
120 138
 *  referenced by the RIGHTCOL_URL and FOOTER_URL settings
121 139
 */
122
function insertTemplateClosing() {
140
function insertTemplateClosing(serverContextUrl) {
123 141

  
124 142
  //right column
125 143
  document.write("</td>");
......
129 147

  
130 148
    document.write("<td class=\""+TEMPLATE_RIGHTCOL_CLASS+"\">");
131 149

  
150
	//make any relative paths into absolute paths
151
	RIGHTCOL_URL = prependUrl(serverContextUrl, RIGHTCOL_URL);
152
	
132 153
    _createIFrameWithURL(RIGHTCOL_URL, IFRAME_RIGHTCOL_CLASS);
133 154

  
134 155
    document.write("</td>");
......
138 159
  document.write("</tr><tr><td "+_getColSpanString()+" class=\""
139 160
                                              +TEMPLATE_FOOTERROW_CLASS+"\">");
140 161

  
162
  //make any relative paths into absolute paths
163
  FOOTER_URL = prependUrl(serverContextUrl, FOOTER_URL);
164
	
141 165
  //content for the footer (if any)
142 166
  _createIFrameWithURL(FOOTER_URL, IFRAME_FOOTER_CLASS);
143 167

  
......
150 174
/**
151 175
 *  inserts the header referenced by the SEARCHBOX_URL setting
152 176
 */
153
function insertSearchBox() { 
177
function insertSearchBox(serverContextUrl) { 
154 178

  
155 179
  if (!_isBlank(SEARCHBOX_URL)) {
180
  
181
	//make any relative paths into absolute paths
182
	SEARCHBOX_URL = prependUrl(serverContextUrl, SEARCHBOX_URL);
156 183

  
157 184
    _createIFrameWithURL(SEARCHBOX_URL, IFRAME_SEARCHBOX_CLASS);
158 185
  }
......
163 190
/**
164 191
 *  inserts the header referenced by the SEARCHBOX_URL setting
165 192
 */
166
function insertMap() { 
193
function insertMap(serverContextUrl) { 
167 194

  
168 195
  if (!_isBlank(MAP_URL)) {
196
  	//make any relative paths into absolute paths
197
	MAP_URL = prependUrl(serverContextUrl, MAP_URL);
169 198

  
170 199
    _createIFrameWithURL(MAP_URL, IFRAME_MAP_CLASS);
171 200
  }
......
175 204
/**
176 205
 *  inserts the header referenced by the ADVANCED_SEARCHBOX_URL setting
177 206
 */
178
function insertAdvancedSearchBox() { 
207
function insertAdvancedSearchBox(serverContextUrl) { 
179 208

  
180 209
  if (!_isBlank(ADVANCED_SEARCHBOX_URL)) {
181

  
210
	//make any relative paths into absolute paths
211
	ADVANCED_SEARCHBOX_URL = prependUrl(serverContextUrl, ADVANCED_SEARCHBOX_URL);
212
	
182 213
    _createIFrameWithURL(ADVANCED_SEARCHBOX_URL, IFRAME_ADVANCED_SEARCHBOX_CLASS);
183 214
  }
184 215

  
......
187 218
/**
188 219
 *  inserts the header referenced by the LOGINBOX_URL setting
189 220
 */
190
function insertLoginBox() { 
221
function insertLoginBox(serverContextUrl) { 
191 222

  
192 223
  if (!_isBlank(LOGINBOX_URL)) {
224
  
225
  	//make any relative paths into absolute paths
226
	LOGINBOX_URL = prependUrl(serverContextUrl, LOGINBOX_URL);
193 227

  
194 228
    _createIFrameWithURL(LOGINBOX_URL, IFRAME_LOGINBOX_CLASS);
195 229
  }

Also available in: Unified diff