|
| 1 | +; (function () { |
| 2 | + |
| 3 | + jsPlumb.ready(function () { |
| 4 | + |
| 5 | + // setup some defaults for jsPlumb. |
| 6 | + console.log("jsplumb is ready"); |
| 7 | + |
| 8 | + |
| 9 | + jsPlumb.bind("connection", function(info) |
| 10 | + { |
| 11 | + console.log(info.sourceId); |
| 12 | + console.log(info.targetId); |
| 13 | + if(connectionflag == 0 ) |
| 14 | + { |
| 15 | + if(info.sourceId == info.targetId) |
| 16 | + { |
| 17 | + jsPlumb.detach(info); |
| 18 | + var shortCutFunction = 'info'; |
| 19 | + var msg = "Self connection is not allowed"; |
| 20 | + var title = 'Disconnected'; |
| 21 | + |
| 22 | + toastr.options = { |
| 23 | + 'closeButton': 'true', |
| 24 | + debug: false, |
| 25 | + positionClass: 'toast-top-right', |
| 26 | + onclick: null |
| 27 | + }; |
| 28 | + |
| 29 | + |
| 30 | + var $toast = toastr[shortCutFunction](msg, title); // Wire up an event handler to a button in the toast, if it exists |
| 31 | + // $toastlast = $toast; |
| 32 | + if ($toast.find('#okBtn').length) { |
| 33 | + $toast.delegate('#okBtn', 'click', function () { |
| 34 | + |
| 35 | + $toast.remove(); |
| 36 | + }); |
| 37 | + } |
| 38 | + } |
| 39 | + else |
| 40 | + { |
| 41 | + console.log(info.sourceId.substring(0,4)); |
| 42 | + |
| 43 | + var res = info.sourceId.substring(0,4) |
| 44 | + |
| 45 | + |
| 46 | + if( res == "RIDN") |
| 47 | + { |
| 48 | + if( info.targetId.substring(0,4) == "CURL" || info.targetId.substring(0,4) == "CFUN" ) |
| 49 | + { |
| 50 | + console.log(info); |
| 51 | + console.log(info.sourceEndpoint.connectorOverlays[0][1].label); |
| 52 | + temp = { "sourceId" : info.sourceId , "targetId" : info.targetId , "label" : info.sourceEndpoint.connectorOverlays[0][1].label , "sourceenpointposx" : info.sourceEndpoint.anchor.x , "sourceenpointposy" : info.sourceEndpoint.anchor.y } |
| 53 | + totalconfig.totalconnectionconfig.push(temp); |
| 54 | + |
| 55 | + |
| 56 | + var foundsource_id = info.sourceId.substring(0,4); |
| 57 | + console.log(foundsource_id); |
| 58 | + |
| 59 | + var foundtarget_id = info.targetId.substring(0,4); |
| 60 | + console.log(foundtarget_id); |
| 61 | + |
| 62 | + if(foundsource_id == "SIVR") source = "ivr" ; |
| 63 | + |
| 64 | + else if(foundsource_id == "HANG") source = "hangout" ; |
| 65 | + |
| 66 | + else if(foundsource_id == "AGTW") source = "agntworking" ; |
| 67 | + |
| 68 | + else if(foundsource_id == "COPN") source = "checkopening" ; |
| 69 | + |
| 70 | + else if(foundsource_id == "CTOR") source = "checktimerenge" ; |
| 71 | + |
| 72 | + else if(foundsource_id == "RIDN") source = "readnumber" ; |
| 73 | + |
| 74 | + else if(foundsource_id == "PLWF") source = "playwavfle" ; |
| 75 | + |
| 76 | + else if(foundsource_id == "TTOS") source = "texttospeech" ; |
| 77 | + |
| 78 | + else if(foundsource_id == "ITRM") source = "interactivemenu" ; |
| 79 | + |
| 80 | + else if(foundsource_id == "CURL") source = "callurl" ; |
| 81 | + |
| 82 | + else if(foundsource_id == "CFUN") source = "callfunction" ; |
| 83 | + |
| 84 | + else alert('big errot....................'); |
| 85 | + |
| 86 | + |
| 87 | + if(foundtarget_id == "SIVR") target = "ivr" ; |
| 88 | + |
| 89 | + else if(foundtarget_id == "HANG") target = "hangout" ; |
| 90 | + |
| 91 | + else if(foundtarget_id == "AGTW") target = "agntworking" ; |
| 92 | + |
| 93 | + else if(foundtarget_id == "COPN") target = "checkopening" ; |
| 94 | + |
| 95 | + else if(foundtarget_id == "CTOR") target = "checktimerenge" ; |
| 96 | + |
| 97 | + else if(foundtarget_id == "RIDN") target = "readnumber" ; |
| 98 | + |
| 99 | + else if(foundtarget_id == "PLWF") target = "playwavfle" ; |
| 100 | + |
| 101 | + else if(foundtarget_id == "TTOS") target = "texttospeech" ; |
| 102 | + |
| 103 | + else if(foundtarget_id == "ITRM") target = "interactivemenu" ; |
| 104 | + |
| 105 | + else if(foundtarget_id == "CURL") target = "callurl" ; |
| 106 | + |
| 107 | + else if(foundtarget_id == "CFUN") target = "callfunction" ; |
| 108 | + |
| 109 | + |
| 110 | + |
| 111 | + console.log(totalconfig[source][info.sourceId].endpoint[info.sourceEndpoint.connectorOverlays[0][1].label].con); |
| 112 | + totalconfig[source][info.sourceId].endpoint[info.sourceEndpoint.connectorOverlays[0][1].label].con = "yes"; |
| 113 | + console.log(totalconfig[source][info.sourceId].endpoint[info.sourceEndpoint.connectorOverlays[0][1].label].con); |
| 114 | + |
| 115 | + console.log(totalconfig[target][info.targetId].endpoint[info.targetEndpoint.connectorOverlays[0][1].label].con); |
| 116 | + totalconfig[target][info.targetId].endpoint[info.targetEndpoint.connectorOverlays[0][1].label].con = "yes"; |
| 117 | + console.log(totalconfig[target][info.targetId].endpoint[info.targetEndpoint.connectorOverlays[0][1].label].con); |
| 118 | + |
| 119 | + |
| 120 | + } |
| 121 | + else |
| 122 | + { |
| 123 | + jsPlumb.detach(info); |
| 124 | + |
| 125 | + var shortCutFunction = 'info'; |
| 126 | + var msg = "READ NUMBER CAN ONLY CNNECT TO CALL URL AND CALL FUNCTION"; |
| 127 | + var title = 'Disconnected'; |
| 128 | + |
| 129 | + toastr.options = { |
| 130 | + 'closeButton': 'true', |
| 131 | + debug: false, |
| 132 | + positionClass: 'toast-top-right', |
| 133 | + onclick: null |
| 134 | + }; |
| 135 | + |
| 136 | + |
| 137 | + var $toast = toastr[shortCutFunction](msg, title); // Wire up an event handler to a button in the toast, if it exists |
| 138 | + // $toastlast = $toast; |
| 139 | + if ($toast.find('#okBtn').length) { |
| 140 | + $toast.delegate('#okBtn', 'click', function () { |
| 141 | + |
| 142 | + $toast.remove(); |
| 143 | + }); |
| 144 | + } |
| 145 | + } |
| 146 | + } |
| 147 | + else{ |
| 148 | + // |
| 149 | + console.log(info); |
| 150 | + console.log(info.sourceEndpoint.connectorOverlays[0][1].label); |
| 151 | + temp = { "sourceId" : info.sourceId , "targetId" : info.targetId , "label" : info.sourceEndpoint.connectorOverlays[0][1].label , "sourceenpointposx" : info.sourceEndpoint.anchor.x , "sourceenpointposy" : info.sourceEndpoint.anchor.y } |
| 152 | + totalconfig.totalconnectionconfig.push(temp); |
| 153 | + |
| 154 | + console.log(":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::"); |
| 155 | + |
| 156 | + |
| 157 | + var foundsource_id = info.sourceId.substring(0,4); |
| 158 | + console.log(foundsource_id); |
| 159 | + |
| 160 | + var foundtarget_id = info.targetId.substring(0,4); |
| 161 | + console.log(foundtarget_id); |
| 162 | + |
| 163 | + if(foundsource_id == "SIVR") source = "ivr" ; |
| 164 | + |
| 165 | + else if(foundsource_id == "HANG") source = "hangout" ; |
| 166 | + |
| 167 | + else if(foundsource_id == "AGTW") source = "agntworking" ; |
| 168 | + |
| 169 | + else if(foundsource_id == "COPN") source = "checkopening" ; |
| 170 | + |
| 171 | + else if(foundsource_id == "CTOR") source = "checktimerenge" ; |
| 172 | + |
| 173 | + else if(foundsource_id == "RIDN") source = "readnumber" ; |
| 174 | + |
| 175 | + else if(foundsource_id == "PLWF") source = "playwavfle" ; |
| 176 | + |
| 177 | + else if(foundsource_id == "TTOS") source = "texttospeech" ; |
| 178 | + |
| 179 | + else if(foundsource_id == "ITRM") source = "interactivemenu" ; |
| 180 | + |
| 181 | + else if(foundsource_id == "CURL") source = "callurl" ; |
| 182 | + |
| 183 | + else if(foundsource_id == "CFUN") source = "callfunction" ; |
| 184 | + |
| 185 | + else alert('big errot....................'); |
| 186 | + |
| 187 | + |
| 188 | + if(foundtarget_id == "SIVR") target = "ivr" ; |
| 189 | + |
| 190 | + else if(foundtarget_id == "HANG") target = "hangout" ; |
| 191 | + |
| 192 | + else if(foundtarget_id == "AGTW") target = "agntworking" ; |
| 193 | + |
| 194 | + else if(foundtarget_id == "COPN") target = "checkopening" ; |
| 195 | + |
| 196 | + else if(foundtarget_id == "CTOR") target = "checktimerenge" ; |
| 197 | + |
| 198 | + else if(foundtarget_id == "RIDN") target = "readnumber" ; |
| 199 | + |
| 200 | + else if(foundtarget_id == "PLWF") target = "playwavfle" ; |
| 201 | + |
| 202 | + else if(foundtarget_id == "TTOS") target = "texttospeech" ; |
| 203 | + |
| 204 | + else if(foundtarget_id == "ITRM") target = "interactivemenu" ; |
| 205 | + |
| 206 | + else if(foundtarget_id == "CURL") target = "callurl" ; |
| 207 | + |
| 208 | + else if(foundtarget_id == "CFUN") target = "callfunction" ; |
| 209 | + |
| 210 | + |
| 211 | + |
| 212 | + console.log(totalconfig[source][info.sourceId].endpoint[info.sourceEndpoint.connectorOverlays[0][1].label].con); |
| 213 | + totalconfig[source][info.sourceId].endpoint[info.sourceEndpoint.connectorOverlays[0][1].label].con = "yes"; |
| 214 | + console.log(totalconfig[source][info.sourceId].endpoint[info.sourceEndpoint.connectorOverlays[0][1].label].con); |
| 215 | + |
| 216 | + console.log(totalconfig[target][info.targetId].endpoint[info.targetEndpoint.connectorOverlays[0][1].label].con); |
| 217 | + totalconfig[target][info.targetId].endpoint[info.targetEndpoint.connectorOverlays[0][1].label].con = "yes"; |
| 218 | + console.log(totalconfig[target][info.targetId].endpoint[info.targetEndpoint.connectorOverlays[0][1].label].con); |
| 219 | + //console.log(totalconfig); |
| 220 | + //console.log(totalconfig.agntworking.info.targetId); |
| 221 | + |
| 222 | + } |
| 223 | + |
| 224 | + } |
| 225 | + |
| 226 | + } |
| 227 | + |
| 228 | + }) |
| 229 | + }); |
| 230 | + })(); |
| 231 | + |
| 232 | + |
| 233 | + |
| 234 | + |
0 commit comments