js/result_rendering.js
// Note that PAGESIZE and SCRATCH_NUMBER are globals here---very ugly!!!
Note that PAGESIZE and SCRATCH_NUMBER are globals here---very ugly
Note that PAGESIZE and SCRATCH_NUMBER are globals here --- very ugly
function redrawDetailArea(transactionData,page,render_delete) {
	var detailAreaDiv = $("#"+'detailArea');
	detailAreaDiv.empty();
	var smallSlice = transactionData.slice(page*PAGESIZE,
Math.min((page+1)*PAGESIZE,transactionData.length));
	smallSlice.forEach(function (e,i,a) {
            detailAreaDiv.append(renderStyledDetail(e,SCRATCH_NUMBER,render_delete));
	    $(document).on( "click", "#scratch"+SCRATCH_NUMBER, detailItemHandler);
	    $("img[delete_id='"+e.p3id+"']").click(function () {
		var content_key = $(this).attr('delete_id');
                var deco = HANDLER_NAMESPACE_OBJECT.portfolio_url;
		var portfolio = PAGE_CONTEXT.portfolio_name;
                 $.post(deco+"/delete_association/"+portfolio+"/"+content_key,
			HANDLER_NAMESPACE_OBJECT.portfolio_post_data,
			HANDLER_NAMESPACE_OBJECT.decoration_deleted_function
                       ).fail(function() { alert("The addition of that record to the content_area portfolio failed."); });
            });
	    itemDetailAssociation[SCRATCH_NUMBER] = i+page*PAGESIZE;
	    SCRATCH_NUMBER++;
	});
       $( ".droppablerecord" ).droppable({
           tolerance: "touch",
           drop: function(event, ui) {
               var text = ui.draggable.attr('id').substring("draggable-id-".length);
                 var portfolio = isPortfolio(text);
		 var key = $(this).attr('p3id');
                 var deco = (portfolio) ? HANDLER_NAMESPACE_OBJECT.portfolio_url
		                        : HANDLER_NAMESPACE_OBJECT.tag_url;
                 $.post(deco+"/add_record/"+text+"/"+key,
		        function () {
		    $(HANDLER_NAMESPACE_OBJECT.decoration_add_dialog_id).dialog('open');
			}
                       ).fail(function() { alert("The addition of that record to the content_area portfolio failed."); });
           }
	});
       $( ".droppablerecord" ).draggable({ revert: true });
    }
function redrawDetailArea ( transactionData , page , render_delete ) { var detailAreaDiv = $ ( "#" + 'detailArea' ) ; detailAreaDiv . empty ( ) ; var smallSlice = transactionData . slice ( page * PAGESIZE , Math . min ( ( page + 1 ) * PAGESIZE , transactionData . length ) ) ; smallSlice . forEach ( function ( e , i , a ) { detailAreaDiv . append ( renderStyledDetail ( e , SCRATCH_NUMBER , render_delete ) ) ; $ ( document ) . on ( "click" , "#scratch" + SCRATCH_NUMBER , detailItemHandler ) ; $ ( "img[delete_id='" + e . p3id + "']" ) . click ( function ( ) { var content_key = $ ( this ) . attr ( 'delete_id' ) ; var deco = HANDLER_NAMESPACE_OBJECT . portfolio_url ; var portfolio = PAGE_CONTEXT . portfolio_name ; $ . post ( deco + "/delete_association/" + portfolio + "/" + content_key , HANDLER_NAMESPACE_OBJECT . portfolio_post_data , HANDLER_NAMESPACE_OBJECT . decoration_deleted_function ) . fail ( function ( ) { alert ( "The addition of that record to the content_area portfolio failed." ) ; } ) ; } ) ; itemDetailAssociation [ SCRATCH_NUMBER ] = i + page * PAGESIZE ; SCRATCH_NUMBER ++ ; } ) ; $ ( ".droppablerecord" ) . droppable ( { tolerance : "touch" , drop : function ( event , ui ) { var text = ui . draggable . attr ( 'id' ) . substring ( "draggable-id-" . length ) ; var portfolio = isPortfolio ( text ) ; var key = $ ( this ) . attr ( 'p3id' ) ; var deco = ( portfolio ) ? HANDLER_NAMESPACE_OBJECT . portfolio_url : HANDLER_NAMESPACE_OBJECT . tag_url ; $ . post ( deco + "/add_record/" + text + "/" + key , function ( ) { $ ( HANDLER_NAMESPACE_OBJECT . decoration_add_dialog_id ) . dialog ( 'open' ) ; } ) . fail ( function ( ) { alert ( "The addition of that record to the content_area portfolio failed." ) ; } ) ; } } ) ; $ ( ".droppablerecord" ) . draggable ( { revert : true } ) ; }
Note that PAGESIZE and SCRATCH_NUMBER are globals here---very ugly!!
Note that PAGESIZE and SCRATCH_NUMBER are globals here --- very ugly!!
// Ugly.... // Now we must make the drag/drop work.