-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathleftFrame.php
228 lines (176 loc) · 3.57 KB
/
leftFrame.php
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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
<?
require_once("autoInclude.php");
require_once("sessionStart.php");
?>
<html>
<head>
<!--
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js"></script>
-->
<script type="text/javascript" src="/consle/scripts/jquery.min.js"></script>
<script type="text/javascript" src="defaultHandler.js"></script>
<script>
///////////
// Support functions for handler
///////////
function Link()
{
this._id = null;
this.url = null;
this.x = null;
this.y = null;
this.remove = function()
{
$.getJSON(
"link.php?action=remove&_id="+this._id,
function(data) {
// It should return true
// alert("Remove return("+data+")");
}
);
}
this.close = function()
{
}
}
</script>
<script>
///////////////
//public var
///////////////
var keyword;
var query;
var searchSessionId;
<?
print "keyword='".$_GET["keyword"]."';";
print "query='".$_GET["query"]."';";
?>
function getQueryParam(url, key)
{
var uParts = url.split("?");
if (uParts.length <= 1)
{
return null;
}
gy = uParts[1].split("&");
for (i=0;i<gy.length;i++)
{
ft = gy[i].split("=");
if (ft[0] == key)
{
return ft[1];
}
}
}
function showDebug(msg)
{
var debugText = document.getElementById("debugText");
debugText.innerHTML = msg;
}
function linkEnter(x, y)
{
//showDebug(document.location+x+y);
}
function linkDragging(x, y)
{
//showDebug(x +","+y);
}
function linkExit()
{
//showDebug("Exit");
}
function linkDropped(x, y, url)
{
var insideUrl = getQueryParam(url, "url");
if (insideUrl != null)
{
url = unescape(insideUrl);
}
var newLink = new Link();
newLink._id = "";
newLink.url = url;
newLink.x = x;
newLink.y = y;
showLink(newLink);
$.getJSON(
"link.php?action=add&keyword="+keyword+"&query="+query+"&searchSessionId="+searchSessionId+"&x="+x+"&y="+y+"&url="+url,
function(data) {
// it will return id of newly added link _id
newLink._id = data;
}
);
}
function showLinkExtra(x, y, url, _id)
{
var newLink = new Link();
newLink._id = _id;
newLink.url = url;
newLink.x = x;
newLink.y = y;
showLink(newLink);
}
</script>
<script type="text/javascript" src="communication.js"></script>
<link href="global.css" media="screen" rel="stylesheet" type="text/css" />
<link href="defaultCss.css" media="screen" rel="stylesheet" type="text/css" />
<style>
body{text-align:left;}
a.bookmarkLink{}
</style>
</head>
<body>
<div id="debugText">
<!--
No debug text
-->
</div>
<div id="links">
</div>
</body>
<script>
/*
$(document).ready(function(){
*/
<?
// First of all get sessionId
if (isset($_GET["searchSessionId"]))
{
$searchSession = Session::navigateTo($sessionId);
if ($searchSession == null)
{
// print "alert('No ".$_GET["navigateTo"]." session available');";
$searchSession = Session::getById($sessionId);
}
}
else
{
// keyword & query is set
// strip # from the query keyword
// convert ""
//query =
$searchSession = Session::getByKeywordAndQuery($sessionId);
}
//$links = Link::getAll($sessionId);
print "searchSessionId='".$searchSession["_id"]."';";
?>
// Also setting searchSessionId in parent docuement
//if (parent != null)
if (parent != null)
{
parent.searchSessionId = '<? print $searchSession["_id"]; ?>';
parent.query = '<? print $searchSession["query"]; ?>';
parent.setRestQuery('<? print $searchSession["query"]; ?>');
}
<?
$links = Link::getAllBySearchSessionId($sessionId, $searchSession["_id"]);
if ($links != null)
foreach ($links as $link)
{
print "showLinkExtra(".$link["x"].",".$link["y"].",'".$link["url"]."', '".$link["_id"]."');";
}
?>
/*
});
*/
</script>
</html>