Difference between revisions of "Javascript API"
From OpenKM Documentation
Line 8: | Line 8: | ||
* jsOpenUserTaskInstance(String) - Open dashboard workflow view with user taskinstance, where String is the taskinstance. | * jsOpenUserTaskInstance(String) - Open dashboard workflow view with user taskinstance, where String is the taskinstance. | ||
* jsOpenPath(String, String) - Open some path in OpenKM UI. First String is folder path, second string is document path. | * jsOpenPath(String, String) - Open some path in OpenKM UI. First String is folder path, second string is document path. | ||
− | * | + | * jsOpenPathByUuid(String) - Open some path in OpenKM UI where String indicates uuid. |
* jsRefreshFolder() - Refresh ui, same as toolbar refresh button | * jsRefreshFolder() - Refresh ui, same as toolbar refresh button | ||
* jsWizard(String, String) - Call wizard where first String is docPath and second String is json to string serialization of GWTFileUploadResponse bean. | * jsWizard(String, String) - Call wizard where first String is docPath and second String is json to string serialization of GWTFileUploadResponse bean. |
Latest revision as of 09:04, 17 February 2015
There're several UI javascript function public exposed. In some OpenKM customization cases is interesting accessing some public UI javascript functions ( take a look at this video tab embedded web application ).
General Functions
- jsI18n(String) - Returns frontend trasnlation where String is the translation key.
- jsOpenWikiPage(String) - Open wiki page where String is wiki title.
- jsOpenUserTaskInstance(String) - Open dashboard workflow view with user taskinstance, where String is the taskinstance.
- jsOpenPath(String, String) - Open some path in OpenKM UI. First String is folder path, second string is document path.
- jsOpenPathByUuid(String) - Open some path in OpenKM UI where String indicates uuid.
- jsRefreshFolder() - Refresh ui, same as toolbar refresh button
- jsWizard(String, String) - Call wizard where first String is docPath and second String is json to string serialization of GWTFileUploadResponse bean.
- i18n(String) - Returns frontend trasnlation where String is the translation key ( deprecated from openkm 6.x ).
- openWikiPage(String) - Open wiki page where String is wiki title ( deprecated from openkm 6.x ).
- openPath(String, String) - Open some path in OpenKM UI. First String is folder path, second string is document path. ( deprecated from openkm 6.x ).
- openPathByUuid(String) - Open some path in OpenKM UI where String indicates uuid. ( deprecated from openkm 6.x ).
- refreshFolder() - Refresh ui, same as toolbar refresh button ( deprecated from openkm 6.x ).
- jsOpenUserTaskInstance(taskInstanceId) - Open workflow with taskInstanceId
- jsCancelCheckout() - Cancel selected document checkout.
- jsGetActualPath() - Return actual path of selected tree node in navigator ( desktop view ).
- jsGetActualNodePath() - Return actual selected node path ( navigator or file brower ).
- jsGetActualNodeUUID() - Return actual selected node uuid ( navigator or file brower ).
- jsGetUser() - Return GWTUser object serialized to JSON.
Specific Cryptography Functions
- cryptographyLoaded() - Hide UI status indicating cryptography applet is yet loaded.
- digitalSignatureEnded() - Indicates digital signature has finished.
- digitalSignatureCanceled() - Cancelling digital signature has been canceled.
- startDigitalSignature() - Start digital signature.
Specific Applets Functions
- destroyScannerApplet() - Indicates should be cleaned the scanner applet
- destroyUploaderApplet() - Indicates should be cleaned the uploader applet
Specific HTMLEditor Functions
- jsSearchDocumentHTMLEditorPopup - Open search document popup
- jsSearchFolderHTMLEditorPopup - Open search folder popup
specific Wiki Functions
- jsOpenWikiPage(String) - Open wiki page with some title
- openWikiPage(String - Open wiki page with some title ( deprecated from openkm 6.x ).
How expose GWT public methods to JS
Example 1- how to expose static method called i18n to public js as jsI18n
/**
* initJavaScriptApi
*/
native void initJavaScriptApi() /*-{
$wnd.jsI18n = function(s) {
return @com.openkm.frontend.client.Main::i18n(Ljava/lang/String;)(s);
};
}-*/;
Example 2- How to expose non static method from class Toolbar.java to public js as jsRefreshFolder.
After Toolbar.java has been created can be called the initJavaScriptApi:
ToolBar toolBar = new ToolBar();
mainPanel.topPanel.toolBar.initJavaScriptApi(mainPanel.topPanel.toolBar);
Toolbar.java code:
/**
* initJavaScriptApi
*/
public native void initJavaScriptApi(ToolBar toolBar) /*-{
$wnd.jsRefreshFolder = toolBar.@com.openkm.frontend.client.widget.toolbar.ToolBar::executeRefresh();
}-*/;
For more information take a look at [latest GWT DevGuideCodingBasicsJSNI]