Diffstat (limited to 'scripts/builder/frontendBuilder.py') (more/less context) (ignore whitespace changes)
-rw-r--r-- | scripts/builder/frontendBuilder.py | 73 |
1 files changed, 17 insertions, 56 deletions
diff --git a/scripts/builder/frontendBuilder.py b/scripts/builder/frontendBuilder.py index e52c31e..b72179f 100644 --- a/scripts/builder/frontendBuilder.py +++ b/scripts/builder/frontendBuilder.py | |||
@@ -30,16 +30,18 @@ class FrontendBuilder(object): | |||
30 | self.repositoryVersion = repositoryVersion | 30 | self.repositoryVersion = repositoryVersion |
31 | self.processedFiles = {} | 31 | self.processedFiles = {} |
32 | 32 | ||
33 | #--------------------------------------------------------------------------- | 33 | #--------------------------------------------------------------------------- |
34 | 34 | ||
35 | def name (self): | 35 | def name (self): |
36 | raise NotImplementedError() | 36 | raise NotImplementedError() |
37 | 37 | ||
38 | def projectResourceTypes (self): | ||
39 | raise NotImplementedError() | ||
38 | 40 | ||
39 | def copyStaticResources (self, targetFolder): | 41 | def copyStaticResources (self, targetFolder): |
40 | raise NotImplementedError() | 42 | raise NotImplementedError() |
41 | 43 | ||
42 | #--------------------------------------------------------------------------- | 44 | #--------------------------------------------------------------------------- |
43 | 45 | ||
44 | def log (self, message): | 46 | def log (self, message): |
45 | module = self.module | 47 | module = self.module |
@@ -88,19 +90,21 @@ class FrontendBuilder(object): | |||
88 | # try: | 90 | # try: |
89 | # shutil.copytree(srcFolder, dstFolder) | 91 | # shutil.copytree(srcFolder, dstFolder) |
90 | # except: | 92 | # except: |
91 | # pass | 93 | # pass |
92 | 94 | ||
93 | 95 | ||
94 | 96 | ||
95 | def copyResourcesToFolder (self, targetFolder): | 97 | def copyResourcesToFolder (self, targetFolder): |
96 | self.copyResources(self.projectDir, targetFolder, 'css') | 98 | # self.copyResources(self.projectDir, targetFolder, 'css') |
97 | self.copyResources(self.projectDir, targetFolder, 'js') | 99 | # self.copyResources(self.projectDir, targetFolder, 'js') |
98 | self.copyResources(self.projectDir, targetFolder, 'images') | 100 | # self.copyResources(self.projectDir, targetFolder, 'images') |
101 | for resoureceType in self.projectResourceTypes(): | ||
102 | self.copyResources(self.projectDir, targetFolder, resoureceType) | ||
99 | self.copyStaticResources(targetFolder) | 103 | self.copyStaticResources(targetFolder) |
100 | 104 | ||
101 | 105 | ||
102 | def loadFilesContent (self, basePath, files): | 106 | def loadFilesContent (self, basePath, files): |
103 | result = "" | 107 | result = "" |
104 | 108 | ||
105 | for file in self.filterFiles(files): | 109 | for file in self.filterFiles(files): |
106 | try: | 110 | try: |
@@ -238,65 +242,18 @@ class FrontendBuilder(object): | |||
238 | result = re.sub('/', '%2f', result) | 242 | result = re.sub('/', '%2f', result) |
239 | # result = re.sub('"', '%22', result) | 243 | # result = re.sub('"', '%22', result) |
240 | result = re.sub('"', '\\"', result) | 244 | result = re.sub('"', '\\"', result) |
241 | result = re.sub('\"', '%22', result) | 245 | result = re.sub('\"', '%22', result) |
242 | result = re.sub('\'', '%22', result) | 246 | result = re.sub('\'', '%22', result) |
243 | result = re.sub('\\\\', '%5c', result) | 247 | result = re.sub('\\\\', '%5c', result) |
244 | result = result.strip() | 248 | result = result.strip() |
245 | result = 'javascript:' + result | 249 | result = 'javascript:' + result |
246 | |||
247 | # replacers = [ | ||
248 | # ('aForm', '_1' ), | ||
249 | # ('inputFields', '_2' ), | ||
250 | # ('passwordFieldsFound','_3' ), | ||
251 | # ('aDocument', '_6' ), | ||
252 | # ('aLevel', '_7' ), | ||
253 | # # ('result', '_8' ), | ||
254 | # ('documentForms', '_9' ), | ||
255 | # ('iFrames', '_c' ), | ||
256 | # ('anInputElement', '_d' ), | ||
257 | # ('options', '_f' ), | ||
258 | # ('option', '_12'), | ||
259 | # ('aLoginForm', '_13'), | ||
260 | # # ('action', '_17'), | ||
261 | # ('radioValues', '_18'), | ||
262 | # ('radioValueName', '_19'), | ||
263 | # ('inputElement', '_1a'), | ||
264 | # ('elementValues', '_1b'), | ||
265 | # ('radioValue', '_1c'), | ||
266 | # ('values', '_1d'), | ||
267 | # ('objtype', '_21'), | ||
268 | # ('useKey', '_27'), | ||
269 | # ('bookmarkletDiv', '_28'), | ||
270 | # ('someParameters', '_29'), | ||
271 | # ('anException', '_2a'), | ||
272 | # ('newDiv', '_2b'), | ||
273 | # ('base_url', '_2c'), | ||
274 | # ('help_url', '_2d'), | ||
275 | # ('logo_image_url', '_2e'), | ||
276 | # ('background_image_url','_2f'), | ||
277 | # ('close_image_url', '_30'), | ||
278 | # #('bookmarklet_textarea','_31'), | ||
279 | # ('innerHTML', '_32'), | ||
280 | # ] | ||
281 | # for replacer in replacers: | ||
282 | # result = re.sub('([^\.])' + replacer[0], '\\1' + replacer[1], result) | ||
283 | |||
284 | # replacers = [ | ||
285 | # ('headNode', '_1' ), | ||
286 | # ('clipperzScriptNode','_2' ), | ||
287 | # ] | ||
288 | # for replacer in replacers: | ||
289 | # result = re.sub('([^\.])' + replacer[0], '\\1' + replacer[1], result) | ||
290 | |||
291 | # result = re.sub(';', ';\n', result) | ||
292 | 250 | ||
293 | return result | 251 | return result |
294 | |||
295 | 252 | ||
296 | 253 | ||
297 | def bookmarklet (self): | 254 | def bookmarklet (self): |
298 | cacheKey = 'bookmarklet' | 255 | cacheKey = 'bookmarklet' |
299 | if not self.processedFiles.has_key(cacheKey): | 256 | if not self.processedFiles.has_key(cacheKey): |
300 | result = 'bookmarklet="' + self.packBookmarklet(self.loadFilesContent('js', ['Bookmarklet.js']), "regular") + '";bookmarklet_ie="' + self.packBookmarklet(self.loadFilesContent('js', ['Bookmarklet_IE.js']), "IE") + '";' | 257 | result = 'bookmarklet="' + self.packBookmarklet(self.loadFilesContent('js', ['Bookmarklet.js']), "regular") + '";bookmarklet_ie="' + self.packBookmarklet(self.loadFilesContent('js', ['Bookmarklet_IE.js']), "IE") + '";' |
301 | self.processedFiles[cacheKey] = result | 258 | self.processedFiles[cacheKey] = result |
302 | else: | 259 | else: |
@@ -383,27 +340,31 @@ class FrontendBuilder(object): | |||
383 | '\n' + | 340 | '\n' + |
384 | self.compressJS(self.loadFilesContent('js', self.settings['js']), "application") | 341 | self.compressJS(self.loadFilesContent('js', self.settings['js']), "application") |
385 | ) | 342 | ) |
386 | jsLoadMode = 'EMBEDDED' | 343 | jsLoadMode = 'EMBEDDED' |
387 | 344 | ||
388 | elif assemblyMode == 'DEBUG': | 345 | elif assemblyMode == 'DEBUG': |
389 | copyright = self.assembleCopyrightHeader() | 346 | copyright = self.assembleCopyrightHeader() |
390 | css =self.cssTagsForFiles('./css', self.filterFiles(self.settings['css'])) | 347 | css =self.cssTagsForFiles('./css', self.filterFiles(self.settings['css'])) |
391 | js =self.scriptTagForContent(self.bookmarklet()) + \ | 348 | js =self.scriptTagForContent( |
392 | '\n' + \ | 349 | self.bookmarklet()) + \ |
393 | self.scriptTagsForFiles('./js', self.filterFiles(self.settings['js'])) | 350 | '\n' + \ |
351 | self.scriptTagsForFiles('./js', self.filterFiles(self.settings['js']) | ||
352 | ) | ||
394 | jsLoadMode = 'LINKED' | 353 | jsLoadMode = 'LINKED' |
395 | 354 | ||
396 | elif assemblyMode == 'DEVELOPMENT': | 355 | elif assemblyMode == 'DEVELOPMENT': |
397 | copyright = "" | 356 | copyright = "" |
398 | css =self.cssTagsForFiles('file://' + str(os.path.join(self.absolutePathForSources(), 'css')), self.filterFiles(self.settings['css'])) | 357 | css =self.cssTagsForFiles('file://' + str(os.path.join(self.absolutePathForSources(), 'css')), self.filterFiles(self.settings['css'])) |
399 | js =self.scriptTagForContent(self.bookmarklet()) + \ | 358 | js =self.scriptTagForContent( |
400 | '\n' + \ | 359 | self.bookmarklet()) + \ |
401 | self.scriptTagsForFiles('file://' + str(os.path.join(self.absolutePathForSources(), 'js')), self.filterFiles(self.settings['js'])) | 360 | '\n' + \ |
361 | self.scriptTagsForFiles('file://' + str(os.path.join(self.absolutePathForSources(), 'js')), self.filterFiles(self.settings['js']) | ||
362 | ) | ||
402 | jsLoadMode = 'LINKED' | 363 | jsLoadMode = 'LINKED' |
403 | versionType = 'development' | 364 | versionType = 'development' |
404 | 365 | ||
405 | else: | 366 | else: |
406 | raise NotImplementedError() | 367 | raise NotImplementedError() |
407 | 368 | ||
408 | return self.assembleVersion( | 369 | return self.assembleVersion( |
409 | pageTitle = pageTitle, | 370 | pageTitle = pageTitle, |