diff options
author | Shweta Chaughule <shwettach@gmail.com> | 2012-04-16 18:04:12 +0530 |
---|---|---|
committer | Shweta Chaughule <shwettach@gmail.com> | 2012-04-16 18:04:12 +0530 |
commit | 39467038c61056769e91e16c80130214c9811ada (patch) | |
tree | 688cd059c80cbc536a43a06506f95cbcfceb05fd /objectapp/static/objectapp | |
parent | 0aff6c0944e356efd6989093be174180a1a77e93 (diff) | |
download | gnowsys-39467038c61056769e91e16c80130214c9811ada.tar.gz |
Dynamic fomrs created, also files added for them.Property to get type added by Johnson - Shweta and Neeharika ( Citizen Science Group )
Diffstat (limited to 'objectapp/static/objectapp')
-rw-r--r-- | objectapp/static/objectapp/js/noat.js | 51 | ||||
-rw-r--r-- | objectapp/static/objectapp/js/saveat.js | 56 | ||||
-rw-r--r-- | objectapp/static/objectapp/js/savert.js | 59 | ||||
-rw-r--r-- | objectapp/static/objectapp/js/selectRT.js | 60 | ||||
-rw-r--r-- | objectapp/static/objectapp/js/setMember.js | 51 | ||||
-rw-r--r-- | objectapp/static/objectapp/js/setdate.js | 45 |
6 files changed, 322 insertions, 0 deletions
diff --git a/objectapp/static/objectapp/js/noat.js b/objectapp/static/objectapp/js/noat.js new file mode 100644 index 0000000..ef460ca --- /dev/null +++ b/objectapp/static/objectapp/js/noat.js @@ -0,0 +1,51 @@ +$ = django.jQuery + + + $(document).ready(function() { + + $("#id_back").ajaxSend(function(e,xhr,settings){ + + + function getCookie(name) { + var cookieValue = null; + if (document.cookie && document.cookie != '') { + var cookies = document.cookie.split(';'); + for (var i = 0; i < cookies.length; i++) { + var cookie = $.trim(cookies[i]); + // Does this cookie string begin with the name we want? + if (cookie.substring(0, name.length + 1) == (name + '=')) { + cookieValue = decodeURIComponent(cookie.substring(name.length + 1)); + break; + } + } + } + return cookieValue; + } + function sameOrigin(url) { + // url could be relative or scheme relative or absolute + var host = document.location.host; // host + port + var protocol = document.location.protocol; + var sr_origin = '//' + host; + var origin = protocol + sr_origin; + // Allow absolute or scheme relative URLs to same origin + return (url == origin || url.slice(0, origin.length + 1) == origin + '/') || + (url == sr_origin || url.slice(0, sr_origin.length + 1) == sr_origin + '/') || + // or any other URL that isn't scheme relative or absolute i.e relative. + !(/^(\/\/|http:|https:).*/.test(url)); + } + function safeMethod(method) { + return (/^(GET|HEAD|OPTIONS|TRACE)$/.test(method)); + } + + if (!safeMethod(settings.type) && sameOrigin(settings.url)) { + xhr.setRequestHeader("X-CSRFToken", getCookie('csrftoken')); + } + }); + $("#id_back").click(function(){ + absolute_url_node = document.getElementById("id_back_url") + window.location.replace(absolute_url_node.value); + }); + + }); + + diff --git a/objectapp/static/objectapp/js/saveat.js b/objectapp/static/objectapp/js/saveat.js new file mode 100644 index 0000000..55e602a --- /dev/null +++ b/objectapp/static/objectapp/js/saveat.js @@ -0,0 +1,56 @@ +$ = django.jQuery + + + $(document).ready(function() { + + $("#id_select").ajaxSend(function(e,xhr,settings){ + + + function getCookie(name) { + var cookieValue = null; + if (document.cookie && document.cookie != '') { + var cookies = document.cookie.split(';'); + for (var i = 0; i < cookies.length; i++) { + var cookie = $.trim(cookies[i]); + // Does this cookie string begin with the name we want? + if (cookie.substring(0, name.length + 1) == (name + '=')) { + cookieValue = decodeURIComponent(cookie.substring(name.length + 1)); + break; + } + } + } + return cookieValue; + } + function sameOrigin(url) { + // url could be relative or scheme relative or absolute + var host = document.location.host; // host + port + var protocol = document.location.protocol; + var sr_origin = '//' + host; + var origin = protocol + sr_origin; + // Allow absolute or scheme relative URLs to same origin + return (url == origin || url.slice(0, origin.length + 1) == origin + '/') || + (url == sr_origin || url.slice(0, sr_origin.length + 1) == sr_origin + '/') || + // or any other URL that isn't scheme relative or absolute i.e relative. + !(/^(\/\/|http:|https:).*/.test(url)); + } + function safeMethod(method) { + return (/^(GET|HEAD|OPTIONS|TRACE)$/.test(method)); + } + + if (!safeMethod(settings.type) && sameOrigin(settings.url)) { + xhr.setRequestHeader("X-CSRFToken", getCookie('csrftoken')); + } + }); + $("#id_select").change(function(){ + test = $("#id_select").val().toString() + //url = "/objects/context/test2/?id="+test + url = "/objects/dynamic/save/"+test+"/" + $.get(url, function(data){ + window.location.replace(url); + + }); + }); + + }); + + diff --git a/objectapp/static/objectapp/js/savert.js b/objectapp/static/objectapp/js/savert.js new file mode 100644 index 0000000..0e1f8b0 --- /dev/null +++ b/objectapp/static/objectapp/js/savert.js @@ -0,0 +1,59 @@ +$ = django.jQuery + + + $(document).ready(function() { + + $("#id_submit_rt").ajaxSend(function(e,xhr,settings){ + + + function getCookie(name) { + var cookieValue = null; + if (document.cookie && document.cookie != '') { + var cookies = document.cookie.split(';'); + for (var i = 0; i < cookies.length; i++) { + var cookie = $.trim(cookies[i]); + // Does this cookie string begin with the name we want? + if (cookie.substring(0, name.length + 1) == (name + '=')) { + cookieValue = decodeURIComponent(cookie.substring(name.length + 1)); + break; + } + } + } + return cookieValue; + } + function sameOrigin(url) { + // url could be relative or scheme relative or absolute + var host = document.location.host; // host + port + var protocol = document.location.protocol; + var sr_origin = '//' + host; + var origin = protocol + sr_origin; + // Allow absolute or scheme relative URLs to same origin + return (url == origin || url.slice(0, origin.length + 1) == origin + '/') || + (url == sr_origin || url.slice(0, sr_origin.length + 1) == sr_origin + '/') || + // or any other URL that isn't scheme relative or absolute i.e relative. + !(/^(\/\/|http:|https:).*/.test(url)); + } + function safeMethod(method) { + return (/^(GET|HEAD|OPTIONS|TRACE)$/.test(method)); + } + + if (!safeMethod(settings.type) && sameOrigin(settings.url)) { + xhr.setRequestHeader("X-CSRFToken", getCookie('csrftoken')); + } + }); + $("#id_submit_rt").click(function(){ + left = document.getElementById("id_left") + rt = document.getElementById("id_reltype") + right = document.getElementById("id_right") + absolute_url = document.getElementById("id_back_url") + url = "/objects/dynamicRelation/save/"+ left.value + "/" +rt.value+"/"+right.value+"/" + // alert(url); + $.get(url,function(data){ + window.location.replace(absolute_url.value); + }); + + }); + + }); + + diff --git a/objectapp/static/objectapp/js/selectRT.js b/objectapp/static/objectapp/js/selectRT.js new file mode 100644 index 0000000..7dbbcd8 --- /dev/null +++ b/objectapp/static/objectapp/js/selectRT.js @@ -0,0 +1,60 @@ +$ = django.jQuery + + + $(document).ready(function() { + + $("#id_select_rt").ajaxSend(function(e,xhr,settings){ + + + function getCookie(name) { + var cookieValue = null; + if (document.cookie && document.cookie != '') { + var cookies = document.cookie.split(';'); + for (var i = 0; i < cookies.length; i++) { + var cookie = $.trim(cookies[i]); + // Does this cookie string begin with the name we want? + if (cookie.substring(0, name.length + 1) == (name + '=')) { + cookieValue = decodeURIComponent(cookie.substring(name.length + 1)); + break; + } + } + } + return cookieValue; + } + function sameOrigin(url) { + // url could be relative or scheme relative or absolute + var host = document.location.host; // host + port + var protocol = document.location.protocol; + var sr_origin = '//' + host; + var origin = protocol + sr_origin; + // Allow absolute or scheme relative URLs to same origin + return (url == origin || url.slice(0, origin.length + 1) == origin + '/') || + (url == sr_origin || url.slice(0, sr_origin.length + 1) == sr_origin + '/') || + // or any other URL that isn't scheme relative or absolute i.e relative. + !(/^(\/\/|http:|https:).*/.test(url)); + } + function safeMethod(method) { + return (/^(GET|HEAD|OPTIONS|TRACE)$/.test(method)); + } + + if (!safeMethod(settings.type) && sameOrigin(settings.url)) { + xhr.setRequestHeader("X-CSRFToken", getCookie('csrftoken')); + } + }); + $("#id_select_rt").change(function(){ + relationtype = $(this).val().toString() + left = document.getElementById("id_left") + document.getElementById("id_reltype").value = relationtype + url = "/objects/dynamicRelation/displaymem/"+ relationtype + "/" +left.value+"/" + // alert(url); + $.get(url,function(data){ + $("#id_div1").empty() + $("#id_div1").html(data) + + }); + + }); + + }); + + diff --git a/objectapp/static/objectapp/js/setMember.js b/objectapp/static/objectapp/js/setMember.js new file mode 100644 index 0000000..a71b675 --- /dev/null +++ b/objectapp/static/objectapp/js/setMember.js @@ -0,0 +1,51 @@ +$ = django.jQuery + + + $(document).ready(function() { + + $("#id_select_mem").ajaxSend(function(e,xhr,settings){ + + + function getCookie(name) { + var cookieValue = null; + if (document.cookie && document.cookie != '') { + var cookies = document.cookie.split(';'); + for (var i = 0; i < cookies.length; i++) { + var cookie = $.trim(cookies[i]); + // Does this cookie string begin with the name we want? + if (cookie.substring(0, name.length + 1) == (name + '=')) { + cookieValue = decodeURIComponent(cookie.substring(name.length + 1)); + break; + } + } + } + return cookieValue; + } + function sameOrigin(url) { + // url could be relative or scheme relative or absolute + var host = document.location.host; // host + port + var protocol = document.location.protocol; + var sr_origin = '//' + host; + var origin = protocol + sr_origin; + // Allow absolute or scheme relative URLs to same origin + return (url == origin || url.slice(0, origin.length + 1) == origin + '/') || + (url == sr_origin || url.slice(0, sr_origin.length + 1) == sr_origin + '/') || + // or any other URL that isn't scheme relative or absolute i.e relative. + !(/^(\/\/|http:|https:).*/.test(url)); + } + function safeMethod(method) { + return (/^(GET|HEAD|OPTIONS|TRACE)$/.test(method)); + } + + if (!safeMethod(settings.type) && sameOrigin(settings.url)) { + xhr.setRequestHeader("X-CSRFToken", getCookie('csrftoken')); + } + }); + $("#id_select_mem").change(function(){ + right_member = $(this).val() + document.getElementById("id_right").value = right_member; + // alert("hello "+ right_member); + + }); + + }); diff --git a/objectapp/static/objectapp/js/setdate.js b/objectapp/static/objectapp/js/setdate.js new file mode 100644 index 0000000..42cc4dc --- /dev/null +++ b/objectapp/static/objectapp/js/setdate.js @@ -0,0 +1,45 @@ +$ = django.jQuery + + $(document).ready(function() { + + $('input[name$="DateField"]').ajaxSend(function(e,xhr,settings){ + + + function getCookie(name) { + var cookieValue = null; + if (document.cookie && document.cookie != '') { + var cookies = document.cookie.split(';'); + for (var i = 0; i < cookies.length; i++) { + var cookie = $.trim(cookies[i]); + // Does this cookie string begin with the name we want? + if (cookie.substring(0, name.length + 1) == (name + '=')) { + cookieValue = decodeURIComponent(cookie.substring(name.length + 1)); + break; + } + } + } + return cookieValue; + } + function sameOrigin(url) { + // url could be relative or scheme relative or absolute + var host = document.location.host; // host + port + var protocol = document.location.protocol; + var sr_origin = '//' + host; + var origin = protocol + sr_origin; + // Allow absolute or scheme relative URLs to same origin + return (url == origin || url.slice(0, origin.length + 1) == origin + '/') || + (url == sr_origin || url.slice(0, sr_origin.length + 1) == sr_origin + '/') || + // or any other URL that isn't scheme relative or absolute i.e relative. + !(/^(\/\/|http:|https:).*/.test(url)); + } + function safeMethod(method) { + return (/^(GET|HEAD|OPTIONS|TRACE)$/.test(method)); + } + + if (!safeMethod(settings.type) && sameOrigin(settings.url)) { + xhr.setRequestHeader("X-CSRFToken", getCookie('csrftoken')); + } + }); + + $('input[name$="DateField"]').datepicker({ dateFormat: "yy-mm-dd",minDate: new Date(1800, 1 - 1, 1), changeYear : true, changeMonth: true }); + }); |