- // User Defined Page: module.js
- (function(){
- var querystring=document.location.search;
- if (/dlta=mog/.test(querystring)) {
- //GRID EDIT PAGE ========================================
- //alert("You are on the Grid Edit Page");
- } else if(/a=er/.test(querystring)) {
- //EDIT RECORD PAGE ========================================
- //alert("You are on the Edit Record Page");
- } else if (/GenNewRecord/.test(querystring)) {
- //ADD RECORD PAGE ========================================
- //alert("You are on the Add Record Page");
- //Method 1 using Math.random()
- $("#_fid_6").val(Math.floor(Math.random()*100+1));
- //Method 2 using YQL and random.org datatable
- var url="http://query.yahooapis.com/v1/public/yql?q=use%20%22http%3A%2F%2Fscooterlabs.com%2Fyql%2Frandom.integers.xml%22%3B%0Aselect%20*%20from%20random.integers%20where%20num%3D%221%22%20and%20min%3D%221%22%20and%20max%3D%22100%22%3B&format=json&diagnostics=true&callback=?"
- $.getJSON(url,function(data){
- $("#_fid_8").val(data.query.results.data.value);
- });
- // See http://www.cantoni.org/2010/02/22/random-numbers-via-yql
- //YQL Console Query:
- //use "http://scooterlabs.com/yql/random.integers.xml";
- //select * from random.integers where num="1" and min="1" and max="100";
- } else if(/a=dr/.test(querystring)) {
- //DISPLAY RECORD PAGE
- //alert("You are on the Display Record Page");
- $("img[qbu=module]").closest("td").css("background-color","#FFFFFF");
- } else if(/a=q/.test(querystring)) {
- //REPORT PAGE ========================================
- //alert("You are on the Report Listing Page");
- } else {
- //OTHER PAGE ========================================
- //alert("You are on the Some Other Page");
- }
- })();
- // Formula: [- (text w/ some HTML)]=
- //
- // "<img qbu=\"module\" src=\"/i/clear2x2.gif\" " &
- // "onload=\"javascript:if(typeof QBU=='undefined'){QBU={};$.getScript('" &
- // URLRoot() &
- // "db/" &
- // Dbid() &
- // "?a=dbpage&pagename=module.js&rand='+Math.random())}\">"