#1729 closed task (fixed)
Move in-page <script> elements to external *.js files
Reported by: | Nicklas Nordborg | Owned by: | Nicklas Nordborg |
---|---|---|---|
Priority: | major | Milestone: | BASE 3.3 |
Component: | web | Version: | |
Keywords: | Cc: |
Description
This is the first step towards implementing a 'Content Security Policy' (#1712).
Considering that a lot of the in-page scripts are dynamically generated with code that depend on request parameters, user settings, etc. this move is not trivial in all cases. One idea is to use data-*
attributes (introduced by HTML5, see for example http://html5doctor.com/html5-custom-data-attributes/)
to hold data that is needed by the scripts. In most cases simple string values are enough. For more complex data structures we could use JSON.
Change History (120)
comment:1 by , 12 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:2 by , 12 years ago
comment:3 by , 12 years ago
comment:4 by , 12 years ago
(In [6153]) References #1729: Move in-page <script> elements to external *.js files
Fixed on 3 BASE menu popup dialogs. It's not trivial to make this change, but I have also realized that #1730 will affect the same scipts and it would probably be better to do both fixes at the same time. It will at least save a lot of time used for testing the changes.
comment:5 by , 12 years ago
comment:6 by , 12 years ago
(In [6159]) References #1729 and #1730.
Started to work on this for the tabcontrol taglib. Basic tab switching and form validation should work, but not setting a custom 'switchFunction' or activation callback. To use the new features, use the 'tabcontrol-2.js' instead of 'tabcontrol.js'. Remove all explict callback methods in the tags and add them with, for example, TabControl.addTabValidator()
calls.
comment:7 by , 12 years ago
(In [6160]) References #1729 and #1730.
- Redesigned 'onload' event handler functionality. There are now 3 levels to add page initialization code which gives better control of the calling order: Doc.addElementInitializer(), Doc.onLoad() and Doc.addFinalizer()
- Implemented support for custom tab switch function in the tab control taglib. Use TabControl.setSwitchFunction().
comment:8 by , 12 years ago
(In [6161]) References #1729 and #1730.
- Added support for 'onactivate' event handlers in the tab control taglib.
- Changed custom event names to use 'base-' as prefix to avoid clashes ('activate' is used by IE), so the new names are 'base-activate' and 'base-validate'
- Added support for remembering last active tab in a tab control.
comment:9 by , 12 years ago
comment:10 by , 12 years ago
comment:11 by , 12 years ago
comment:13 by , 12 years ago
comment:14 by , 12 years ago
(In [6173]) References #1729: Move in-page <script> elements to external *.js files
Moved <body onload> script so that it is executed among the last scripts. This is needed since the onload script ususally sets focus, etc. in a form, but the TabControl taglib need to have activated the correct tab first, or the focus is lost again.
comment:15 by , 12 years ago
comment:16 by , 12 years ago
comment:17 by , 12 years ago
(In [6182]) References #1729 and #1730.
Started to work with the <table> taglib. So far the following have been fixed:
- The page navigator
- The 'view/preset' dialog box
- Sorting and filtering on most column types (except enumerations)
As a consequence of the above, the presetOnChange()
function on most list pages have been removed and the configureColumns()
have been simplified.
comment:18 by , 12 years ago
comment:19 by , 12 years ago
comment:20 by , 12 years ago
comment:21 by , 12 years ago
comment:23 by , 12 years ago
comment:24 by , 12 years ago
comment:25 by , 12 years ago
comment:26 by , 12 years ago
(In [6192]) References #1729 and #1730.
Refactored the code for displaying a popup message when loading a page. The message should now be stored as a session setting instead: sc.setSessionSetting("alert-message", message)
. The added benefit is that the message is only displayed once and is not re-displayed if the page is reloaded.
Removed onunload
, onkeypress
and attributes
from the <base:body> tag. Added support for dynamic attributes instead.
comment:27 by , 12 years ago
comment:28 by , 12 years ago
comment:29 by , 12 years ago
comment:30 by , 12 years ago
comment:31 by , 12 years ago
comment:32 by , 12 years ago
comment:33 by , 12 years ago
comment:34 by , 12 years ago
comment:35 by , 12 years ago
(In [6218]) References #1729 and #1730. Fixed on the 'edit news' page and started on the 'view news' page. Need a lot more support in the main javascript libraries. Have started to introduce event handlers and related for 'edit', 'delete' and 'restore' functionality. Callback methods are currently handled by sending a notification event (base-notify) to a auto-generated temporary <div> tag. There are still some problems with it if, for example, a different action is needed.
comment:36 by , 12 years ago
(In [6219]) References #1729 and #1730. Implemented support for dynamic attributes in the toolbar button extension. Added DynamicActionAttributes
interface to be implemented by actions that support it. Support is also needed in the renderers (can be done by extending from the AbstractHtmlRenderer
class) and action factories. By default all action factories inheriting from AbstractJspFactory
get support for dynamic attributes, but implementation probably need to forward the attributes to the actual action beans (easy if the action bean extends from DynamicActionAttributeSupport
.
The XmlLoader
has also been updated to accept parameter tags with hyphens since most dynamic attributes that we use are data-* attributes.
Finally, the help button on 'view news' page has been used as a test bed for this feature and the example extensions are also about to be updated.
comment:37 by , 12 years ago
comment:38 by , 12 years ago
comment:39 by , 12 years ago
(In [6222]) References #1729 and #1730. Fixed for the software pages. Includes adding support for 'Share' and 'Set owner' buttons. Added support for using custom events instead of callback methods to return selected items. Slightly tested with the 'Edit project' page, but need a page with updated script for full testing.
comment:40 by , 12 years ago
comment:41 by , 12 years ago
comment:42 by , 12 years ago
comment:43 by , 12 years ago
comment:44 by , 12 years ago
comment:45 by , 12 years ago
comment:47 by , 12 years ago
(In [6246]) References #1729 and #1730. Implement lazy loading of 'Annotations'/'Inherited annotations' as a tab activation event instead of replacing the 'switchTab' function in the tab-control taglib. Done for the biosurce and sample edit dialogs.
Also improved the implementation so that the last parameters used are kept in the common code and the edit dialogs no longer has to keep track of when a protocol is changed or when the parent item selection changes.
comment:48 by , 12 years ago
comment:49 by , 12 years ago
comment:50 by , 12 years ago
comment:51 by , 12 years ago
comment:52 by , 12 years ago
comment:53 by , 12 years ago
comment:54 by , 12 years ago
comment:55 by , 12 years ago
comment:57 by , 11 years ago
comment:58 by , 11 years ago
comment:59 by , 11 years ago
comment:60 by , 11 years ago
comment:61 by , 11 years ago
comment:62 by , 11 years ago
comment:63 by , 11 years ago
comment:64 by , 11 years ago
comment:65 by , 11 years ago
comment:66 by , 11 years ago
comment:67 by , 11 years ago
comment:68 by , 11 years ago
(In [6306]) References #1729 and #1730. Fixed on several pages in the Biomaterial/Array LIMS sections.
comment:69 by , 11 years ago
(In [6307]) References #1729 and #1730. Fixed on more pages in the Biomaterial/Array LIMS sections.
comment:70 by , 11 years ago
comment:71 by , 11 years ago
comment:72 by , 11 years ago
comment:73 by , 11 years ago
comment:74 by , 11 years ago
comment:75 by , 11 years ago
comment:76 by , 11 years ago
comment:77 by , 11 years ago
comment:78 by , 11 years ago
comment:79 by , 11 years ago
comment:80 by , 11 years ago
comment:81 by , 11 years ago
comment:82 by , 11 years ago
(In [6342]) References #1729 and #1730.
Moved Main.show()
, Main.hide()
and related functions to Doc
namespace.
Moved Main.addClass()
, Main.removeClass()
and related function to Doc
namespace.
New feature is that all functions can be used with id or document element.
Use existing function in App
namespace for Main.getWindowHeight()
and Main.getWindowWidth()
.
comment:83 by , 11 years ago
comment:84 by , 11 years ago
comment:85 by , 11 years ago
(In [6380]) References #1729 and #1730. The Joust menu tree on the extensions overview page has been fixed. The joust-2.js script is still missing some functionality and error checking. For example, no support for lazy initialization.
Most icons have been reszied to 18x18 pixels. The old icons was a mess with a mix of 16x16, 18x16 and 18x18.
comment:86 by , 11 years ago
comment:87 by , 11 years ago
comment:88 by , 11 years ago
comment:89 by , 11 years ago
comment:90 by , 11 years ago
comment:91 by , 11 years ago
comment:92 by , 11 years ago
comment:93 by , 11 years ago
comment:94 by , 11 years ago
comment:95 by , 11 years ago
comment:96 by , 11 years ago
(In [6393]) References #1729 and #1730. The configure plugin/job dialog is now fixed. Also made a change in the 'NullPlugin' so that it is possible to test better in the web interface. A side effect is that the 'Test with file' function is no longer working, so this need to be fixed as well.
comment:97 by , 11 years ago
comment:98 by , 11 years ago
comment:99 by , 11 years ago
comment:100 by , 11 years ago
comment:101 by , 11 years ago
comment:102 by , 11 years ago
comment:103 by , 11 years ago
comment:104 by , 11 years ago
comment:105 by , 11 years ago
(In [6402]) References #1729. Add support in <base:head> taglib for including <script> elements in included pages. This makes it easier for those pages to use the <base:head> taglib to include javascript (but they need to be aware tht the relative paths are relative to the parent jsp (--> absolute paths need to be used in most cases).
comment:106 by , 11 years ago
comment:107 by , 11 years ago
comment:109 by , 11 years ago
comment:110 by , 11 years ago
comment:111 by , 11 years ago
comment:112 by , 11 years ago
comment:113 by , 11 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
(In [6150]) References #1729: Move in-page <script> elements to external *.js files
Moved global functions
getRoot()
,getSessionId()
etc. to the main.js file. Values that are needed for those functions are instead included as<body data-* >
attributes.