| 242 |
naveen |
1 |
<!DOCTYPE html PUBLIC
|
|
|
2 |
"-//W3C//DTD XHTML 1.1 Transitional//EN"
|
|
|
3 |
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
|
4 |
|
|
|
5 |
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
|
6 |
<head>
|
| 1051 |
rajveer |
7 |
#set($sequence = $action.getSlideSequence())
|
| 242 |
naveen |
8 |
<title>Select Slides - $action.getId()</title>
|
|
|
9 |
|
|
|
10 |
|
|
|
11 |
<script type="text/javascript" src="/content/jquery/jquery-1.4.2.js"></script>
|
|
|
12 |
<script type="text/javascript" src="/content/jquery/jqueryui/ui/jquery.ui.core.js"></script>
|
|
|
13 |
<script type="text/javascript" src="/content/jquery/jqueryui/ui/jquery.ui.widget.js"></script>
|
|
|
14 |
<script type="text/javascript" src="/content/jquery/jqueryui/ui/jquery.ui.position.js"></script>
|
| 1068 |
rajveer |
15 |
<script type="text/javascript" src="/content/jquery/jqueryui/ui/jquery.ui.dialog.js"></script>
|
| 242 |
naveen |
16 |
<script type="text/javascript" src="/content/jquery/validation/jquery.validate.js"></script>
|
|
|
17 |
|
| 1051 |
rajveer |
18 |
<script type="text/javascript" src="/content/jquery/jqueryui/ui/jquery.ui.mouse.js"></script>
|
|
|
19 |
<script type="text/javascript" src="/content/jquery/jqueryui/ui/jquery.ui.draggable.js"></script>
|
|
|
20 |
<script type="text/javascript" src="/content/jquery/jqueryui/ui/jquery.ui.resizable.js"></script>
|
|
|
21 |
<script type="text/javascript" src="/content/jquery/jqueryui/ui/jquery.effects.core.js"></script>
|
|
|
22 |
<script type="text/javascript" src="/content/jquery/jqueryui/ui/jquery.effects.blind.js"></script>
|
|
|
23 |
<script type="text/javascript" src="/content/jquery/jqueryui/ui/jquery.effects.drop.js"></script>
|
|
|
24 |
<script type="text/javascript" src="/content/jquery/jquery.chained.js"></script>
|
|
|
25 |
<script type="text/javascript" src="/content/jquery/jquery.tablesorter.js"></script>
|
|
|
26 |
|
|
|
27 |
|
| 1068 |
rajveer |
28 |
|
| 1051 |
rajveer |
29 |
<script type="text/javascript" src="/content/jquery/jquery.disable.text.select.pack.js"></script>
|
|
|
30 |
<script type="text/javascript" src="/content/jquery/jquery.listreorder.js"></script>
|
|
|
31 |
|
|
|
32 |
|
| 1068 |
rajveer |
33 |
<link type="text/css" href="/content/jquery/jqueryui/themes/ui-lightness/jquery.ui.all.css" rel="stylesheet" />
|
| 242 |
naveen |
34 |
<style>
|
|
|
35 |
|
|
|
36 |
* { font-family: Verdana; font-size: 96%; }
|
|
|
37 |
label { width: 10em; float: left; }
|
|
|
38 |
label.error { float: none; color: red; padding-left: .5em; vertical-align: top; }
|
|
|
39 |
p { clear: both; }
|
|
|
40 |
.submit { margin-left: 12em; }
|
|
|
41 |
em { font-weight: bold; padding-right: 1em; vertical-align: top; }
|
|
|
42 |
|
|
|
43 |
a.selected {
|
|
|
44 |
background-color:#1F75CC;
|
|
|
45 |
color:white;
|
|
|
46 |
z-index:100;
|
|
|
47 |
}
|
|
|
48 |
|
|
|
49 |
.pop {
|
|
|
50 |
background-color:#FFFFFF;
|
|
|
51 |
border:1px solid #999999;
|
|
|
52 |
cursor:default;
|
|
|
53 |
display:none;
|
|
|
54 |
margin-top: 15px;
|
|
|
55 |
position:absolute;
|
|
|
56 |
text-align:left;
|
|
|
57 |
width:394px;
|
|
|
58 |
z-index:50;
|
|
|
59 |
padding: 25px 25px 20px;
|
|
|
60 |
}
|
|
|
61 |
|
|
|
62 |
label {
|
|
|
63 |
display: block;
|
|
|
64 |
margin-bottom: 3px;
|
|
|
65 |
padding-left: 15px;
|
|
|
66 |
text-indent: -15px;
|
|
|
67 |
}
|
|
|
68 |
|
|
|
69 |
.pop p, .pop.div {
|
|
|
70 |
border-bottom: 1px solid #EFEFEF;
|
|
|
71 |
margin: 8px 0;
|
|
|
72 |
padding-bottom: 8px;
|
|
|
73 |
}
|
| 1068 |
rajveer |
74 |
|
|
|
75 |
div.dialog {
|
|
|
76 |
padding:12px;
|
|
|
77 |
font-family: "Trebuchet MS", "Arial", "Helvetica", "Verdana", "sans-serif";
|
|
|
78 |
}
|
|
|
79 |
|
| 242 |
naveen |
80 |
</style>
|
|
|
81 |
|
|
|
82 |
#set ($allslidesdata = $action.getAllSlidesData())
|
|
|
83 |
#set ($mandatoryLabels = $action.getMandatorySlideLabels())
|
| 480 |
rajveer |
84 |
|
| 242 |
naveen |
85 |
<script>
|
| 480 |
rajveer |
86 |
function popup(mylink, windowname)
|
|
|
87 |
{
|
|
|
88 |
if (! window.focus)return true;
|
|
|
89 |
var href;
|
|
|
90 |
if (typeof(mylink) == 'string')
|
|
|
91 |
href=mylink;
|
|
|
92 |
else
|
|
|
93 |
href=mylink.href;
|
|
|
94 |
window.open(href, windowname, 'width=400,height=200,scrollbars=yes');
|
|
|
95 |
return false;
|
|
|
96 |
}
|
| 242 |
naveen |
97 |
|
| 480 |
rajveer |
98 |
</script>
|
|
|
99 |
|
|
|
100 |
<script>
|
|
|
101 |
|
| 242 |
naveen |
102 |
var required = [
|
|
|
103 |
#foreach ($label in $mandatoryLabels)
|
|
|
104 |
"$label"#if($velocityHasNext),#end
|
|
|
105 |
#end
|
|
|
106 |
];
|
|
|
107 |
|
|
|
108 |
$(document).ready(function() {
|
|
|
109 |
//alert("document ready");
|
|
|
110 |
$('.cancelbutton').click(function(e) {
|
|
|
111 |
//alert("Cancel clicked");
|
|
|
112 |
window.location.href = '/content/entity';
|
|
|
113 |
});
|
|
|
114 |
|
| 480 |
rajveer |
115 |
/*
|
|
|
116 |
$("input[name='10005']").change(function()
|
|
|
117 |
{
|
|
|
118 |
alert("Inside click");
|
|
|
119 |
|
|
|
120 |
var newcbx= $("input[name='10005']:clicked")[0];
|
|
|
121 |
|
|
|
122 |
alert("id is " + newcbx.id);
|
|
|
123 |
var id = newcbx.id;
|
|
|
124 |
$(id).show("fast");
|
|
|
125 |
|
|
|
126 |
});
|
|
|
127 |
*/
|
|
|
128 |
|
| 242 |
naveen |
129 |
$('#slidesform').submit(function(e) {
|
|
|
130 |
allchecked = new Array();
|
|
|
131 |
|
|
|
132 |
// Clear old error messages
|
|
|
133 |
$('#error').html("");
|
|
|
134 |
|
|
|
135 |
$(':checked').each(function(index) {
|
|
|
136 |
//alert($(this).attr('title'));
|
|
|
137 |
|
|
|
138 |
allchecked[index] = $(this).attr('title');
|
|
|
139 |
});
|
|
|
140 |
|
|
|
141 |
//alert('allchecked:' + allchecked);
|
|
|
142 |
missingrequired = jQuery.grep(required, function(n, i) {
|
|
|
143 |
//alert('n:' + n + ' index:' + jQuery.inArray(n, allchecked));
|
|
|
144 |
return (jQuery.inArray(n, allchecked) == -1);
|
|
|
145 |
});
|
|
|
146 |
|
|
|
147 |
if(missingrequired && missingrequired.length > 0) {
|
|
|
148 |
//alert('missingrequired:' + missingrequired);
|
|
|
149 |
$('#error').append('<span style="color:red">Missing required slides: ' + missingrequired + '</span>');
|
|
|
150 |
return false;
|
|
|
151 |
}
|
|
|
152 |
|
|
|
153 |
// FIXME - Is not the most efficient way
|
|
|
154 |
alldups = new Array();
|
|
|
155 |
j = 0;
|
|
|
156 |
for(i=0;i<allchecked.length;i++) {
|
|
|
157 |
duplicates = jQuery.grep(allchecked, function(n, index) {
|
|
|
158 |
return (n == allchecked[i]);
|
|
|
159 |
});
|
|
|
160 |
//alert("duplicates:" + duplicates);
|
|
|
161 |
|
|
|
162 |
if(duplicates.length > 1 && (jQuery.inArray(duplicates[0], alldups) == -1)) {
|
|
|
163 |
alldups[j] = duplicates[0];
|
|
|
164 |
j++;
|
|
|
165 |
}
|
|
|
166 |
}
|
|
|
167 |
|
|
|
168 |
if(alldups.length > 0) {
|
|
|
169 |
//alert("alldups:" + alldups);
|
|
|
170 |
$('#error').append('<span style="color:red">Duplicate slides: ' + alldups + '</span>');
|
|
|
171 |
return false;
|
|
|
172 |
}
|
|
|
173 |
|
|
|
174 |
return true;
|
|
|
175 |
});
|
| 480 |
rajveer |
176 |
|
|
|
177 |
$('#slidesorderform').submit(function(e) {
|
|
|
178 |
allchecked = new Array();
|
|
|
179 |
|
|
|
180 |
// Clear old error messages
|
|
|
181 |
$('#error').html("");
|
|
|
182 |
|
|
|
183 |
$(':checked').each(function(index) {
|
|
|
184 |
//alert($(this).attr('title'));
|
|
|
185 |
|
|
|
186 |
allchecked[index] = $(this).attr('title');
|
|
|
187 |
});
|
|
|
188 |
|
|
|
189 |
//alert('allchecked:' + allchecked);
|
|
|
190 |
missingrequired = jQuery.grep(required, function(n, i) {
|
|
|
191 |
//alert('n:' + n + ' index:' + jQuery.inArray(n, allchecked));
|
|
|
192 |
return (jQuery.inArray(n, allchecked) == -1);
|
|
|
193 |
});
|
|
|
194 |
|
|
|
195 |
if(missingrequired && missingrequired.length > 0) {
|
|
|
196 |
//alert('missingrequired:' + missingrequired);
|
|
|
197 |
$('#error').append('<span style="color:red">Missing required slides: ' + missingrequired + '</span>');
|
|
|
198 |
return false;
|
|
|
199 |
}
|
|
|
200 |
|
|
|
201 |
// FIXME - Is not the most efficient way
|
|
|
202 |
alldups = new Array();
|
|
|
203 |
j = 0;
|
|
|
204 |
for(i=0;i<allchecked.length;i++) {
|
|
|
205 |
duplicates = jQuery.grep(allchecked, function(n, index) {
|
|
|
206 |
return (n == allchecked[i]);
|
|
|
207 |
});
|
|
|
208 |
//alert("duplicates:" + duplicates);
|
|
|
209 |
|
|
|
210 |
if(duplicates.length > 1 && (jQuery.inArray(duplicates[0], alldups) == -1)) {
|
|
|
211 |
alldups[j] = duplicates[0];
|
|
|
212 |
j++;
|
|
|
213 |
}
|
|
|
214 |
}
|
|
|
215 |
|
|
|
216 |
if(alldups.length > 0) {
|
|
|
217 |
//alert("alldups:" + alldups);
|
|
|
218 |
$('#error').append('<span style="color:red">Duplicate slides: ' + alldups + '</span>');
|
|
|
219 |
return false;
|
|
|
220 |
}
|
|
|
221 |
|
|
|
222 |
return true;
|
|
|
223 |
});
|
| 242 |
naveen |
224 |
});
|
|
|
225 |
</script>
|
| 480 |
rajveer |
226 |
<style type="text/css">
|
|
|
227 |
#popupbox{
|
|
|
228 |
margin: 0;
|
|
|
229 |
margin-left: 40%; /* This gets it relatively center on the screen */
|
|
|
230 |
margin-right: 40%; /* This gets it relatively center on the screen */
|
|
|
231 |
margin-top: 50px; /* Makes it a little off the top of the screen */
|
|
|
232 |
padding-top: 10px; /* Make the text not touching the top on the login box */
|
|
|
233 |
width: 20%; /* For centering it on the screen */
|
|
|
234 |
height: 150px; /* The height of the login box */
|
|
|
235 |
position: relative; /* Makes sure its absolute so it doesn't dock with everything else */
|
|
|
236 |
background: #FBFBF0; /* Login Box background color. Change this if desired. */
|
|
|
237 |
border: solid #000000 2px; /* Makes a black border around the login box */
|
|
|
238 |
z-index: 9; /* Makes it on top of everything else */
|
|
|
239 |
font-family: arial; /* Sets the font */
|
|
|
240 |
visibility: hidden; /* Makes it hidden at first. Very Important.*/
|
|
|
241 |
}
|
|
|
242 |
|
|
|
243 |
</style>
|
|
|
244 |
<script language="JavaScript" type="text/javascript">
|
|
|
245 |
function orderform(showhide, slideid){
|
|
|
246 |
if(showhide == "show"){
|
|
|
247 |
document.getElementById('slideid').value=slideid;
|
|
|
248 |
document.getElementById('popupbox').style.visibility="visible";
|
|
|
249 |
|
|
|
250 |
}else if(showhide == "hide"){
|
|
|
251 |
document.getElementById('popupbox').style.visibility="hidden";
|
|
|
252 |
}
|
|
|
253 |
}
|
|
|
254 |
</script>
|
| 242 |
naveen |
255 |
</head>
|
|
|
256 |
<body>
|
|
|
257 |
<h1>Select Slides - $action.getId()</h1>
|
| 480 |
rajveer |
258 |
|
| 1051 |
rajveer |
259 |
<div>
|
| 1068 |
rajveer |
260 |
<a id="reorder" >Reorder</a>
|
| 1051 |
rajveer |
261 |
</div>
|
| 480 |
rajveer |
262 |
|
| 1051 |
rajveer |
263 |
|
|
|
264 |
|
| 242 |
naveen |
265 |
<form name="f" id="slidesform" action="/content/slides/$action.getId()" method="post">
|
|
|
266 |
|
|
|
267 |
#showbuttons()
|
|
|
268 |
|
|
|
269 |
<p id="error"/>
|
|
|
270 |
|
| 480 |
rajveer |
271 |
#set($selectstring = "")
|
| 242 |
naveen |
272 |
#foreach ($slidesdata in $allslidesdata)
|
| 480 |
rajveer |
273 |
#set ($firstslidedata = $slidesdata.get(0))
|
|
|
274 |
#foreach ($data in $slidesdata)
|
|
|
275 |
#if($data.get(5) == "1")
|
|
|
276 |
#set($optionstring = "<option id=" + $data.get(2) + " name=" + $firstslidedata.get(0) + " value=" + $data.get(2) + " > " + $data.get(2) + "-" + $data.get(3) + "</option>")
|
|
|
277 |
#set($selectstring = $selectstring + $optionstring)
|
|
|
278 |
#end
|
|
|
279 |
#end
|
|
|
280 |
#end
|
|
|
281 |
|
|
|
282 |
|
|
|
283 |
#foreach ($slidesdata in $allslidesdata)
|
| 242 |
naveen |
284 |
#if($velocityCount == 1)
|
|
|
285 |
#showslides ($slidesdata, 1)
|
| 480 |
rajveer |
286 |
|
| 242 |
naveen |
287 |
#else
|
| 480 |
rajveer |
288 |
#showslides ($slidesdata, 0, $selectstring)
|
| 242 |
naveen |
289 |
#end
|
|
|
290 |
#end
|
|
|
291 |
|
|
|
292 |
<input type="hidden" name="_method" value="put"/>
|
|
|
293 |
|
|
|
294 |
#showbuttons()
|
|
|
295 |
|
|
|
296 |
</form>
|
| 480 |
rajveer |
297 |
|
|
|
298 |
<div id="popupbox"> <!--Start login box-->
|
|
|
299 |
<form name="f1" id="slidesorderform" action="/content/slides/$action.getId()" method="post">
|
|
|
300 |
<center>After slide:</center>
|
|
|
301 |
<select id="afterslide" name="afterslide" value="afterslide"> $selectstring </select>
|
|
|
302 |
|
|
|
303 |
<input type="hidden" name="slideid" id="slideid" value=""/>
|
|
|
304 |
<input type="hidden" name="_method" value="put"/>
|
|
|
305 |
<center><input type="submit" name="submit" value="submit" /></center>
|
|
|
306 |
</form>
|
|
|
307 |
<br />
|
|
|
308 |
<center><a href="javascript:orderform('hide');">close</a></center> <!-- Closes the box-->
|
|
|
309 |
</div> <!--End login box-->
|
|
|
310 |
|
|
|
311 |
|
|
|
312 |
|
| 1051 |
rajveer |
313 |
<div style="display:none;">
|
| 1068 |
rajveer |
314 |
<div id="dialog-slides" title="Select an user to assign">
|
|
|
315 |
<p class="validateTips">All form fields are required.</p>
|
|
|
316 |
<form>
|
|
|
317 |
<fieldset>
|
|
|
318 |
<ul id="List B" class="lists">
|
|
|
319 |
#foreach($slide in $sequence)
|
|
|
320 |
<li>$slide</li>
|
|
|
321 |
#end
|
|
|
322 |
</ul>
|
|
|
323 |
</fieldset>
|
|
|
324 |
</form>
|
| 1051 |
rajveer |
325 |
</div>
|
|
|
326 |
</div>
|
|
|
327 |
|
|
|
328 |
|
|
|
329 |
<script type="text/javascript">
|
| 1068 |
rajveer |
330 |
var newOrder="";
|
| 1051 |
rajveer |
331 |
$(document).ready(function() {
|
|
|
332 |
var options = {
|
|
|
333 |
itemHoverClass : 'myItemHover',
|
|
|
334 |
dragTargetClass : 'myDragTarget',
|
|
|
335 |
dropTargetClass : 'myDropTarget',
|
|
|
336 |
useDefaultDragHandle : true
|
|
|
337 |
};
|
|
|
338 |
|
|
|
339 |
var lists = $('.lists').ListReorder(options);
|
|
|
340 |
|
|
|
341 |
lists.bind('listorderchanged', function(evt, jqList, listOrder) {
|
|
|
342 |
var str = jqList.attr('id') + " order changed: <br />"
|
| 1068 |
rajveer |
343 |
+ "\tcurrent -- original\n";
|
| 1051 |
rajveer |
344 |
for (var i = 0; i < listOrder.length; i++)
|
| 1068 |
rajveer |
345 |
str += "\t" + i + " -- " + listOrder[i] + "\n";
|
| 1051 |
rajveer |
346 |
|
| 1068 |
rajveer |
347 |
for (var i = 0; i < listOrder.length; i++)
|
|
|
348 |
{
|
|
|
349 |
if(i==0){
|
|
|
350 |
newOrder = listOrder[i];
|
|
|
351 |
}else{
|
|
|
352 |
newOrder += "-" + listOrder[i];
|
|
|
353 |
}
|
|
|
354 |
|
|
|
355 |
}
|
|
|
356 |
//alert(newOrder);
|
|
|
357 |
//alert(str);
|
| 1051 |
rajveer |
358 |
});
|
|
|
359 |
|
|
|
360 |
$('#reorder').click(function() {
|
|
|
361 |
$('#dialog-slides').dialog({
|
|
|
362 |
autoOpen: false,
|
|
|
363 |
width: 470,
|
| 1068 |
rajveer |
364 |
height: 400,
|
| 1051 |
rajveer |
365 |
modal: true,
|
|
|
366 |
title: 'Rearrange slides',
|
|
|
367 |
buttons: {
|
|
|
368 |
"OK":function() {
|
| 1068 |
rajveer |
369 |
//alert("rearrangement to be done" + newOrder);
|
|
|
370 |
window.location.href = "/content/slides/" + $action.getId() + "?_method=put&sequence=" + newOrder;
|
| 1051 |
rajveer |
371 |
},
|
|
|
372 |
"Cancel": function() { $(this).dialog("close"); }
|
|
|
373 |
}
|
|
|
374 |
});
|
|
|
375 |
|
|
|
376 |
$('#dialog-slides').dialog('open');
|
|
|
377 |
|
|
|
378 |
return false;
|
|
|
379 |
});
|
| 1068 |
rajveer |
380 |
|
|
|
381 |
});
|
| 1051 |
rajveer |
382 |
</script>
|
|
|
383 |
|
| 242 |
naveen |
384 |
</body>
|
|
|
385 |
</html>
|
|
|
386 |
|
|
|
387 |
#macro (showslides $slidesdata $count)
|
|
|
388 |
|
|
|
389 |
#set ($firstslidedata = $slidesdata.get(0))
|
|
|
390 |
<p/>
|
|
|
391 |
<h3>$firstslidedata.get(1) ($firstslidedata.get(0))</h3>
|
|
|
392 |
|
|
|
393 |
#foreach ($data in $slidesdata)
|
| 480 |
rajveer |
394 |
<input type="checkbox" #if($data.get(5) != "1") onclick="orderform('show','$data.get(2)')" #end id="$data.get(2)" name="$firstslidedata.get(0)" #if($data.get(5) == "1") checked="checked" #end value="$data.get(2)" title="$data.get(3)"> $data.get(2) - $data.get(3) #if($count == 1)<span style="font-style:italic">($data.get(4))</span>#end
|
|
|
395 |
<br/>
|
| 242 |
naveen |
396 |
#end
|
|
|
397 |
|
|
|
398 |
#end
|
|
|
399 |
|
|
|
400 |
#macro (showbuttons)
|
|
|
401 |
<p/>
|
|
|
402 |
<input type="button" class="cancelbutton" name="cancel" value="Cancel"/>
|
| 250 |
naveen |
403 |
<input type="submit" name="save" value="Save & Exit"/>
|
| 242 |
naveen |
404 |
<input type="submit" name="next" value="Save & Next >>"/>
|
|
|
405 |
#end
|
| 480 |
rajveer |
406 |
|