Opened 12 years ago
Closed 11 years ago
#1730 closed task (fixed)
Move in-page onEvent attributes 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 an important step towards implementing a 'Content Security Policy' (#1712).
All in-page onclick
, onmouse
and other event handlers must be moved out to external javascript files. The events should be attached to the controls by addEventListener
calls.
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 (108)
comment:1 by , 12 years ago
Milestone: | BASE Future Release → BASE 3.3 |
---|
comment:2 by , 12 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:3 by , 12 years ago
comment:4 by , 12 years ago
comment:5 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:6 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:7 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:8 by , 12 years ago
comment:9 by , 12 years ago
comment:10 by , 12 years ago
(In [6166]) References #1730: Move in-page onEvent attributes to external *.js files
- Fixed for the user settings dialog and the 'Reset list settings' dialog.
- Added a 'zoom' taglib which should make it easier to include the 'zoom' icon for textarea fields.
- Added new javascript function in main-2 for opening zoom dialog and calendar dialog
comment:11 by , 12 years ago
comment:12 by , 12 years ago
comment:14 by , 12 years ago
comment:15 by , 12 years ago
comment:16 by , 12 years ago
comment:17 by , 12 years ago
comment:18 by , 12 years ago
comment:19 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:20 by , 12 years ago
comment:21 by , 12 years ago
comment:22 by , 12 years ago
comment:23 by , 12 years ago
comment:25 by , 12 years ago
comment:26 by , 12 years ago
comment:27 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: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
(In [6198]) References #1730: Move in-page onEvent attributes to external *.js files
Removed obsolete javadoc in HideableSection.java
comment:33 by , 12 years ago
comment:34 by , 12 years ago
comment:35 by , 12 years ago
comment:36 by , 12 years ago
comment:37 by , 12 years ago
comment:38 by , 12 years ago
comment:39 by , 12 years ago
comment:40 by , 12 years ago
comment:41 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:42 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:43 by , 12 years ago
comment:44 by , 12 years ago
comment:45 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:46 by , 12 years ago
comment:47 by , 12 years ago
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:53 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:54 by , 12 years ago
comment:55 by , 12 years ago
comment:56 by , 12 years ago
comment:57 by , 12 years ago
comment:58 by , 12 years ago
comment:59 by , 12 years ago
comment:60 by , 12 years ago
comment:61 by , 12 years ago
comment:62 by , 12 years ago
comment:63 by , 12 years ago
comment:64 by , 12 years ago
comment:65 by , 12 years ago
comment:66 by , 12 years ago
comment:67 by , 12 years ago
comment:68 by , 12 years ago
comment:69 by , 12 years ago
comment:70 by , 12 years ago
comment:71 by , 12 years ago
comment:72 by , 11 years ago
comment:73 by , 11 years ago
(In [6306]) References #1729 and #1730. Fixed on several pages in the Biomaterial/Array LIMS sections.
comment:74 by , 11 years ago
(In [6307]) References #1729 and #1730. Fixed on more pages in the Biomaterial/Array LIMS sections.
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
comment:83 by , 11 years ago
comment:84 by , 11 years ago
comment:85 by , 11 years ago
comment:86 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:87 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: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
comment:97 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: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
comment:106 by , 11 years ago
comment:107 by , 11 years ago
comment:108 by , 11 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
(In [6155]) References #1730: Move in-page onEvent attributes to external *.js files
Tested on the BASE->Preferences page. All event handlers (except from taglibs) that are defined on that page should now be attached programmatically instead.
Added 'main-2.js' to hold all new stuff. Will eventually try to phase out the older javascript files as much as possible.
Added support for <dynamic-attributes> to taglibs. Implemented in the <button> taglib. The main reason is to be able to include 'data-*' attributes that are needed by the scripts.
Added support for setting 'id' attribute on the <html> tag.