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>
7
<title>Select Slides - $action.getId()</title>
8
 
9
 
10
<script type="text/javascript" src="/content/jquery/jquery-1.4.2.js"></script>
11
<script type="text/javascript" src="/content/jquery/jqueryui/ui/jquery.ui.core.js"></script>
12
<script type="text/javascript" src="/content/jquery/jqueryui/ui/jquery.ui.widget.js"></script>
13
<script type="text/javascript" src="/content/jquery/jqueryui/ui/jquery.ui.position.js"></script>
14
<script type="text/javascript" src="/content/jquery/validation/jquery.validate.js"></script>
15
 
16
<style>
17
 
18
* { font-family: Verdana; font-size: 96%; }
19
label { width: 10em; float: left; }
20
label.error { float: none; color: red; padding-left: .5em; vertical-align: top; }
21
p { clear: both; }
22
.submit { margin-left: 12em; }
23
em { font-weight: bold; padding-right: 1em; vertical-align: top; }
24
 
25
a.selected {
26
  background-color:#1F75CC;
27
  color:white;
28
  z-index:100;
29
}
30
 
31
.pop {
32
  background-color:#FFFFFF;
33
  border:1px solid #999999;
34
  cursor:default;
35
  display:none;
36
  margin-top: 15px;
37
  position:absolute;
38
  text-align:left;
39
  width:394px;
40
  z-index:50;
41
  padding: 25px 25px 20px;
42
}
43
 
44
label {
45
  display: block;
46
  margin-bottom: 3px;
47
  padding-left: 15px;
48
  text-indent: -15px;
49
}
50
 
51
.pop p, .pop.div {
52
  border-bottom: 1px solid #EFEFEF;
53
  margin: 8px 0;
54
  padding-bottom: 8px;
55
}
56
</style>
57
 
58
#set ($allslidesdata = $action.getAllSlidesData())
59
#set ($mandatoryLabels = $action.getMandatorySlideLabels())
480 rajveer 60
 
242 naveen 61
<script>
480 rajveer 62
	function popup(mylink, windowname)
63
    {
64
    if (! window.focus)return true;
65
    var href;
66
    if (typeof(mylink) == 'string')
67
       href=mylink;
68
    else
69
       href=mylink.href;
70
    window.open(href, windowname, 'width=400,height=200,scrollbars=yes');
71
    return false;
72
    }
242 naveen 73
 
480 rajveer 74
</script>
75
 
76
<script>
77
 
242 naveen 78
var required = [
79
#foreach ($label in $mandatoryLabels)
80
"$label"#if($velocityHasNext),#end
81
#end
82
];
83
 
84
$(document).ready(function() {
85
    //alert("document ready");
86
    $('.cancelbutton').click(function(e) {
87
        //alert("Cancel clicked");
88
        window.location.href = '/content/entity';
89
    });
90
 
480 rajveer 91
/*
92
	$("input[name='10005']").change(function()
93
        {
94
         alert("Inside click");
95
 
96
		 var newcbx= $("input[name='10005']:clicked")[0];
97
 
98
	    alert("id is " + newcbx.id);
99
		var id = newcbx.id;
100
		 $(id).show("fast");
101
 
102
		});
103
	*/		
104
 
242 naveen 105
    $('#slidesform').submit(function(e) {
106
        allchecked = new Array();
107
 
108
        // Clear old error messages
109
        $('#error').html("");
110
 
111
        $(':checked').each(function(index) {
112
            //alert($(this).attr('title'));
113
 
114
            allchecked[index] = $(this).attr('title');
115
        });
116
 
117
        //alert('allchecked:' + allchecked);
118
        missingrequired = jQuery.grep(required, function(n, i) {
119
            //alert('n:' + n + ' index:' + jQuery.inArray(n, allchecked));
120
            return (jQuery.inArray(n, allchecked) == -1);
121
        });
122
 
123
        if(missingrequired && missingrequired.length > 0) {
124
            //alert('missingrequired:' + missingrequired);
125
            $('#error').append('<span style="color:red">Missing required slides: ' + missingrequired + '</span>');
126
            return false;
127
        }
128
 
129
        // FIXME - Is not the most efficient way
130
        alldups = new Array();
131
        j = 0;
132
        for(i=0;i<allchecked.length;i++) {
133
            duplicates = jQuery.grep(allchecked, function(n, index) {
134
                return (n == allchecked[i]);
135
            });
136
            //alert("duplicates:" + duplicates);
137
 
138
            if(duplicates.length > 1 && (jQuery.inArray(duplicates[0], alldups) == -1)) {
139
                alldups[j] = duplicates[0];
140
                j++;
141
            }
142
        }
143
 
144
        if(alldups.length > 0) {
145
            //alert("alldups:" + alldups);
146
            $('#error').append('<span style="color:red">Duplicate slides: ' + alldups + '</span>');
147
            return false;
148
        }
149
 
150
        return true;
151
    });
480 rajveer 152
 
153
	$('#slidesorderform').submit(function(e) {
154
        allchecked = new Array();
155
 
156
        // Clear old error messages
157
        $('#error').html("");
158
 
159
        $(':checked').each(function(index) {
160
            //alert($(this).attr('title'));
161
 
162
            allchecked[index] = $(this).attr('title');
163
        });
164
 
165
        //alert('allchecked:' + allchecked);
166
        missingrequired = jQuery.grep(required, function(n, i) {
167
            //alert('n:' + n + ' index:' + jQuery.inArray(n, allchecked));
168
            return (jQuery.inArray(n, allchecked) == -1);
169
        });
170
 
171
        if(missingrequired && missingrequired.length > 0) {
172
            //alert('missingrequired:' + missingrequired);
173
            $('#error').append('<span style="color:red">Missing required slides: ' + missingrequired + '</span>');
174
            return false;
175
        }
176
 
177
        // FIXME - Is not the most efficient way
178
        alldups = new Array();
179
        j = 0;
180
        for(i=0;i<allchecked.length;i++) {
181
            duplicates = jQuery.grep(allchecked, function(n, index) {
182
                return (n == allchecked[i]);
183
            });
184
            //alert("duplicates:" + duplicates);
185
 
186
            if(duplicates.length > 1 && (jQuery.inArray(duplicates[0], alldups) == -1)) {
187
                alldups[j] = duplicates[0];
188
                j++;
189
            }
190
        }
191
 
192
        if(alldups.length > 0) {
193
            //alert("alldups:" + alldups);
194
            $('#error').append('<span style="color:red">Duplicate slides: ' + alldups + '</span>');
195
            return false;
196
        }
197
 
198
        return true;
199
    });
242 naveen 200
});
201
</script>
480 rajveer 202
 <style type="text/css">
