EXTJS.RPGLE copy - Mow Your Lawn

bookmarkalikeInternet and Web Development

Dec 14, 2013 (3 years and 7 months ago)

116 views

Source Member: QRPGLESRC/EXTJS

*----------------------------------------------------------------------------------

*CRTRPGMOD MODULE(ORUxx/EXTJS) SRCFILE(ORUxx/QRPGLESRC) SRCMBR(EXTJS) DBGVIEW(*ALL)

* TGTRLS(V5R3M0)

*CRTSRVPGM SRVPGM(ORUxx/EXTJS) MODULE(ORUxx/EXTJS) OPTION(*DUPPROC) TGTRLS(V5R3M0)

*----------------------------------------------------------------------------------
H nomain bnddir(
'ORUBND'
)
H copyright(
'Copyright (c) 2011 Aaron Bartell. All rights reserved.'
)

*-------------------------------------------------------------------------

*Prototypes

*-------------------------------------------------------------------------

/copy
qrpglecpy,JSON_H

/copy
qrpglecpy,EXTJS

*-------------------------------------------------------------------------

*Procedures

*-------------------------------------------------------------------------

/**
*
\brief
Show AlertBox notification
*
*Provide an easy to use sub procedure that wrappers the creation of an
* Ext.ux.AlertBox ui object.
*
*
\author
Aaron Bartell
*
* Valid options
* pDoc: top, bottom, left, right
* pIcon: error, happy, loading, sad, security, smile, success, warning, none
* pTimeout: integer value in seconds
**/
P ExtJS_AlertBox b export
D ExtJS_AlertBox pi
D pJsonObj *
D pClosable n value
D pDoc 6a value varying
D pIcon 8a value varying
D pMsg 1024a value varying
D pTimeOut 3 0 value
D pTitle 50a value varying
D
*je s *
D tmpStr s 1200a varying
D options s 256a varying
D apos c const(
''''
)
D blnRslt s 5a varying

/free

//

// show( [String title], [String message], [String icon], [Object options] )

//
tmpStr =

'AlertBox.show('
+
apos +
%trim
(pTitle) + apos +
', '
+
apos + pMsg + apos +
', '
+
apos + pIcon + apos;

if
pClosable <>
*blank
;

exsr
chkOption;
blnRslt =
'false'
;

if
pClosable;
blnRslt =
'true'
;

endif
;
options = options +
'closeable: '
+ blnRslt;

endif
;

if
pDoc <>
*blank
;

exsr
chkOption;
options = options +
'dock:'
+ apos + pDoc + apos;

endif
;

if
pTimeout <> 0;

exsr
chkOption;
options = options +
'timeout: '
+
%char
(pTimeOut);

endif
;
tmpStr = tmpStr +
',{'
+ options +
'});'
;
ExtJS_eval(pJsonObj: tmpStr);

return
;

//-----------------------------------------------------------

// Check to see if we need to add a comma to separate options

//-----------------------------------------------------------

begsr
chkOption;

if
options <>
*blank
;
options = options +
','
;

endif
;

endsr
;

/end-free
P e

/**
*
\brief
Set a component's value
*
*Provide an easy mechanism for setting a component's value
**/
P ExtJS_cmpSetValue...
P b export
D ExtJS_cmpSetValue...
D pi
D pJsonObj *
D pCmpNam 100a value varying
D pCmpVal 65535a value varying
D tmpStr s 65535a varying
D apos c const(
''''
)

/free
tmpStr =

'Ext.getCmp('
+ apos +
%trim
(pCmpNam) + apos +

').setValue('
+ apos + pCmpVal + apos +
')'
;
ExtJS_eval(pJsonObj: tmpStr);

return
;

/end-free
P e

/**
*
\brief
Show a component
*
*Provide an easy mechanism for showing and hiding a component
**/
P ExtJS_cmpShow b export
D ExtJS_cmpShow pi
D pJsonObj *
D pCmpNam 100a value varying
D tmpStr s 65535a varying
D apos c const(
''''
)

/free
tmpStr =

'Ext.getCmp('
+ apos +
%trim
(pCmpNam) + apos +
').show()'
;
ExtJS_eval(pJsonObj: tmpStr);

return
;

/end-free
P e

/**
*
\brief
Hide a component
*
*Provide an easy mechanism for showing and hiding a component
**/
P ExtJS_cmpHide b export
D ExtJS_cmpHide pi
D pJsonObj *
D pCmpNam 100a value varying
D tmpStr s 65535a varying
D apos c const(
''''
)

/free
tmpStr =

'Ext.getCmp('
+ apos +
%trim
(pCmpNam) + apos +
').hide()'
;
ExtJS_eval(pJsonObj: tmpStr);

return
;

/end-free
P e

/**
*
\brief
Specify raw Javascript statement to run
*
*
\author
Aaron Bartell
*
**/
P ExtJS_eval b export
D ExtJS_eval pi
D pJsonObj *
D pJavascriptStmt...
D 65535a value varying
D je s *

/free
je = json_create();
json_putString(je :
'eval'
:
%trim
(pJavascriptStmt));
jsona_putObject(pJsonObj : je);

return
;

/end-free
P e
Source Member: QRPGLECPY,EXTJS
D ExtJS_cmpSetValue...
D pr
D pJsonObj *
D pCmpNam 100a value varying
D pCmpVal 65535a value varying
D ExtJS_cmpShow pr
D pJsonObj *
D pCmpNam 100a value varying
D ExtJS_cmpHide pr
D pJsonObj *
D pCmpNam 100a value varying
D ExtJS_AlertBox pr
D pJsonObj *
D pClosable n value
D pDoc 6a value varying
D pIcon 8a value varying
D pMsg 1024a value varying
D pTimeOut 3 0 value
D pTitle 50a value varying
D ExtJS_eval pr
D pJsonObj *
D pJavascriptStmt...
D 65535a value varying
Source Member: QSRVSRC,EXTJS
STRPGMEXP PGMLVL(*CURRENT) SIGNATURE(
'EXTJS 1.0'
)
EXPORT SYMBOL(extjs_alertbox)
EXPORT SYMBOL(extjs_cmpshow)
EXPORT SYMBOL(extjs_cmpsetvalue)
EXPORT SYMBOL(extjs_cmphide)
EXPORT SYMBOL(extjs_eval)
ENDPGMEXP