2 * library for ajaxcourse formats, the classes and related functions for
3 * sections and resources.
5 * This library requires a 'main' object created in calling document.
9 * Dropping an activity or resource on a section will always add the activity
10 * or resource at the end of that section.
12 * Dropping an activity or resource on another activity or resource will
13 * always move the former just above the latter.
22 function section_class(id, group, config, isDraggable) {
23 this.init_section(id, group, config, isDraggable);
26 YAHOO.extend(section_class, YAHOO.util.DDProxy);
29 section_class.prototype.debug = false;
32 section_class.prototype.init_section = function(id, group, config, isDraggable) {
39 this.sectionId = null; // Section number. This is NOT the section id from
43 this.initTarget(id, group, config);
44 this.removeFromGroup('sections');
46 this.init(id, group, config);
54 this.numberDisplay = null; // Used to display the section number on the top left
55 // of the section. Not used in all course formats.
57 this.content_td = null;
59 this.highlighted = false;
60 this.showOnly = false;
61 this.resources_ul = null;
62 this.process_section();
64 this.viewButton = null;
65 this.highlightButton = null;
66 this.showOnlyButton = null;
73 YAHOO.log("init_section "+id+" draggable="+isDraggable);
75 if (YAHOO.util.Dom.hasClass(this.getEl(),'hidden')) {
76 this.toggle_hide(null,null,true);
81 section_class.prototype.init_buttons = function() {
82 var commandContainer = this.getEl().childNodes[2];
84 //clear all but show only button
85 var commandContainerCount = commandContainer.childNodes.length;
87 for (var i=(commandContainerCount-1); i>0; i--) {
88 commandContainer.removeChild(commandContainer.childNodes[i])
91 if (!this.isWeekFormat) {
92 var highlightbutton = main.mk_button('div', '/i/marker.gif');
93 YAHOO.util.Event.addListener(highlightbutton, 'click', this.mk_marker, this, true);
94 commandContainer.appendChild(highlightbutton);
95 this.highlightButton = highlightbutton;
97 var viewbutton = main.mk_button('div', '/i/hide.gif');
98 YAHOO.util.Event.addListener(viewbutton, 'click', this.toggle_hide, this,true);
99 commandContainer.appendChild(viewbutton);
100 this.viewButton = viewbutton;
104 section_class.prototype.add_handle = function() {
105 var handleRef = main.mk_button('a', '/i/move_2d.gif',
106 [['style','cursor:move'], ['title', main.portal.strings['move']]]);
108 YAHOO.util.Dom.generateId(handleRef, 'sectionHandle');
110 this.handle = handleRef;
112 this.getEl().childNodes[0].appendChild(handleRef);
113 this.setHandleElId(this.handle.id);
117 section_class.prototype.process_section = function() {
118 this.content_td = this.getEl().childNodes[1];
120 if (YAHOO.util.Dom.hasClass(this.getEl(),'current')) {
121 this.highlighted = true;
125 // Create holder for display number for access later
127 this.numberDisplay = document.createElement('div');
128 this.numberDisplay.innerHTML = this.getEl().childNodes[0].innerHTML;
129 this.getEl().childNodes[0].innerHTML = '';
130 this.getEl().childNodes[0].appendChild(this.numberDisplay);
132 this.sectionId = this.id.replace(/section-/i, ''); // Okay, we will have to change this if we
133 // ever change the id attributes format
136 YAHOO.log("Creating section "+this.getEl().id+" in position "+this.sectionId);
139 // Find/edit resources
140 this.resources_ul = this.content_td.getElementsByTagName('ul')[0];
141 if (!this.resources_ul) {
142 this.resources_ul = document.createElement('ul');
143 this.resources_ul.className='section';
144 this.content_td.insertBefore(this.resources_ul, this.content_td.lastChild);
146 var resource_count = this.resources_ul.getElementsByTagName('li').length;
148 for (var i=0;i<resource_count;i++) {
149 var resource = this.resources_ul.getElementsByTagName('li')[i];
150 this.resources[this.resources.length] = new resource_class(resource.id, 'resources', null, this);
152 this.summary = YAHOO.util.Dom.getElementsByClassName('summary', null, this.getEl())[0].firstChild.data || '';
156 section_class.prototype.startDrag = function(x, y) {
157 //operates in point mode
158 YAHOO.util.DDM.mode = YAHOO.util.DDM.POINT;
160 //remove from resources group temporarily
161 this.removeFromGroup('resources');
163 //reinitialize dd element
164 this.getDragEl().innerHTML = '';
166 var targets = YAHOO.util.DDM.getRelated(this, true);
169 YAHOO.log(this.id + " startDrag, "+targets.length + " targets");
174 section_class.prototype.onDragDrop = function(e, id) {
175 // get the drag and drop object that was targeted
176 var target = YAHOO.util.DDM.getDDById(id);
179 YAHOO.log("Section dropped on id="+id+" (I am "+this.getEl().id+") x="
180 +YAHOO.util.Dom.getXY(this.getDragEl()));
182 this.move_to_section(target);
184 //add back to resources group
185 this.addToGroup('resources');
189 section_class.prototype.endDrag = function() {
190 //nessicary to defeat default action
192 //add back to resources group
193 this.addToGroup('resources');
197 section_class.prototype.move_to_section = function(target) {
198 var tempTd = document.createElement('td');
199 var tempStore = null;
200 var sectionCount = main.sections.length;
203 //determine if original is above or below target and adjust loop
204 var oIndex = main.get_section_index(this);
205 var tIndex = main.get_section_index(target);
208 YAHOO.log("original is at: "+oIndex+" target is at:"+tIndex+" of "+(sectionCount-1));
210 if (oIndex < tIndex) {
211 var loopCondition = 'i<sectionCount';
214 var loopmodifier = 'i - 1';
216 var loopCondition = 'i > 0';
217 var loopStart = sectionCount - 1;
219 var loopmodifier = 'i + 1';
223 main.connect('POST','class=section&field=move',null,'id='+this.sectionId+'&value='
224 +(target.sectionId - this.sectionId));
227 for (var i=loopStart; eval(loopCondition); eval(loopInc)) {
229 if ((main.sections[i] == this) && !found) {
230 //enounter with original node
232 YAHOO.log("Found Original "+main.sections[i].getEl().id);
234 if (main.sections[i] == this) {
237 } else if (main.sections[i] == target) {
238 //encounter with target node
240 YAHOO.log("Found target "+main.sections[i].getEl().id);
242 main.sections[i].swap_with_section(main.sections[eval(loopmodifier)]);
246 //encounter with nodes inbetween
247 main.sections[i].swap_with_section(main.sections[eval(loopmodifier)]);
253 section_class.prototype.swap_with_section = function(sectionIn) {
256 thisIndex = main.get_section_index(this);
257 targetIndex = main.get_section_index(sectionIn);
258 main.sections[targetIndex] = this;
259 main.sections[thisIndex] = sectionIn;
261 this.changeId(targetIndex);
262 sectionIn.changeId(thisIndex);
265 YAHOO.log("Swapping "+this.getEl().id+" with "+sectionIn.getEl().id);
267 // Swap the sections.
268 YAHOO.util.DDM.swapNode(this.getEl(), sectionIn.getEl());
270 // Sections contain forms to add new resources/activities. These forms
271 // have not been updated to reflect the new positions of the sections that
272 // we have swapped. Let's swap the two sections' forms around.
273 if (this.getEl().getElementsByTagName('form')[0].parentNode
274 && sectionIn.getEl().getElementsByTagName('form')[0].parentNode) {
276 YAHOO.util.DDM.swapNode(this.getEl().getElementsByTagName('form')[0].parentNode,
277 sectionIn.getEl().getElementsByTagName('form')[0].parentNode);
279 YAHOO.log("Swapping sections: form not present in one or both sections", "warn");
284 section_class.prototype.toggle_hide = function(e,target,superficial) {
286 YAHOO.util.Dom.removeClass(this.getEl(), 'hidden');
287 this.viewButton.childNodes[0].src = this.viewButton.childNodes[0].src.replace(/show.gif/i, 'hide.gif');
291 main.connect('POST', 'class=section&field=visible', null, 'value=1&id='+this.sectionId);
292 for (var x=0; x<this.resources.length; x++) {
293 this.resources[x].toggle_hide(null, null, true, this.resources[x].hiddenStored);
294 this.resources[x].hiddenStored = null;
299 YAHOO.util.Dom.addClass(this.getEl(), 'hidden');
300 this.viewButton.childNodes[0].src = this.viewButton.childNodes[0].src.replace(/hide.gif/i, 'show.gif');
304 main.connect('POST', 'class=section&field=visible', null, 'value=0&id='+this.sectionId);
305 for (var x=0; x<this.resources.length; x++) {
306 this.resources[x].hiddenStored = this.resources[x].hidden;
307 this.resources[x].toggle_hide(null, null, true, true);
314 section_class.prototype.toggle_highlight = function() {
315 if (this.highlighted) {
316 YAHOO.util.Dom.removeClass(this.getEl(), 'current');
317 this.highlighted = false;
319 YAHOO.util.Dom.addClass(this.getEl(), 'current');
320 this.highlighted = true;
325 section_class.prototype.mk_marker = function() {
326 if (main.marker != this) {
327 main.update_marker(this);
329 // If currently the marker
332 main.connect('POST', 'class=course&field=marker', null, 'value=0');
333 this.toggle_highlight();
338 section_class.prototype.changeId = function(newId) {
339 this.sectionId = newId;
340 this.numberDisplay.firstChild.data = newId;
342 //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))
344 if (main.marker == this) {
345 main.update_marker(this);
350 section_class.prototype.get_resource_index = function(el) {
351 for (var x=0; x<this.resources.length; x++) {
352 if (this.resources[x] == el) {
356 YAHOO.log("Could not find resource to remove "+el.getEl().id, "error");
361 section_class.prototype.remove_resource = function(el) {
363 var resourceEl = el.getEl();
364 var parentEl = resourceEl.parentNode;
369 var resourceCount = this.resources.length;
371 if (resourceCount == 1) {
372 if (this.resources[0] == el) {
373 this.resources = new Array();
377 for (var i=0; i<resourceCount; i++) {
379 this.resources[i - 1] = this.resources[i];
380 if (i == resourceCount - 1) {
381 this.resources = this.resources.slice(0, -1);
384 this.resources[i - 1].update_index(i - 1);
385 } else if (this.resources[i] == el) {
390 // Remove any extra text nodes to keep DOM clean.
391 var kids = parentEl.childNodes;
393 for (var i=0; i<kids.length; i++) {
394 if (kids[i].nodeType == 3) {
395 YAHOO.log('Removed extra text node.');
396 parentEl.removeChild(kids[i]);
399 parentEl.removeChild(resourceEl);
401 this.write_sequence_list();
406 section_class.prototype.insert_resource = function(el, targetel) {
407 var resourcecount = this.resources.length;
409 var tempStore = nextStore = null;
414 targetId = targetel.id;
417 YAHOO.log('id='+el.id+', beforeId='+targetId+', sectionId='+this.sectionId);
419 main.connect('POST', 'class=resource&field=move', null,
420 'id='+el.id+'&beforeId='+targetId+'§ionId='+this.sectionId);
422 //if inserting into a hidden resource hide
424 el.hiddenStored = el.hidden;
425 el.toggle_hide(null, null, true, true);
427 if (el.hiddenStored != null) {
428 el.toggle_hide(null, null, true, el.hiddenStored);
429 el.hiddenStored = null;
434 this.resources[this.resources.length] = el;
436 for (var i=0; i<resourcecount; i++) {
438 tempStore = this.resources[i];
439 this.resources[i] = nextStore;
440 nextStore = tempStore;
442 if (nextStore != null)
443 nextStore.update_index(i+1);
445 } else if (this.resources[i] == targetel) {
447 nextStore = this.resources[i];
448 this.resources[i] = el;
451 this.resources[i].update_index(i, this.ident);
452 nextStore.update_index(i + 1);
458 this.resources_ul.insertBefore(el.getEl(), targetel.getEl());
459 //this.resources_ul.insertBefore(document.createTextNode(' '), targetel.getEl());
461 this.resources_ul.appendChild(el.getEl());
462 //this.resources_ul.appendChild(document.createTextNode(' '));
468 section_class.prototype.write_sequence_list = function(toReturn) {
471 for (var i=0; i<this.resources.length; i++) {
472 listOutput += this.resources[i].id;
473 if (i != (this.resources.length-1)) {
486 * resource_class extends util.DDProxy
488 function resource_class(id,group,config,parentObj) {
489 this.init_resource(id,group,config,parentObj);
492 YAHOO.extend(resource_class, YAHOO.util.DDProxy);
495 resource_class.prototype.debug = false;
498 resource_class.prototype.init_resource = function(id, group, config, parentObj) {
500 YAHOO.log("Init resource, NO ID FOUND!", 'error');
506 this.SEPARATEGROUPS = 1;
507 this.VISIBLEGROUPS = 2;
509 this.is = 'resource';
510 this.init(id, group, config);
512 this.isTarget = true;
514 this.id = this.getEl().id.replace(/module-/i, '');
517 if (YAHOO.util.Dom.hasClass(this.getEl().getElementsByTagName('a')[0], 'dimmed')) {
520 this.hiddenStored = null;
522 this.groupmode = null; // Can be null (i.e. does not apply), 0, 1 or 2.
524 this.linkContainer = this.getEl().getElementsByTagName('a')[0];
526 this.commandContainer = null;
527 this.indentLeftButton = null;
528 this.indentRightButton = null;
529 this.viewButton = null;
530 this.groupButton = null;
534 this.parentObj = parentObj;
537 YAHOO.log("init_resource "+id+" parent = "+parentObj.getEl().id);
543 * The current strategy is to look at the DOM tree to get information on the
544 * resource and it's current mode. This is bad since we are dependant on
545 * the html that is output from serverside logic. Seemingly innocuous changes
546 * like changing the language string for the title of a button will break
547 * our JavaScript here. This is brittle.
549 * First, we clear the buttons container. Then:
550 * We need to add the new-style move handle.
551 * The old style move button (up/down) needs to be removed.
552 * Move left button (if any) needs an event handler.
553 * Move right button (if any) needs an event handler.
554 * Update button stays as it is. Add it back.
555 * Delete button needs an event handler.
556 * Visible button is a toggle. It needs an event handler too.
557 * Group mode button is a toggle. It needs an event handler too.
559 resource_class.prototype.init_buttons = function() {
561 var commandContainer = YAHOO.util.Dom.getElementsByClassName('commands',
562 'span', this.getEl())[0];
564 if (commandContainer == null) {
565 YAHOO.log('Cannot find command container for '+this.getEl().id, 'error');
570 var strgroupsnone = main.portal.strings['groupsnone']+' ('+main.portal.strings['clicktochange']+')';
571 var strgroupsseparate = main.portal.strings['groupsseparate']+' ('+main.portal.strings['clicktochange']+')';
572 var strgroupsvisible = main.portal.strings['groupsvisible']+' ('+main.portal.strings['clicktochange']+')';
574 this.commandContainer = commandContainer;
575 var buttons = commandContainer.getElementsByTagName('a');
577 // Buttons that we might need to add back in.
578 var moveLeft = false;
579 var moveRight = false;
580 var updateButton = null;
582 for (var x=0; x<buttons.length; x++) {
583 if (buttons[x].className == 'editing_moveleft') {
585 } else if (buttons[x].className == 'editing_moveright') {
587 } else if (buttons[x].className == 'editing_update') {
588 updateButton = buttons[x].cloneNode(true);
589 } else if (buttons[x].className == 'editing_groupsnone') {
590 this.groupmode = this.NOGROUPS;
591 } else if (buttons[x].className == 'editing_groupsseparate') {
592 this.groupmode = this.SEPARATEGROUPS;
593 } else if (buttons[x].className == 'editing_groupsvisible') {
594 this.groupmode = this.VISIBLEGROUPS;
598 if (updateButton == null) {
599 // Update button must always be present.
600 YAHOO.log('Cannot find updateButton for '+this.getEl().id, 'error');
603 // Clear all the buttons.
604 commandContainer.innerHTML = '';
606 // Add move-handle for drag and drop.
607 var handleRef = main.mk_button('a', '/i/move_2d.gif',
608 [['style', 'cursor:move'], ['title', main.portal.strings['move']]],
609 [['height', '11'], ['width', '11'], ['style', 'margin-right:3px; border:0;']]);
611 YAHOO.util.Dom.generateId(handleRef, 'sectionHandle');
612 this.handle = handleRef;
613 commandContainer.appendChild(handleRef);
614 this.setHandleElId(this.handle.id);
616 // Add indentation buttons if needed (move left, move right).
618 var button = main.mk_button('a', '/t/left.gif', [['title', main.portal.strings['moveleft']],
619 ['class', 'editing_moveleft']]);
620 YAHOO.util.Event.addListener(button, 'click', this.indent_left, this, true);
621 commandContainer.appendChild(button);
622 this.indentLeftButton = button;
626 var button = main.mk_button('a', '/t/right.gif', [['title', main.portal.strings['moveright']],
627 ['class', 'editing_moveright']]);
628 YAHOO.util.Event.addListener(button, 'click', this.indent_right, this, true);
629 commandContainer.appendChild(button);
630 this.indentRightButton = button;
633 // Add edit button back in.
634 commandContainer.appendChild(updateButton);
636 // Add the delete button.
637 var button = main.mk_button('a', '/t/delete.gif');
638 YAHOO.util.Event.addListener(button, 'click', this.delete_button, this, true);
639 commandContainer.appendChild(button);
641 // Add the hide or show button.
643 var button = main.mk_button('a', '/t/show.gif');
645 var button = main.mk_button('a', '/t/hide.gif');
647 YAHOO.util.Event.addListener(button, 'click', this.toggle_hide, this, true);
648 commandContainer.appendChild(button);
649 this.viewButton = button;
651 // Add the groupmode button if needed.
652 if (this.groupmode != null) {
653 if (this.groupmode == this.NOGROUPS) {
654 var button = main.mk_button('a', '/t/groupn.gif', [['title', strgroupsnone]]);
655 } else if (this.groupmode == this.SEPARATEGROUPS) {
656 var button = main.mk_button('a', '/t/groups.gif', [['title', strgroupsseparate]]);
658 var button = main.mk_button('a', '/t/groupv.gif', [['title', strgroupsvisible]]);
660 YAHOO.util.Event.addListener(button, 'click', this.toggle_groupmode, this, true);
661 commandContainer.appendChild(button);
662 this.groupButton = button;
667 resource_class.prototype.indent_left = function() {
669 var spacer = YAHOO.util.Dom.getElementsByClassName('spacer',
670 'img', this.getEl())[0];
673 YAHOO.log('Could not indent left: spacer image does not exist', 'error');
677 if (spacer.width > 20) {
680 // Remove the spacer.
681 resource = this.getEl();
682 resource.removeChild(spacer);
684 // Remove the indent left button as well.
685 var commandContainer = YAHOO.util.Dom.getElementsByClassName('commands',
686 'span', this.getEl())[0];
688 commandContainer.removeChild(this.indentLeftButton);
689 this.indentLeftButton = null;
691 main.connect('POST', 'class=resource&field=indentleft', null, 'id='+this.id);
696 resource_class.prototype.indent_right = function() {
698 var spacer = YAHOO.util.Dom.getElementsByClassName('spacer',
699 'img', this.getEl())[0];
701 var spacer = document.createElement('img');
703 spacer.setAttribute('src', main.portal.strings['pixpath']+'/spacer.gif');
704 spacer.className = 'spacer';
705 spacer.setAttribute('width', '20');
706 spacer.setAttribute('height', '12');
708 var resource = this.getEl();
709 resource.insertBefore(spacer, resource.childNodes[0]);
713 // Add a indent left button if none is present.
714 var commandContainer = YAHOO.util.Dom.getElementsByClassName('commands',
715 'span', this.getEl())[0];
717 if (!this.indentLeftButton) {
718 var button = main.mk_button('a', '/t/left.gif', [['title', main.portal.strings['moveleft']],
719 ['class', 'editing_moveleft']]);
720 YAHOO.util.Event.addListener(button, 'click', this.indent_left, this, true);
721 commandContainer.insertBefore(button, this.indentRightButton);
722 this.indentLeftButton = button;
724 main.connect('POST', 'class=resource&field=indentright', null, 'id='+this.id);
729 resource_class.prototype.toggle_hide = function(target, e, superficial, force) {
732 YAHOO.log("Resource "+this.getEl().id+" forced to "+force);
734 this.hidden = !force;
737 YAHOO.util.Dom.removeClass(this.linkContainer, 'dimmed');
738 this.viewButton.childNodes[0].src = this.viewButton.childNodes[0].src.replace(/show.gif/i, 'hide.gif');
742 main.connect('POST', 'class=resource&field=visible', null, 'value=1&id='+this.id);
745 YAHOO.util.Dom.addClass(this.linkContainer, 'dimmed');
746 this.viewButton.childNodes[0].src = this.viewButton.childNodes[0].src.replace(/hide.gif/i, 'show.gif');
750 main.connect('POST', 'class=resource&field=visible', null, 'value=0&id='+this.id);
756 resource_class.prototype.groupImages = ['/t/groupn.gif', '/t/groups.gif', '/t/groupv.gif'];
759 resource_class.prototype.toggle_groupmode = function() {
761 if (this.groupmode > 2) {
765 var newtitle = this.groupButton.getElementsByTagName('img')[0].title;
767 switch (this.groupmode) {
769 newtitle = main.portal.strings['groupsnone']+' ('+main.portal.strings['clicktochange']+')';
772 newtitle = main.portal.strings['groupsseparate']+' ('+main.portal.strings['clicktochange']+')';
775 newtitle = main.portal.strings['groupsvisible']+' ('+main.portal.strings['clicktochange']+')';
779 this.groupButton.getElementsByTagName('img')[0].title = newtitle;
781 this.groupButton.getElementsByTagName('img')[0].src = main.portal.strings['pixpath']+this.groupImages[this.groupmode];
782 main.connect('POST', 'class=resource&field=groupmode', null, 'value='+this.groupmode+'&id='+this.id);
786 resource_class.prototype.delete_button = function() {
788 YAHOO.log("Deleting "+this.getEl().id+" from parent "+this.parentObj.getEl().id);
790 if (!confirm(main.getString('deletecheck', main.getString(this.is)+" "+this.id))) {
793 this.parentObj.remove_resource(this);
794 main.connect('DELETE', 'class=resource&id='+this.id);
798 resource_class.prototype.update_index = function(index) {
800 YAHOO.log("Updating Index for resource "+this.getEl().id+" to "+index);
805 resource_class.prototype.startDrag = function(x, y) {
806 YAHOO.util.DDM.mode = YAHOO.util.DDM.INTERSECT;
808 //reinitialize dd element
809 this.getDragEl().innerHTML = '';
811 var targets = YAHOO.util.DDM.getRelated(this, true);
813 YAHOO.log(this.id + " startDrag "+targets.length + " targets");
818 resource_class.prototype.clear_move_markers = function(target) {
819 if (target.is == 'section') {
820 resources = target.resources;
822 resources = target.parentObj.resources;
824 for (var i=0; i<resources.length; i++) {
825 YAHOO.util.Dom.setStyle(resources[i].getEl().id, 'border', 'none');
830 resource_class.prototype.onDragOver = function(e, ids) {
831 var target = YAHOO.util.DDM.getBestMatch(ids);
833 this.clear_move_markers(target);
835 if (target != this && (target.is == 'resource' || target.is == 'activity')) {
836 // Add a top border to show where the drop will place the resource.
837 YAHOO.util.Dom.setStyle(target.getEl().id, 'border-top', '1px solid #BBB');
838 } else if (target.is == 'section' && target.resources.length > 0) {
839 // We need to have a border at the bottom of the last activity in
841 YAHOO.util.Dom.setStyle(target.resources[target.resources.length - 1].getEl().id,
842 'border-bottom', '1px solid #BBB');
847 resource_class.prototype.onDragOut = function(e, ids) {
848 var target = YAHOO.util.DDM.getBestMatch(ids);
850 this.clear_move_markers(target);
855 resource_class.prototype.onDragDrop = function(e, ids) {
856 var target = YAHOO.util.DDM.getBestMatch(ids);
858 YAHOO.log('onDragDrop: Target is not valid!', 'error');
862 YAHOO.log("Dropped on section id="+target.sectionId
863 +", el="+this.getEl().id
864 +", x="+YAHOO.util.Dom.getXY( this.getDragEl() ));
866 this.parentObj.remove_resource(this);
868 if (target.is == 'resource' || target.is == 'activity') {
869 target.parentObj.insert_resource(this, target);
870 } else if (target.is == 'section') {
871 target.insert_resource(this);
873 this.clear_move_markers(target);
878 resource_class.prototype.endDrag = function() {
879 // Eliminates default action