Subversion Repositories SmartDukaan

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

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