Difference between revisions of "Javascript API"

From OpenKM Documentation
Jump to: navigation, search
Line 2: Line 2:
  
 
== General Functions ==
 
== General Functions ==
* jsI18n(String) - Returns frontend trasnlation where String is the translation key
+
* jsI18n(String) - Returns frontend trasnlation where String is the translation key.
* jsOpenWikiPage(String) - Open wiki page where String is wiki title  
+
* jsOpenWikiPage(String) - Open wiki page where String is wiki title.
* jsOpenUserTaskInstance(String) -  
+
* 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.
* i18n(String) - Returns frontend trasnlation where String is the translation key ( deprecated )
+
* jsopenPathByUuid(String) - Open some path in OpenKM UI where String indicates uuid.
* openWikiPage(String) - Open wiki page where String is wiki title ( deprecated )
+
* jsRefreshFolder() - Refresh ui, same as toolbar refresh button
* openPath(String, String) - Open some path in OpenKM UI. First String is folder path, second string is document path. ( deprecated )
+
* 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 ).
  
 
== Specific Cryptography Functions ==
 
== Specific Cryptography Functions ==
Line 15: Line 20:
 
* digitalSignatureCanceled() - Cancelling digital signature has been canceled.
 
* digitalSignatureCanceled() - Cancelling digital signature has been canceled.
 
* startDigitalSignature() - Start digital signature.
 
* startDigitalSignature() - Start digital signature.
 +
 +
== Specific Applets Functions ==
 +
* destroyScannerApplet() - Indicates should be cleaned the scanner applet
 +
* destroyUploaderApplet() - Indicates should be cleaned the uploader applet
 +
 +
== How expose GWT public methods to JS ==
 +
 +
Example how to expose internall methow i18n to public js as jsI18n
 +
<source lang="java">
 +
/**
 +
* initJavaScriptApi
 +
*/
 +
native void initJavaScriptApi() /*-{
 +
$wnd.jsI18n = function(s) {
 +
return @com.openkm.frontend.client.Main::i18n(Ljava/lang/String;)(s);
 +
};
 +
}-*/;
 +
</source>
 +
 +
 +
For more information take a look at [[https://developers.google.com/web-toolkit/doc/latest/DevGuideCodingBasicsJSNI latest GWT DevGuideCodingBasicsJSNI]]
  
 
[[Category: Extension Guide]]
 
[[Category: Extension Guide]]

Revision as of 08:35, 27 August 2012

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 embeded 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 ).

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

How expose GWT public methods to JS

Example how to expose internall methow 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);
		};
	}-*/;


For more information take a look at [latest GWT DevGuideCodingBasicsJSNI]