+- - def JSEscapeForHTMLInline(inJSStr): # Escape JS to the safe JS for the inline JS in HTML tags ATTENTION! Use it only if want to paste JS into HTML tag - not in <script> +- - def HTMLLinkURL(inURLStr, inTitleStr=None, inColorStr=None): # Generate HTML code of the simple URL link by the URL +- - def HTMLLinkJSOnClick(inJSOnClickStr, inTitleStr, inColorStr=None): # Generate HTML code of the simple URL link by the JS when onclickdev-linux
parent
a0e85bb795
commit
026a152dfc
@ -0,0 +1,34 @@
|
||||
# !ATTENTION - Current Control panel works only from pyOpenRPA v1.2.0!
|
||||
from pyOpenRPA import Orchestrator
|
||||
def CPRender(inGSettings):
|
||||
|
||||
lJSCheckVersion="""
|
||||
lT = 9;
|
||||
lY="123";
|
||||
console.log(lT+1);
|
||||
if (lT==9) {
|
||||
alert(123)
|
||||
}
|
||||
"""
|
||||
|
||||
lResultDict={
|
||||
"HeaderLeftText":"CP_TEST",
|
||||
"HeaderRightText":"NAME",
|
||||
"DataStorageKey":"", #Use key for set current dict in mGlobal.DataStorage["DataStorageKey"] on client side
|
||||
"SubheaderText":"",
|
||||
"BodyKeyValueList":[
|
||||
{"Key": "HTMLLinkURL", "Value": Orchestrator.Web.Basic.HTMLLinkURL(inURLStr="test",inColorStr="orange")},
|
||||
{"Key": "HTMLLinkJSOnClick", "Value": Orchestrator.Web.Basic.HTMLLinkJSOnClick(inJSOnClickStr=lJSCheckVersion, inTitleStr="!Click me!",inColorStr="green")},
|
||||
],
|
||||
"FooterText":"",
|
||||
"FooterButtonX2List":[],
|
||||
"FooterButtonX1List":[],
|
||||
"GlobalStorage": "" # UNCOMMENT FOR DEBUG PURPOSE TO WATCH inGSettings on client side
|
||||
}
|
||||
return lResultDict
|
||||
# Check in control panel, that process is runnning
|
||||
|
||||
#Orchestrator settings
|
||||
def SettingsUpdate(inGSettings):
|
||||
inGSettings["ControlPanelDict"]["RobotList"].append({"RenderFunction": CPRender, "KeyStr": "TEST"})
|
||||
return inGSettings
|
@ -0,0 +1,26 @@
|
||||
|
||||
# Escape JS to the safe JS for the inline JS in HTML tags ATTENTION! Use it only if want to paste JS into HTML tag - not in <script>
|
||||
# USAGE: JSEscapeForHTMLInline(inJSStr="lTest=\"Hello World\"; alert(\"lTest\")")
|
||||
def JSEscapeForHTMLInline(inJSStr):
|
||||
lResult = inJSStr.replace("\"",""")
|
||||
return lResult
|
||||
|
||||
# Generate HTML code of the simple URL link by the URL
|
||||
# USAGE: Orchestrator.Web.Basic.HTMLLinkURL(inURLStr="test",inColorStr="orange")
|
||||
# USAGE: Basic.HTMLLinkURL(inURLStr="test",inColorStr="orange")
|
||||
def HTMLLinkURL(inURLStr, inTitleStr=None, inColorStr=None):
|
||||
lCSSStyleStr = ""
|
||||
if not inTitleStr: inTitleStr = inURLStr
|
||||
if inColorStr: lCSSStyleStr=f"style=\"color:{inColorStr}\""
|
||||
lResult=f"<a {lCSSStyleStr} href=\"{inURLStr}\">{inTitleStr}</a>"
|
||||
return lResult
|
||||
|
||||
# Generate HTML code of the simple URL link by the JS when onclick
|
||||
# USAGE: Orchestrator.Web.Basic.HTMLLinkJSOnClick(inJSOnClickStr="",inColorStr="orange")
|
||||
# USAGE: Basic.HTMLLinkJSOnClick(inJSOnClickStr="test",inColorStr="orange")
|
||||
def HTMLLinkJSOnClick(inJSOnClickStr, inTitleStr, inColorStr=None):
|
||||
lCSSStyleStr = ""
|
||||
if inColorStr: lCSSStyleStr=f"style=\"color:{inColorStr}\""
|
||||
inJSOnClickStr= JSEscapeForHTMLInline(inJSStr=inJSOnClickStr) # Escape some symbols for the inline JS
|
||||
lResult=f"<a {lCSSStyleStr} onclick=\"{inJSOnClickStr}\">{inTitleStr}</a>"
|
||||
return lResult
|
@ -1,7 +1,8 @@
|
||||
r"""
|
||||
|
||||
The OpenRPA package (from UnicodeLabs)
|
||||
The pyOpenRPA package (from UnicodeLabs)
|
||||
|
||||
"""
|
||||
from .Web import Basic
|
||||
__all__ = []
|
||||
__author__ = 'Ivan Maslov <ivan.maslov@unicodelabs.ru>'
|
Loading…
Reference in new issue