SQL ORs must be, always, "OR"
[moodle.git] / lib / ajax / section-resource_classes.js
CommitLineData
0a0bb380 1/*
2 * library for ajaxcourse formats, the classes and related functions for sections and resources
3 * this library requires a 'main' object created in calling document
4 */
d4df8fdc 5
6
0a0bb380 7function section_class(id,group,config,isDraggable){
8 this.init_section(id,group,config,isDraggable);
9}
10YAHOO.extend(section_class, YAHOO.util.DDProxy);
11
d4df8fdc 12section_class.prototype.debug = false;
13
14section_class.prototype.init_section = function(id, group,config,isDraggable){
15 if (!id) { return; }
16
17 this.is = 'section';
18 this.sectionId = null;
19
20
21 if(!isDraggable){
22 this.initTarget(id,group,config);
23 this.removeFromGroup('sections');
24 }else{
25 this.init(id,group,config);
26 this.handle = null;
27 }
28
29 this.createFrame();
30 this.isTarget = true;
31
32 this.resources = [];
33 this.numberDisplay = null;
34 this.summary = null;
35 this.content_td = null;
36 this.hidden = false;
37 this.highlighted = false;
38 this.showOnly = false;
39 this.resources_ul = null;
40 this.process_section();
41
42 this.viewButton = null;
43 this.highlightButton = null;
44 this.showOnlyButton = null;
45 this.init_buttons();
46
47 if(isDraggable)this.add_handle();
48
49 if(this.debug)YAHOO.log("init_section "+id+" draggable="+isDraggable);
50
51
52 if(YAHOO.util.Dom.hasClass(this.getEl(),'hidden'))
53 this.toggle_hide(null,null,true);
54
0a0bb380 55 }
d4df8fdc 56
57section_class.prototype.init_buttons = function(){
58 var commandContainer = this.getEl().childNodes[2];
59
60 //clear all but show only button
61 var commandContainerCount = commandContainer.childNodes.length;
62 for(var i=(commandContainerCount-1);i>0;i--)
63 commandContainer.removeChild(commandContainer.childNodes[i])
64
65
66 if(!this.isWeekFormat){
67 var highlightbutton = main.mk_button('div','/pix/i/marker.gif');
68 YAHOO.util.Event.addListener(highlightbutton,'click',this.mk_marker,this,true);
69 commandContainer.appendChild(highlightbutton);
70 this.highlightButton = highlightbutton;
71 }
72 var viewbutton = main.mk_button('div','/pix/i/hide.gif');
73 YAHOO.util.Event.addListener(viewbutton,'click',this.toggle_hide,this,true);
74 commandContainer.appendChild(viewbutton);
75 this.viewButton = viewbutton;
62cb4032 76
0a0bb380 77 }
78
eba88175 79
d4df8fdc 80section_class.prototype.add_handle = function(){
81 var handleRef = main.mk_button('div','/pix/i/move_2d.gif',[['style','cursor:move']]);
82 YAHOO.util.Dom.generateId(handleRef,'sectionHandle');
eba88175 83
d4df8fdc 84 this.handle = handleRef;
85
86 this.getEl().childNodes[0].appendChild(handleRef);
87 this.setHandleElId(this.handle.id);
0a0bb380 88 }
d4df8fdc 89
90
91section_class.prototype.process_section = function(){
92 this.content_td = this.getEl().childNodes[1];
93
94
95 if(YAHOO.util.Dom.hasClass(this.getEl(),'current')){
96 this.highlighted = true;
97 main.marker = this;
98 }
99
100
101 //create holder for display number for access later
102
103 this.numberDisplay = document.createElement('div');
104 this.numberDisplay.innerHTML = this.getEl().childNodes[0].innerHTML;
105 this.getEl().childNodes[0].innerHTML = '';
106 this.getEl().childNodes[0].appendChild(this.numberDisplay);
107
108 this.sectionId = this.numberDisplay.innerHTML;
109
110 if(this.debug)YAHOO.log("Creating section "+this.getEl().id+" in position "+this.sectionId);
111 //find/edit resources
112
113 this.resources_ul = this.content_td.getElementsByTagName('ul')[0];
114 if(this.resources_ul == null){
115 this.resources_ul = document.createElement('ul');
116 this.resources_ul.className='section';
117 this.content_td.insertBefore(this.resources_ul,this.content_td.childNodes[1]);
eba88175 118 }
d4df8fdc 119
120 var resource_count = this.resources_ul.getElementsByTagName('li').length;
121
122
123 for(var i=0;i<resource_count;i++){
124 var resource = this.resources_ul.getElementsByTagName('li')[i];
125 if(YAHOO.util.Dom.hasClass(resource,'resource')){
126 this.resources[this.resources.length] = new resource_class(resource.id,'resources',null,this);
127 if(this.debug)YAHOO.log("Found resource");
128 }else{
129 this.resources[this.resources.length] = new activity_class(resource.id,'resources',null,this);
130 }
131 }
eba88175 132
d4df8fdc 133 this.summary = YAHOO.util.Dom.getElementsByClassName('summary',null,this.getEl())[0].firstChild.data || '';
eba88175 134
d4df8fdc 135
136 }
137
0a0bb380 138section_class.prototype.startDrag = function(x, y) {
139 //operates in point mode
140 YAHOO.util.DDM.mode = YAHOO.util.DDM.POINT;
d4df8fdc 141
0a0bb380 142 //remove from resources group temporarily
143 this.removeFromGroup('resources');
d4df8fdc 144
0a0bb380 145 //reinitialize dd element
146 this.getDragEl().innerHTML = '';
d4df8fdc 147
0a0bb380 148 var targets = YAHOO.util.DDM.getRelated(this, true);
149 if(this.debug)YAHOO.log(this.sectionId + " startDrag "+targets.length + " targets");
150
d4df8fdc 151 }
0a0bb380 152
153section_class.prototype.onDragDrop = function(e, id) {
154 // get the drag and drop object that was targeted
155 var target = YAHOO.util.DDM.getDDById(id);
156
157 if(this.debug)YAHOO.log("Section dropped on id="+id+" el = "+this.getEl().id+" x="+YAHOO.util.Dom.getXY(this.getDragEl()));
d4df8fdc 158
0a0bb380 159 this.move_to_section(target);
d4df8fdc 160
161 //add back to resources group
0a0bb380 162 this.addToGroup('resources');
d4df8fdc 163 }
0a0bb380 164section_class.prototype.endDrag = function(){
d4df8fdc 165 //nessicary to defeat default action
166
167 //add back to resources group
0a0bb380 168 this.addToGroup('resources');
d4df8fdc 169 }
170
0a0bb380 171section_class.prototype.move_to_section = function(target){
d4df8fdc 172 var tempTd = document.createElement('td');
173 var tempStore = null;
174 var sectionCount = main.sections.length;
175 var found = null;
176
177 //determine if original is above or below target and adjust loop
178 var oIndex=main.get_section_index(this);
179 var tIndex=main.get_section_index(target);
180
181 if(this.debug)YAHOO.log("original is at: "+oIndex+" target is at:"+tIndex+" of "+(sectionCount-1));
182
183 if(oIndex < tIndex){
184 var loopCondition = 'i<sectionCount';
185 var loopStart = 1;
186 var loopInc = 'i++';
187 var loopmodifier = 'i-1';
188 }else{
189 var loopCondition = 'i>0';
190 var loopStart = sectionCount-1;
191 var loopInc = 'i--';
192 var loopmodifier = 'i+1';
193 }
194
62cb4032 195 //move on backend
196 main.connect('post','class=section&field=move',null,'id='+this.sectionId+'&value='+(target.sectionId-this.sectionId));
197
198
199 //move on front end
d4df8fdc 200 for(var i=loopStart;eval(loopCondition);eval(loopInc)){
201
202 if((main.sections[i] == this)&& !found){
203 //enounter with original node
204 if(this.debug)YAHOO.log("Found Original "+main.sections[i].getEl().id);
205 if(main.sections[i] == this){
206 found = true;
207 }
208
209 }else if(main.sections[i] == target){
210 //encounter with target node
211 if(this.debug)YAHOO.log("Found target "+main.sections[i].getEl().id);
212 main.sections[i].swap_with_section(main.sections[eval(loopmodifier)]);
213 found = false;
214 break;
215
216 }else if(found){
217 //encounter with nodes inbetween
218 main.sections[i].swap_with_section(main.sections[eval(loopmodifier)]);
219 }
220 }
62cb4032 221
0a0bb380 222 }
d4df8fdc 223
224
0a0bb380 225section_class.prototype.swap_with_section = function(sectionIn){
d4df8fdc 226 var tmpStore = null;
227
228 thisIndex = main.get_section_index(this);
229 targetIndex = main.get_section_index(sectionIn);
230 main.sections[targetIndex] = this;
231 main.sections[thisIndex] = sectionIn;
232
233 this.changeId(targetIndex);
234 sectionIn.changeId(thisIndex);
235
236 if(this.debug)YAHOO.log("Swapping "+this.getEl().id+" with "+sectionIn.getEl().id);
237
238 YAHOO.util.DDM.swapNode(this.getEl(),sectionIn.getEl());
239
240
241 }
0a0bb380 242
62cb4032 243section_class.prototype.toggle_hide = function(e,target,superficial){
d4df8fdc 244 if(this.hidden){
245 YAHOO.util.Dom.removeClass(this.getEl(),'hidden');
246 this.viewButton.childNodes[0].src = this.viewButton.childNodes[0].src.replace(/show.gif/i,'hide.gif');
247 this.hidden = false;
248
62cb4032 249 if(!superficial){
250 main.connect('post','class=section&field=visible',null,'value=1&id='+this.sectionId);
251 for(var x=0;x<this.resources.length;x++){
252 this.resources[x].toggle_hide(null,null,true,this.resources[x].hiddenStored);
253 this.resources[x].hiddenStored = null;
254 }
255 }
256
d4df8fdc 257 }else{
258 YAHOO.util.Dom.addClass(this.getEl(),'hidden');
259 this.viewButton.childNodes[0].src = this.viewButton.childNodes[0].src.replace(/hide.gif/i,'show.gif');
260 this.hidden = true;
261
62cb4032 262 if(!superficial){
263 main.connect('post','class=section&field=visible',null,'value=0&id='+this.sectionId);
264 for(var x=0;x<this.resources.length;x++){
265 this.resources[x].hiddenStored = this.resources[x].hidden;
266 this.resources[x].toggle_hide(null,null,true,true);
267 }
268 }
d4df8fdc 269 }
0a0bb380 270 }
271
272section_class.prototype.toggle_highlight = function(){
d4df8fdc 273 if(this.highlighted){
274 YAHOO.util.Dom.removeClass(this.getEl(),'current');
275 this.highlighted = false;
276 }else{
277 YAHOO.util.Dom.addClass(this.getEl(),'current');
278 this.highlighted = true;
279 }
280 }
281
0a0bb380 282section_class.prototype.mk_marker = function(){
d4df8fdc 283 if(main.marker != this){
284 main.update_marker(this);
285
286 }else{//if currently the marker
287 main.marker = null;
288
289 main.connect('post','class=course&field=marker',null,'value=0');
290 this.toggle_highlight();
291
292 }
293
294 }
295
0a0bb380 296section_class.prototype.changeId = function(newId){
d4df8fdc 297 this.sectionId = newId;
298 this.numberDisplay.firstChild.data = newId;
299
62cb4032 300 //main.connectQueue_add('post','class=section&field=all',null,'id='+newId+"&summary="+main.mk_safe_for_transport(this.summary)+"&sequence="+this.write_sequence_list(true)+'&visible='+(this.hidden?0:1))
d4df8fdc 301
302 if(main.marker == this)
303 main.update_marker(this);
304 }
0a0bb380 305
306section_class.prototype.get_resource_index = function(el){
d4df8fdc 307 for(var x=0;x<this.resources.length;x++)
308 if(this.resources[x]==el)
309 return x;
310 YAHOO.log("Could not find resource to remove "+el.getEl().id,"error");
311 return -1;
312 }
313
0a0bb380 314section_class.prototype.remove_resource = function(el){
d4df8fdc 315 var resourceCount = this.resources.length;
316 if(resourceCount == 1){
317 if(this.resources[0] == el)
318 this.resources = new Array();
319 }else{
320 var found = false;
321 for(var i=0;i<resourceCount;i++){
322 if(found){
323 this.resources[i-1] = this.resources[i];
324 if(i==resourceCount-1){
325 this.resources = this.resources.slice(0,-1);
326 resourceCount--;
327 }
328 this.resources[i-1].update_index(i-1);
329 }else if(this.resources[i]==el){
330 found = true;
0a0bb380 331 }
332 }
333 }
d4df8fdc 334
335
336 //remove "text" nodes to keep DOM clean
337 var childIndex = null;
338 var childrenCount = this.resources_ul.childNodes.length;
339 for(var i=0;i<childrenCount;i++)
340 if(this.resources_ul.childNodes[i] == el.getEl())
341 childIndex = i;
342 if(childIndex > 0 && childIndex < this.resources_ul.childNodes.length)
343 this.resources_ul.removeChild(this.resources_ul.childNodes[childIndex-1]);
344 YAHOO.log("removing "+el.getEl().id);
345 if(el.getEl().parentNode != null)
346 el.getEl().parentNode.removeChild(el.getEl());
347
348 this.write_sequence_list();
349
350 }
351
0a0bb380 352section_class.prototype.insert_resource = function(el,targetel){
d4df8fdc 353 var resourcecount = this.resources.length;
354 var found = false;
355 var tempStore = nextStore = null;
356
62cb4032 357 //update in backend
358 targetId='';
359 if(targetel !=null){
360 targetId=targetel.id;
361 }
362
363 main.connect('post','class=resource&field=move',null,'id='+el.id+'&beforeId='+targetId+'&sectionId='+this.sectionId);
364
365
366
367 //if inserting into a hidden resource hide
368 if(this.hidden){
369 el.hiddenStored = el.hidden;
370 el.toggle_hide(null,null,true,true);
371 }else{
372 if(el.hiddenStored != null){
373 el.toggle_hide(null,null,true,el.hiddenStored);
374 el.hiddenStored = null;
375 }
376 }
377
378 //update model
d4df8fdc 379 if(targetel == null){
380 this.resources[this.resources.length] = el;
381 }else
382 for(var i=0;i<resourcecount;i++){
383 if(found){
384 tempStore = this.resources[i];
385 this.resources[i] = nextStore;
386 nextStore = tempStore;
387
388 if(nextStore != null)
389 nextStore.update_index(i+1);
390
391 }else if(this.resources[i] == targetel){
392 found = true;
393 nextStore = this.resources[i];
394 this.resources[i] = el;
395 resourcecount++;
396
397 this.resources[i].update_index(i,this.ident);
0a0bb380 398 nextStore.update_index(i+1);
d4df8fdc 399 }
400 }
0a0bb380 401
62cb4032 402 //update on frontend
d4df8fdc 403 if(targetel != null){
404 this.resources_ul.insertBefore(el.getEl(),targetel.getEl());
405 this.resources_ul.insertBefore(document.createTextNode(''),targetel.getEl());
406
407 }else{
408 this.resources_ul.appendChild(el.getEl());
409 this.resources_ul.appendChild(document.createTextNode(" "));
410 }
62cb4032 411 el.parentObj = this;
0a0bb380 412 }
d4df8fdc 413
0a0bb380 414section_class.prototype.write_sequence_list = function(toReturn){
d4df8fdc 415 var listOutput = '';
416 for(var i=0;i<this.resources.length;i++){
417 listOutput += this.resources[i].id;
418 if(i != (this.resources.length-1))
419 listOutput += ',';
420 }
421
422 if(toReturn)
423 return listOutput;
424
d4df8fdc 425 }
426
427
428
0a0bb380 429/*
430 * Resource Class extends util.DDProxy
431 */
d4df8fdc 432
0a0bb380 433
434function resource_class(id,group,config,parentObj){
435
436 this.init_resource(id,group,config,parentObj);
437}
438YAHOO.extend(resource_class, YAHOO.util.DDProxy);
439
d4df8fdc 440resource_class.prototype.debug = true;
441
0a0bb380 442resource_class.prototype.init_resource = function(id,group,config,parentObj){
d4df8fdc 443 if (!id) {
444 YAHOO.log("Init resource, NO ID FOUND!",'error');
445 return;
446 }
447
448 this.is = 'resource';
449 this.init(id,group,config);
450 this.createFrame();
451 this.isTarget = true;
452
453 this.id = this.getEl().id.replace(/module-/i,'');
454
455 this.hidden = false;
456 if(YAHOO.util.Dom.hasClass(this.getEl().getElementsByTagName('a')[0],'dimmed'))
457 this.hidden = true;
62cb4032 458 this.hiddenStored = null;
eba88175 459
d4df8fdc 460 this.linkContainer = this.getEl().getElementsByTagName('a')[0];
461
462 this.commandContainer = null;
463 this.viewButton = null;
464 this.handle = null;
465 this.init_buttons();
466
467 this.parentObj = parentObj;
eba88175 468
d4df8fdc 469 if(this.debug)YAHOO.log("init_resource "+id+" parent = "+parentObj.getEl().id);
0a0bb380 470
471 }
d4df8fdc 472
0a0bb380 473resource_class.prototype.init_buttons = function(){
d4df8fdc 474 var commandContainer = YAHOO.util.Dom.getElementsByClassName('commands','span',this.getEl())[0];
475 if( commandContainer == null){
476 YAHOO.log('Cannot find command container for '+this.getEl().id,'error');
477 return;
478 }
479
480 this.commandContainer = commandContainer;
481
482 //find edit button
483 var updateButton = null;
484 var buttons = commandContainer.getElementsByTagName('a');
485 for(var x=0;x<buttons.length;x++)
486 if(buttons[x].title == 'Update')
487 updateButton = buttons[x];
488
489 if(updateButton == null)
0a0bb380 490 YAHOO.log('Cannot find updateButton for '+this.getEl().id,'error');
d4df8fdc 491
492 commandContainer.innerHTML = '';
493
494
495 //add move-handle
496 var handleRef = main.mk_button('a','/pix/i/move_2d.gif',[['style','cursor:move']],[['height','11'],['width','11'],['hspace','2'],['border','0']]);
497 YAHOO.util.Dom.generateId(handleRef,'sectionHandle');
498 this.handle = handleRef;
499
500 commandContainer.appendChild(handleRef);
501 this.setHandleElId(this.handle.id);
502
503
504
505 //add edit button back in
506 commandContainer.appendChild(updateButton);
507
508 //add rest
509 var button = main.mk_button('a','/pix/t/delete.gif');
510 YAHOO.util.Event.addListener(button,'click',this.delete_button,this,true);
511 commandContainer.appendChild(button);
512
513 if(this.hidden)
514 var button = main.mk_button('a','/pix/t/show.gif');
515 else
516 var button = main.mk_button('a','/pix/t/hide.gif');
517 YAHOO.util.Event.addListener(button,'click',this.toggle_hide,this,true);
518 commandContainer.appendChild(button);
519 this.viewButton = button;
520
521 }
522
62cb4032 523resource_class.prototype.toggle_hide = function(target,e,superficial,force){
524 if(force != null){
525 if(this.debug)YAHOO.log("Resource "+this.getEl().id+" forced to "+force);
526 this.hidden = !force;
527 }
528
d4df8fdc 529 if(this.hidden){
530 YAHOO.util.Dom.removeClass(this.linkContainer,'dimmed');
531 this.viewButton.childNodes[0].src = this.viewButton.childNodes[0].src.replace(/show.gif/i,'hide.gif');
62cb4032 532 this.hidden = false;
533
534 if(!superficial){
535 main.connect('post','class=resource&field=visible',null,'value=1&id='+this.id);
536 }
d4df8fdc 537 }else{
538 YAHOO.util.Dom.addClass(this.linkContainer,'dimmed');
539 this.viewButton.childNodes[0].src = this.viewButton.childNodes[0].src.replace(/hide.gif/i,'show.gif');
540 this.hidden = true;
541
62cb4032 542 if(!superficial){
543 main.connect('post','class=resource&field=visible',null,'value=0&id='+this.id);
544 }
d4df8fdc 545 }
0a0bb380 546 }
547
548resource_class.prototype.delete_button = function(){
d4df8fdc 549 if(this.debug)YAHOO.log("Deleteing "+this.getEl().id+"from parent "+this.parentObj.getEl().id);
550
1752e584 551 if(!confirm('Are you sure you wish to delete this '+this.is+"?")){
552 return false;
553 }
554
d4df8fdc 555 this.getEl().parentNode.removeChild(this.getEl());
556 this.parentObj.remove_resource(this);
557
558 main.connect('delete','class=resource&id='+this.id);
559 }
560
0a0bb380 561resource_class.prototype.update_index = function(index){
d4df8fdc 562 if(this.debug)YAHOO.log("update Index for resource "+this.getEl().id+"to"+index);
563 }
564
565
0a0bb380 566resource_class.prototype.startDrag = function(x, y) {
567 //operates in intersect mode
568 YAHOO.util.DDM.mode = YAHOO.util.DDM.INTERSECT;
d4df8fdc 569
0a0bb380 570 //reinitialize dd element
571 this.getDragEl().innerHTML = '';
d4df8fdc 572
0a0bb380 573 var targets = YAHOO.util.DDM.getRelated(this, true);
574 if(this.debug)YAHOO.log(this.id + " startDrag "+targets.length + " targets");
d4df8fdc 575
576 }
0a0bb380 577
578resource_class.prototype.onDragDrop = function(e, ids) {
579 // best fit Id
580 var id=[];
581 for(var i=0;i<ids.length;i++)
d4df8fdc 582 if(ids[i].is == 'resource')
583 id[id.length] = ids[i];
0a0bb380 584
585 if(id.length == 0)
d4df8fdc 586 id = ids;
587
588
0a0bb380 589 // get the drag and drop object that was targeted
590 var target = YAHOO.util.DDM.getBestMatch(id);
591
592 if(this.debug)YAHOO.log("dropped on id="+target+" el = "+this.getEl().id+" x="+YAHOO.util.Dom.getXY(this.getDragEl()));
d4df8fdc 593
0a0bb380 594 this.parentObj.remove_resource(this);
595
596 if(target.is == 'resource'||target.is == 'activity'){
597 target.parentObj.insert_resource(this,target);
d4df8fdc 598
0a0bb380 599 }else if(target.is =='section'){
600 target.insert_resource(this);
d4df8fdc 601
0a0bb380 602 }
603
604 return;
d4df8fdc 605 }
0a0bb380 606
607resource_class.prototype.endDrag = function() {
d4df8fdc 608 //eliminates default action
609 }
610
0a0bb380 611/*
612 * activity Class extends resource class
613 */
d4df8fdc 614
615
0a0bb380 616function activity_class(id,group,config,parentObj){
617 this.init_activity(id,group,config,parentObj);
618}
619YAHOO.extend(activity_class, resource_class);
620
621activity_class.prototype.init_activity = function(id,group,config,parentObj){
d4df8fdc 622 if (!id) {
623 YAHOO.log("Init activity, NO ID FOUND!",'error');
624 return;
625 }
626
627 this.is = 'activity';
628 this.currentGroup = this.get_current_group(id);
629
630 this.init_resource(id,group,config,parentObj);
631
632 this.groupButton= null;
633 this.init_activity_button();
634
635 if(this.debug)YAHOO.log("--init_activity "+id);
636
637 }
638
0a0bb380 639activity_class.prototype.groupImages = ['/pix/t/groupn.gif','/pix/t/groups.gif','/pix/t/groupv.gif'];
d4df8fdc 640
0a0bb380 641activity_class.prototype.init_activity_button = function(){
d4df8fdc 642 var button = main.mk_button('a',this.groupImages[this.currentGroup]);
643 YAHOO.util.Event.addListener(button,'click',this.toggle_group,this,true);
644 this.commandContainer.appendChild(button);
645 this.groupButton = button;
646 }
0a0bb380 647
648activity_class.prototype.get_current_group = function(id){
d4df8fdc 649 if(document.getElementById(id) == null){
650 return;
651 }
652
653 var groupNodeArray = document.getElementById(id).getElementsByTagName('a');
654 var groupNode = groupNodeArray[groupNodeArray.length-1];
655
656 for(var x=0;x<this.groupImages.length;x++){
657 if(main.portal.wwwroot+this.groupImages[x] == groupNode.getElementsByTagName('img')[0].src){
0a0bb380 658 return x;
659 }
d4df8fdc 660 }
661
662 return 0;
0a0bb380 663 }
d4df8fdc 664
0a0bb380 665activity_class.prototype.toggle_group = function(){
d4df8fdc 666 this.currentGroup++;
667 if(this.currentGroup > 2)
668 this.currentGroup = 0;
669
670 this.groupButton.getElementsByTagName('img')[0].src = main.portal.wwwroot + this.groupImages[this.currentGroup];
671
672 main.connect('post','class=resource&field=groupmode',null,'value='+this.currentGroup+'&id='+this.id);
673 }
674