modified: server/staging/lp15/volunteer.html: now uses the volunteer_js.html at...
authorrsiddharth <rsd@gnu.org>
Tue, 4 Nov 2014 03:44:51 +0000 (22:44 -0500)
committerrsiddharth <rsd@gnu.org>
Tue, 4 Nov 2014 03:44:51 +0000 (22:44 -0500)
new file:   server/staging/lp15/volunteer_js.html

server/staging/lp15/volunteer.html
server/staging/lp15/volunteer_js.html [new file with mode: 0644]

index 8e86d021adaaf0f0d714297131fb32497f5ca7dc..ce4c27e68974b1433ba2e4089962f2338b5f78c0 100755 (executable)
                        </form>
 
 <!--#include virtual="/server/2015/footer.html"-->
-<!--#include virtual="/server/2015/volunteer_js.html"-->
+<!--#include virtual="volunteer_js.html"-->
 <!--#include virtual="/server/2015/close.html" -->
diff --git a/server/staging/lp15/volunteer_js.html b/server/staging/lp15/volunteer_js.html
new file mode 100644 (file)
index 0000000..ba01e9a
--- /dev/null
@@ -0,0 +1,129 @@
+<script type="text/javascript"
+       src="/2015/assets/js/jquery-1.11.1.min.js">
+</script>
+
+<script type="text/javascript"
+               src="/2015/assets/js/civicrm-4.4.jquery.chainedSelects.js">
+</script>
+
+<script type="text/javascript"
+               src="/2015/assets/js/jquery.form-3.25.0.js">
+</script>
+
+<script type="text/javascript">
+         var cjnc = jQuery.noConflict(); $ = jQuery;
+
+         cjnc(function() {
+             countryID = "#country-Primary"
+             stateProvinceID = "#state_province-Primary"
+             callbackURL = "https://crm.fsf.org/civicrm/ajax/jqState"
+             cjnc(countryID).chainSelect(stateProvinceID, callbackURL, null);
+         });
+</script>
+
+<script type="text/javascript"
+               src="/2015/assets/js/civicrm-4.4.Common.js">
+</script>
+
+<script type="text/javascript">
+
+  if ( document.getElementsByName("cms_create_account")[0].checked ) {
+   cj('#details').show();
+      } else {
+   cj('#details').hide();
+      }
+
+   function showMessage( frm )
+   {
+      var cId = '';
+      if ( cId ) {
+   alert('You are logged-in user');
+   frm.checked = false;
+      } else {
+   var siteName = 'https://crm.fsf.org/';
+   alert('Please login if you have an account on this site with the link ' + siteName  );
+      }
+   }
+
+var lastName = null;
+cj("#checkavailability").click(function() {
+   var cmsUserName = cj.trim(cj("#cms_name").val());
+   if ( lastName == cmsUserName) {
+   /*if user checking the same user name more than one times. avoid the ajax call*/
+   return;
+   }
+   /*don't allow special character and for joomla minimum username length is two*/
+
+   var spchar = "\<|\>|\"|\'|\%|\;|\(|\)|\&|\\\\|\/";
+
+
+   spchar = spchar + "|\~|\`|\:|\@|\!|\=|\#|\$|\^|\*|\{|\}|\\[|\\]|\+|\?|\,";
+
+   var r = new RegExp( "["+spchar+"]", "i");
+   /*regular expression \\ matches a single backslash. this becomes r = /\\/ or r = new RegExp("\\\\").*/
+   if ( r.exec(cmsUserName) ) {
+   alert('Your username contains invalid characters');
+      return;
+   }
+
+   if (cmsUserName) {
+   /*take all messages in javascript variable*/
+   var check        = "Checking...";
+   var available    = "This username is currently available.";
+   var notavailable = "This username is taken.";
+   var errorMsg     = "Error checking username. Please reload the form and try again.";
+
+      //remove all the class add the messagebox classes and start fading
+      cj("#msgbox").removeClass().addClass('cmsmessagebox').css({"color":"#000","backgroundColor":"#FFC","border":"1px solid #c93"}).text(check).fadeIn("slow");
+
+      //check the username exists or not from ajax
+   var contactUrl = "https://crm.fsf.org/civicrm/ajax/cmsuser";
+
+   var checkUserParams = {
+       cms_name: cj("#cms_name").val(),
+       ts: "1414100302",
+       sig: "tnbf_fbeb8efc46bb22a55e83915c69ecba92",
+       for: 'civicrm/ajax/cmsuser'
+
+   };
+   cj.post(contactUrl, checkUserParams ,function(data) {
+      if ( data.name == "no") {/*if username not avaiable*/
+         cj("#msgbox").fadeTo(200,0.1,function() {
+      cj(this).html(notavailable).addClass('cmsmessagebox').css({"color":"#CC0000","backgroundColor":"#F7CBCA","border":"1px solid #CC0000"}).fadeTo(900,1);
+         });
+      } else if ( data.name == "error") {/*if username not avaiable*/
+         cj("#msgbox").fadeTo(200,0.1,function() {
+             cj(this).html(errorMsg).addClass('cmsmessagebox').css({"color":"#CC0000","backgroundColor":"#F7CBCA","border":"1px solid #CC0000"}).fadeTo(900,1);
+         });
+      } else {
+         cj("#msgbox").fadeTo(200,0.1,function() {
+      cj(this).html(available).addClass('cmsmessagebox').css({"color":"#008000","backgroundColor":"#C9FFCA", "border": "1px solid #349534"}).fadeTo(900,1);
+         });
+      }
+   }, "json");
+   lastName = cmsUserName;
+   } else {
+   cj("#msgbox").removeClass().text('').css({"backgroundColor":"#FFFFFF", "border": "0px #FFFFFF"}).fadeIn("fast");
+   }
+});
+
+
+   </script>
+
+         <script type="text/javascript">
+    var trigger_field_id = 'cms_create_account';
+    var trigger_value = '';
+    var target_element_id = 'details';
+    var target_element_type = 'block';
+    var field_type  = 'radio';
+    var invert = 0;
+
+    showHideByValue(trigger_field_id, trigger_value, target_element_id, target_element_type, field_type, invert);
+
+</script>
+
+<script type="text/javascript">
+ $("#volunteer-link").addClass("active");
+</script>
+<script type="text/javascript"
+        src="/2015/assets/js/piwik.js"></script>