forked from karimomaya/OTCL
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
164 lines (146 loc) · 8.85 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
<!DOCTYPE html>
<html>
<head>
<title>OTCL</title>
<link rel="stylesheet" href="/css/w3schools.css">
<link rel="stylesheet" href="/css/style.css">
<script type="text/javascript" src="base64js.min.js"></script>
</head>
<body>
<div class="w3-sidebar w3-bar-block w3-card w3-animate-right" style="display:none;right:0; width: 40%" id="rightMenu">
<button onclick="closeRightMenu()" class="w3-bar-item w3-button w3-large" style=" float: right; width: 10%;text-align: right;">×</button>
<div class="oqlhelper">
<button class="collapsible">Declare Variables</button>
<div class="content">
<p class="tips">
<b>Declare Variable:</b><br> <span class="red">$x = 1234;</span><br>
<b>Use Variable:</b><br> <span class="red">create folder 'name', x</span><br>
<b>Get id of created folder:</b><br> <span class="red">$x = create folder 'name', x</span><br>
</p>
</div>
<button class="collapsible">Create Nodes</button>
<div class="content">
<p class="tips">
<b>Create Document:</b><br> <span class="red">create document %name%, %parent_id%, %system_path%</span><br>
<b>Create Category:</b><br> <span class="red">create category %name%, %parent_id%, %file_name%</span><br>
<b>Create Channel:</b><br> <span class="red">create channel %name%, %parent_id%</span><br>
<b>Create Compound Document:</b><br> <span class="red">create compound_document %name%, %parent_id%</span><br>
<b>Create Folder:</b><br> <span class="red">create folder %name%, %parent_id%</span><br>
<b>Create News:</b><br> <span class="red">create news %name%, %parent_id%</span><br>
<b>Create Project:</b><br> <span class="red">create project %name%, %parent_id%</span><br>
<b>Create Shortcut:</b><br> <span class="red">create shortcut %name%, %parent_id%</span><br>
<b>Create Task:</b><br> <span class="red">create task %name%, %parent_id%</span><br>
<b>Create Task Group:</b><br> <span class="red">create task_group %name%, %parent_id%</span><br>
<b>Create Task List:</b><br> <span class="red">create task_list %name%, %parent_id%</span><br>
<b>Create Task Milistone:</b><br> <span class="red">create task_milistone %name%, %parent_id%</span><br>
<b>Create Virtual Folder:</b><br> <span class="red">create virtual_folder %name%, %parent_id%</span><br>
</p>
</div>
<button class="collapsible">Declare Permission</button>
<div class="content">
<p class="tips">
<ul>
<li style="font-size: 12px; font-weight: bold">Create file under config folder with extension .per</li>
<li style="font-size: 12px;font-weight: bold">XML must be look like this <br>
<span style="font-size:11px; color: red; font-weight: normal">
<?xml version="1.0" encoding="UTF-8"?>
 <permissions><br>
  <permission><br>
   <type>%user or role%</type><br>
   <name>%username or role name%</name><br>
   <access>%permission split by commans %</access><br>
  </permission><br>
  <permission><br>
   <type>%ownergroup%</type><br>
   <name>%group name%</name><br>
   <access>%permission split by commans %</access><br>
  </permission><br>
  <permission><br>
   <type>owner</type><br>
   <access>%permission split by comman%</access><br>
  </permission><br>
  <permission><br>
   <type>public</type><br>
   <access>%permission split by comman%</access><br>
  </permission><br>
 </permissions></li></span>
<li style="font-size: 12px;font-weight: bold">Supported Permission<br>
<span style="font-size:11px; color:red; font-weight: normal">see, seeContent, add, delete, deleteVersions, edit, editPermissions, modify, reserve</span>
</li>
<li style="font-size: 12px;font-weight: bold">Assign Permission to node<br>
<span style="font-size:11px; color:red; font-weight: normal">set permission %node_id%, "%file_name without .per extension%"</span>
</li>
</ul>
</p>
</div>
<button class="collapsible">Write native JS Code</button>
<div class="content">
<p class="tips">
<b>Write Javascript:</b><br> <span class="red"><%for(var i=0; i < 10; i++){ %> <br>create folder %name%, %parent_id% <br><%} %> </span><br>
</p>
</div>
</div>
</div>
<div class="w3-teal">
<!-- <button class="w3-button w3-teal w3-xlarge w3-right" onclick="openRightMenu()">☰</button> -->
<button class="w3-button w3-teal w3-xlarge w3-right" onclick="openRightMenu()">?</button>
<div class="w3-container">
<h1>OpenText Command Line - OTCL</h1>
</div>
</div>
<div class="container">
<div class="oqleditor">
<textarea class="w3-input w3-border" id="oql"></textarea>
<button class="w3-button w3-teal" style="margin-top: 10px;" onclick="submit()">Run</button>
</div>
</div>
<div class="container" id="tbl-holder">
</div>
<script type="text/javascript">
function Base64Encode(str, encoding = 'utf-8') {
var bytes = new (TextEncoder || TextEncoderLite)(encoding).encode(str);
return base64js.fromByteArray(bytes);
}
function b64EncodeUnicode(str) {
return btoa(encodeURIComponent(str).replace(/%([0-9A-F]{2})/g,
function toSolidBytes(match, p1) {
return String.fromCharCode('0x' + p1);
}));
}
function submit() {
var string = document.getElementById("oql").value;
var xhttp = new XMLHttpRequest();
var url = "http://localhost:3001/";
var params = 'otcl='+b64EncodeUnicode(string);
console.log(params);
xhttp.open('POST', url, true);
xhttp.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
xhttp.onreadystatechange = function() {//Call a function when the state changes.
if(xhttp.readyState == 4 && xhttp.status == 200) {
console.log(JSON.parse(xhttp.responseText));
}
}
xhttp.send(params);
}
function openRightMenu() {
document.getElementById("rightMenu").style.display = "block";
}
function closeRightMenu() {
document.getElementById("rightMenu").style.display = "none";
}
var coll = document.getElementsByClassName("collapsible");
var i;
for (i = 0; i < coll.length; i++) {
coll[i].addEventListener("click", function() {
this.classList.toggle("active");
var content = this.nextElementSibling;
if (content.style.display === "block") {
content.style.display = "none";
} else {
content.style.display = "block";
}
});
}
</script>
</body>
</html>