203
  #popupbox{
204
  margin: 0; 
205
  margin-left: 40%; /* This gets it relatively center on the screen */
206
  margin-right: 40%; /* This gets it relatively center on the screen */
207
  margin-top: 50px; /* Makes it a little off the top of the screen */
208
  padding-top: 10px; /*  Make the text not touching the top on the login box */
209
  width: 20%; /* For centering it on the screen */
210
  height: 150px; /* The height of the login box */
211
  position: relative; /* Makes sure its absolute so it doesn't dock with everything else */
212
  background: #FBFBF0; /* Login Box background color. Change this if desired. */
213
  border: solid #000000 2px; /* Makes a black border around the login box */
214
  z-index: 9; /* Makes it on top of everything else */
215
  font-family: arial; /* Sets the font */
216
  visibility: hidden; /* Makes it hidden at first. Very Important.*/
217
  }
218
 
219
  </style>
220
  <script language="JavaScript" type="text/javascript">
221
  function orderform(showhide, slideid){
222
    if(showhide == "show"){
223
		document.getElementById('slideid').value=slideid;
224
        document.getElementById('popupbox').style.visibility="visible";
225
 
226
    }else if(showhide == "hide"){
227
        document.getElementById('popupbox').style.visibility="hidden"; 
228
    }
229
  }
230
  </script>
242 naveen 231
</head>
232
<body>
233
<h1>Select Slides - $action.getId()</h1>
480 rajveer 234
 
235
 
242 naveen 236
<form name="f" id="slidesform" action="/content/slides/$action.getId()" method="post">
237
 
238
#showbuttons()
239
 
240
<p id="error"/>
241
 
480 rajveer 242
#set($selectstring =  "")
242 naveen 243
#foreach ($slidesdata in $allslidesdata)
480 rajveer 244
    #set ($firstslidedata = $slidesdata.get(0))
245
    #foreach ($data in $slidesdata)
246
    	 #if($data.get(5) == "1") 
247
    		#set($optionstring = "<option id=" + $data.get(2) + " name=" +  $firstslidedata.get(0) + " value=" + $data.get(2) + " >&nbsp;" + $data.get(2) + "-" + $data.get(3) + "</option>")
248
    		#set($selectstring = $selectstring + $optionstring)
249
    	 #end
250
    #end
251
#end
252
 
253
 
254
#foreach ($slidesdata in $allslidesdata)
242 naveen 255
#if($velocityCount == 1)
256
#showslides ($slidesdata, 1)
480 rajveer 257
 
242 naveen 258
#else
480 rajveer 259
#showslides ($slidesdata, 0, $selectstring)
242 naveen 260
#end
261
#end
262
 
263
<input type="hidden" name="_method" value="put"/>
264
 
265
#showbuttons()
266
 
267
</form>
480 rajveer 268
 
269
<div id="popupbox"> <!--Start login box-->
270
<form name="f1" id="slidesorderform" action="/content/slides/$action.getId()" method="post">
271
<center>After slide:</center>
272
<select id="afterslide" name="afterslide" value="afterslide">   $selectstring   </select>
273
 
274
<input type="hidden" name="slideid" id="slideid" value=""/>
275
<input type="hidden" name="_method" value="put"/>
276
<center><input type="submit" name="submit" value="submit" /></center>
277
</form>
278
<br />
279
<center><a href="javascript:orderform('hide');">close</a></center> <!-- Closes the box-->
280
</div> <!--End login box-->
281
 
282
 
283
 
284
 
242 naveen 285
</body>
286
</html>
287
 
288
#macro (showslides $slidesdata $count)
289
 
290
#set ($firstslidedata = $slidesdata.get(0))
291
<p/>
292
<h3>$firstslidedata.get(1) ($firstslidedata.get(0))</h3>
293
 
294
#foreach ($data in $slidesdata)
480 rajveer 295
    <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
296
	<br/>
242 naveen 297
#end
298
 
299
#end
300
 
301
#macro (showbuttons)
302
<p/>
303
<input type="button" class="cancelbutton" name="cancel" value="Cancel"/>
250 naveen 304
<input type="submit" name="save" value="Save & Exit"/>
242 naveen 305
<input type="submit" name="next" value="Save & Next >>"/>
306
#end
480 rajveer 307