1 2/** 3 * 4 * 5 */ 6function initialize_citation_editor() 7{ 8 $( '#sense_heading_accordion .citation_edit_button' ).button 9 ( 10 { 11 icons: 12 { 13 primary: 'ui-icon-pencil' 14 }, 15 text: false 16 } 17 ).click 18 ( 19 function( event, ui ) 20 { 21 var button = $(this); 22 var citation_id = $(this).val(); 23 24 var dialog = $( '<div>' ).dialog 25 ( 26 { 27 width: 720, 28 height: 480, 29 modal: true, 30 title: 'Edit Citation ID #' + citation_id, 31 buttons: 32 { 33 'Save': function() 34 { 35 36 var form = $(this).find( "form" )[0]; 37 38 if( typeof( form ) == "undefined" ) 39 { 40 dialog.dialog( 'destroy' ); 41 dialog.remove(); 42 return false; 43 } 44 45 var id = "#" + form.id; 46 47 var post_data = collect_form_for_ajax( id ); 48 49 post_data.fn = "citation"; // form name 50 post_data.c = 2; // command = SAVE 51 post_data.i = citation_id; // citation_id 52 53 wait_procedure( "Saving citation information..." ); 54 55 var gateway = analytics_gateway( 'form.php' ); 56 57 $.ajax 58 ( 59 { 60 url: gateway, 61 data: post_data, 62 success: function( data, textStatus, XHR ) 63 { 64 if( data.errorNumber == 0 ) 65 { 66 $( id + " input" ).removeClass( "ui-state-error" ) 67 $( id + " textarea" ).removeClass( "ui-state-error" ) 68 $( id + " select" ).removeClass( "ui-state-error" ) 69 70 dialog.dialog( 'destroy' ); 71 dialog.remove(); 72 } 73 74 // validation error 75 else if( data.errorNumber == 512 ) 76 { 77 $( data.errorList.reverse() ).each 78 ( 79 function( index, element ) 80 { 81 $( id + " input" ).removeClass( "ui-state-error" ) 82 $( id + " textarea" ).removeClass( "ui-state-error" ) 83 $( id + " select" ).removeClass( "ui-state-error" ) 84 85 $( "#" + element.id ).addClass( "ui-state-error" ).focus(); 86 $( "#" + element.name ).addClass( "ui-state-error" ).focus(); 87 88 error_procedure( null, element.message, null ); 89 } 90 ); 91 } 92 93 // some other error 94 else 95 { 96 alert( "Error: " + data.errorText ); 97 } 98 99 } 100 } 101 ); 102 103 }, 104 105 'Cancel': function() 106 { 107 dialog.dialog( 'destroy' ); 108 dialog.remove(); 109 }, 110 111 } 112 } 113 ).append 114 ( 115 $('<img>').attr( { src: '/images/spinner_16x16.gif', title: 'Loading...' } ) 116 ); 117 118 var gateway = analytics_gateway( 'form.php' ); 119 120 $.ajax 121 ( 122 { 123 url: gateway, 124 data: 125 { 126 fn: 'citation', // form name 127 c: 1, // command = RENDER 128 i: citation_id, // citation_id 129 }, 130 success: function( data, textStatus, XHR ) 131 { 132 dialog.html( data.form ); 133 134 // quoted_authors 135 hide_extra_form_inputs( dialog, "quoted_author" ); 136 137 // quoted_references 138 hide_extra_form_inputs( dialog, "quoted_reference" ); 139 140 // remainders 141 hide_extra_form_inputs( dialog, "remainder" ); 142 143 // potential_problems 144 hide_extra_form_inputs( dialog, "potential_problem" ); 145 146 } 147 } 148 ) 149 150 return false; 151 } 152 ); 153}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.