Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
synergy-components
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
community
synergy-components
Commits
7ce3e018
Commit
7ce3e018
authored
Apr 09, 2018
by
Sergey Antonovich
🇯🇵
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update devTools-Interpreter.md
parent
9ceadf09
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
1 deletion
+1
-1
interpreter/devTools-Interpreter.md
interpreter/devTools-Interpreter.md
+1
-1
No files found.
interpreter/devTools-Interpreter.md
View file @
7ce3e018
...
...
@@ -62,7 +62,7 @@
## Инструкция по использованию
*
Добавить скрипт в интерпретатор и использовать.
*
Добавить скрипт в интерпретатор и
можно
использовать.
```
javascript
function
devTools
(){
let
accessData
=
false
;
let
formData
=
false
;
let
formUUID
=
false
;
this
.
load
=
function
(
dataUUID
){
var
content
=
this
.
api
(
'
asforms/data/
'
+
dataUUID
);
accessData
=
(
content
.
errorCode
!=
'
13
'
);
formUUID
=
dataUUID
;
formData
=
content
.
data
;
return
this
;};
this
.
getData
=
function
(){
if
(
!
accessData
)
return
;
return
formData
;};
this
.
getUUID
=
function
(){
if
(
!
accessData
)
return
;
return
formUUID
;};
this
.
getDocumentId
=
function
(
dataUUID
){
return
this
.
api
(
'
asforms/data/document?dataUUID=
'
+
dataUUID
)};
this
.
getDataUUID
=
function
(
documentId
){
return
""
+
this
.
api
(
'
formPlayer/getAsfDataUUID?documentID=
'
+
documentId
,{},
'
GET
'
,
true
);};
this
.
getValue
=
function
(){
if
(
!
accessData
)
return
;
var
data
;
var
args
=
{
c
:
arguments
[
0
],
ot
:
arguments
[
1
],
b
:
arguments
[
2
],
o
:
arguments
[
3
]};
if
(
typeof
(
args
.
c
)
===
'
string
'
&&
typeof
(
args
.
b
)
===
'
number
'
){
formData
.
forEach
(
function
(
item
){
if
(
item
.
id
==
args
.
ot
){
item
.
data
.
forEach
(
function
(
bItem
){
if
(
bItem
.
id
.
indexOf
(
args
.
c
+
'
-b
'
+
args
.
b
)
!==-
1
){
data
=
(
args
.
o
)?
bItem
[
args
.
o
]:
bItem
;
return
;}});
return
;}});}
else
{
formData
.
forEach
(
function
(
item
){
if
(
item
.
id
==
args
.
c
){
data
=
(
args
.
ot
)?
item
[
args
.
ot
]:
item
;
return
;}});}
return
data
;};
this
.
setValue
=
function
(){
if
(
!
accessData
)
return
;
var
args
=
{
c
:
arguments
[
0
],
vt
:
arguments
[
1
],
ob
:
arguments
[
2
],
v
:
arguments
[
3
],
o
:
arguments
[
4
]};
if
(
typeof
(
args
.
c
)
===
'
string
'
&&
typeof
(
args
.
ob
)
===
'
number
'
){
if
(
args
.
ob
==
0
)
args
.
ob
=
1
;
formData
.
forEach
(
function
(
item
){
if
(
item
.
id
==
args
.
vt
){
item
.
data
.
forEach
(
function
(
bItem
){
if
(
bItem
.
id
.
indexOf
(
args
.
c
+
'
-b
'
+
args
.
ob
)
!==-
1
){
if
(
typeof
(
args
.
v
)
===
'
object
'
)
for
(
var
aItem
in
args
.
v
)
bItem
[
aItem
]
=
args
.
v
[
aItem
];
else
bItem
[(
args
.
o
)?
args
.
o
:
'
value
'
]
=
args
.
v
;
return
;}});
return
;}});}
else
{
formData
.
forEach
(
function
(
item
){
if
(
item
.
id
==
args
.
c
){
if
(
typeof
(
args
.
vt
)
===
'
object
'
)
for
(
var
aItem
in
args
.
vt
)
item
[
aItem
]
=
args
.
vt
[
aItem
];
else
item
[(
args
.
ob
)?
args
.
ob
:
'
value
'
]
=
args
.
vt
;
return
;}});}};
this
.
getRowCount
=
function
(
tableID
){
if
(
!
accessData
)
return
;
var
len
=
0
;
formData
.
forEach
(
function
(
item
){
if
(
item
.
id
==
tableID
){
item
.
data
.
forEach
(
function
(
tblItem
){
var
regex
=
tblItem
.
id
.
match
(
/
\-
b
(\d
+
)
/
);
if
(
regex
&&
parseInt
(
regex
[
1
])
>
len
)
len
++
;});
return
;}});
return
len
;};
this
.
convertTable
=
function
(
data
){
if
(
!
accessData
)
return
;
var
conArr
=
[];
var
b
;
data
.
forEach
(
function
(
item
){
if
(
item
.
id
.
indexOf
(
'
-b
'
)
!==-
1
&&
(
b
=
item
.
id
.
match
(
/
(
.+
)\-
b
(\d
+
)
/
))){
if
((
b
[
2
]
in
conArr
)
===
false
)
conArr
[
b
[
2
]]
=
{};
conArr
[
b
[
2
]][
b
[
1
]]
=
item
;
return
;}});
for
(
var
i
=
0
;
i
<
conArr
.
length
;
i
++
)
if
(
conArr
[
i
]
==
null
)
conArr
.
splice
(
i
--
,
1
);
return
conArr
;};
this
.
save
=
function
(){
if
(
!
accessData
)
return
;
var
save
=
this
.
api
(
'
asforms/data/save
'
,{
uuid
:
formUUID
,
data
:
'
"data":
'
+
JSON
.
stringify
(
formData
)},
'
POST
'
);
return
(
save
==
'
200
'
);};
this
.
destroy
=
function
(){
accessData
=
formData
=
formUUID
=
false
;};
this
.
api
=
function
(
method
,
params
,
type
,
dataText
){
if
(
!
method
)
return
;
if
(
!
type
)
type
=
'
GET
'
;
var
host
=
"
http://127.0.0.1:8080/Synergy/rest/api/
"
;
var
client
=
new
org
.
apache
.
commons
.
httpclient
.
HttpClient
();
var
creds
=
new
org
.
apache
.
commons
.
httpclient
.
UsernamePasswordCredentials
(
login
,
password
);
client
.
getParams
().
setAuthenticationPreemptive
(
true
);
client
.
getState
().
setCredentials
(
org
.
apache
.
commons
.
httpclient
.
auth
.
AuthScope
.
ANY
,
creds
);
switch
(
type
){
case
'
GET
'
:
var
_p
=
[];
for
(
var
p
in
params
)
_p
.
push
(
p
+
'
=
'
+
params
[
p
]);
var
api
=
new
org
.
apache
.
commons
.
httpclient
.
methods
.
GetMethod
(
host
+
method
+
_p
.
join
(
'
&
'
));
api
.
setRequestHeader
(
"
Content-type
"
,
"
application/json
"
);
client
.
executeMethod
(
api
);
var
result
=
api
.
getResponseBodyAsString
();
break
;
case
'
POST
'
:
var
api
=
new
org
.
apache
.
commons
.
httpclient
.
methods
.
PostMethod
(
host
+
method
);
for
(
var
p
in
params
)
api
.
addParameter
(
p
,
params
[
p
]);
api
.
setRequestHeader
(
"
Content-type
"
,
"
application/x-www-form-urlencoded; charset=utf-8
"
);
var
result
=
client
.
executeMethod
(
api
);
break
;
default
:
return
;}
api
.
releaseConnection
();
return
(
!
dataText
?
JSON
.
parse
(
result
):
result
);};
this
.
log
=
function
(
data
){
var
logViewer
=
function
(
data
){
if
(
typeof
(
data
)
!=
'
string
'
)
data
=
JSON
.
stringify
(
data
,
null
,
4
);
data
=
data
.
replace
(
/&/g
,
'
&
'
).
replace
(
/</g
,
'
<
'
).
replace
(
/>/g
,
'
>
'
);
return
data
.
replace
(
/
(
"
(\\
u
[
a-zA-Z0-9
]{4}
|
\\[^
u
]
|
[^\\
"
])
*"
(\s
*:
)?
|
\b(
true|false|null
)\b
|-
?\d
+
(?:\.\d
*
)?(?:[
eE
][
+
\-]?\d
+
)?)
/g
,
function
(
match
){
var
cls
=
'
number
'
;
if
(
/^"/
.
test
(
match
)){
cls
=
(
/:$/
.
test
(
match
)?
'
key
'
:
'
string
'
);}
else
if
(
/true|false/
.
test
(
match
)){
cls
=
'
boolean
'
;}
else
if
(
/null/
.
test
(
match
)){
cls
=
'
null
'
;}
return
'
<span class="log-color-
'
+
cls
+
'
">
'
+
match
+
'
</span>
'
;});};
data
=
'
<pre style="color:#fff;background:#282828;border:0;font-size:14px;">
'
+
logViewer
(
data
)
+
'
</pre>
'
;
var
styleW
=
'
.log{width:850px;max-height:540px;border:1px solid #b3b3b3;border-radius:3px;padding:8px;background:#282828;color:#fff;overflow:auto;}
'
;
var
styleC
=
'
.log-color-key{color:#ff7a00;}.log-color-string{color:#f9f9b3;}.log-color-null{color:#9771ff;}.log-color-number{color:#00b3ff;}.log-color-boolean{color:#3ef38a;}
'
;
var
styleWP
=
'
.alert-success{color:rgba(0,0,0,1);background-color:#dedede;border-color:#b3b3b3;}
'
;
var
window
=
'
<style>
'
+
styleWP
+
styleW
+
styleC
+
'
</style><div class="log">
'
+
data
+
'
</div>
'
;
return
window
;};
return
this
;};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment