Thursday, July 26, 2012

Date and Time Difference calculator

Look what I just found!!!


=DATEDIF([In-Progress Time],[Closed time]-(MOD([In-Progress Time],1)>MOD([Closed time],1)),"d")&" days, "&TEXT(MOD([Closed time]-[In-Progress Time],1),"hh "" hrs, "" mm "" mins""")

Wednesday, July 25, 2012

Auto Refresh Page

<script>
<!--
/*
Auto Refresh Page with Time script
*/
//enter refresh time in "minutes:seconds" Minutes should range from 0 to inifinity. Seconds should range from 0 to 59
var limit="0:5"
if (document.images){
var parselimit=limit.split(":")
parselimit=parselimit[0]*60+parselimit[1]*1
}
function beginrefresh(){
if (!document.images)
return
if (parselimit==1)
window.location.reload()
else{
parselimit-=1
curmin=Math.floor(parselimit/60)
cursec=parselimit%60
if (curmin!=0)
curtime=curmin+" minutes and "+cursec+" seconds left until page refresh!"
else
curtime=cursec+" seconds left until page refresh!"
window.status=curtime
setTimeout("beginrefresh()",1000)
}
}
window.onload=beginrefresh
//-->
</script>

Sharepoint form redirection


<script type="text/javascript" src="SITE/Images1/jquery-1.3.2.min.js%22%3E%3C/script>
<script type="text/javascript">
fields = init_fields();
// Where to go when cancel is clicked
goToWhenCanceled = 'http://sharepoint.apps.anz/teams/BHS/UnOccupied-Thanks.aspx';
// Edit the redirect on the cancel-button's
$('.ms-ButtonHeightWidth[id$="GoBack"]').each(function(){
    $(this).click(function(){
   STSNavigate(goToWhenCanceled);
   })
});
function init_fields(){
  var res = {};
  $("td.ms-formbody").each(function(){
   if($(this).html().indexOf('FieldInternalName="')<0) return;
   var start = $(this).html().indexOf('FieldInternalName="')+19;
   var stopp = $(this).html().indexOf('FieldType="')-7;
   var nm = $(this).html().substring(start,stopp);
   res[nm] = this.parentNode;
  });
  return res;
}
</script>


Disable edit on fields on a SharePoint form


<SCRIPT language=javascript>
function DisableField(title)
{
    for(var i = 0; i < document.all.length; i++)
    {
        var el = document.all[i];
        if(el.title == title)
        {
            el.readOnly = true;
            break;
        }
    }
}
DisableField("Bay");
DisableField("Pos");
DisableField("Status");
</SCRIPT>

Hide SharePoint Field on Form

this script will hide the fields selected



<script language="javascript" type="text/javascript" src="SITE/Images1/jquery-1.3.2.min.js"></script>
<script language="javascript" type="text/javascript">
 $(document).ready(function() {
$("input[Title='Pos']").parents('tr:first').hide();
$("input[Title='Delete Item']").parents('tr:first').hide();

 });
// this script below till set default value in a edit form
jQuery("select[title$=Status] option[value='Occupied']").attr("selected", "selected");
jQuery("select[title$=Occupancy Hours] option[value='9']").attr("selected", "selected");
</script>


 

Tuesday, July 24, 2012

SharePoint Full Screen

<style type="text/css">
.ms-titlearearight { DISPLAY: none; VISIBILITY: hidden}
.ms-titlearealeft { DISPLAY: none; VISIBILITY: hidden}
.ms-titleareaframe { DISPLAY: none; VISIBILITY: hidden}
.ms-titlearea { DISPLAY: none; VISIBILITY: hidden}
.ms-titleimagearea { DISPLAY: none; VISIBILITY: hidden}
.ms-nav   {DISPLAY: none; VISIBILITY: hidden}
.ms-navframe { DISPLAY: none; VISIBILITY: hidden}
.ms-navheader zz2_QuickLaunchMenu_4 { DISPLAY: none; VISIBILITY: hidden}
.ms-quicklaunchouter { DISPLAY: none; VISIBILITY: hidden}
.ms-quickLaunch { DISPLAY: none; VISIBILITY: hidden}
.ms-quicklaunchheader { DISPLAY: none; VISIBILITY: hidden}
.ms-hidden { DISPLAY: none; VISIBILITY: hidden}
.ms-globalTitleArea { DISPLAY: none; VISIBILITY: hidden}
.ms-globalleft { DISPLAY: none; VISIBILITY: hidden}
.ms-topnav { DISPLAY: none; VISIBILITY: hidden}
.ms-topnavcontainer { DISPLAY: none; VISIBILITY: hidden}
.ms-topnavbar { DISPLAY: none; VISIBILITY: hidden}
.ms-topnavselected { DISPLAY: none; VISIBILITY: hidden}
.ms-topNavHover { DISPLAY: none; VISIBILITY: hidden}
.ms-pagetitleareaframe { DISPLAY: none; VISIBILITY: hidden}
.ms-pagetitle { DISPLAY: none; VISIBILITY: hidden}
.ms-pagemargin { DISPLAY: none; VISIBILITY: hidden}
.ms-banner { DISPLAY: none; VISIBILITY: hidden}
.ms-bannercontainer { DISPLAY: none; VISIBILITY: hidden}
hides the top blue banner
</style>

Digital World Clock

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled 2</title>
<script language="JavaScript">
<!--
function worldClock(zone,MinI, region){
var dst = 0
var time = new Date()
var gmtMS = time.getTime() + (time.getTimezoneOffset() * 60000)
var gmtTime = new Date(gmtMS)
var day = gmtTime.getDate()
var month = gmtTime.getMonth()
var year = gmtTime.getYear()
if(year < 1000){
year += 1900
}
var monthArray = new Array("January", "February", "March", "April", "May", "June", "July", "August",
    "September", "October", "November", "December")
var monthDays = new Array("31", "28", "31", "30", "31", "30", "31", "31", "30", "31", "30", "31")
if (year%4 == 0){
monthDays = new Array("31", "29", "31", "30", "31", "30", "31", "31", "30", "31", "30", "31")
}
if(year%100 == 0 && year%400 != 0){
monthDays = new Array("31", "28", "31", "30", "31", "30", "31", "31", "30", "31", "30", "31")
}
var hr = gmtTime.getHours() + zone
var min = gmtTime.getMinutes()+ MinI
var sec = gmtTime.getSeconds()

if(min>59)
 {
 var min = gmtTime.getMinutes()-"30"
 var hr = hr+1
 }
if (hr >= 24){
hr = hr-24
day -= -1
}
if (hr < 0){
hr -= -24
day -= 1
}
if (hr < 10){
hr = " " + hr
}
if (min < 10){
 min = "0" + min}
if (sec < 10)
{
sec = "0" + sec
}
if (day <= 0){
if (month == 0){
 month = 11
 year -= 1
 }
 else{
 month = month -1
 }
day = monthDays[month]
}
if(day > monthDays[month]){
 day = 1
 if(month == 11){
 month = 0
 year -= -1
 }
 else{
 month -= -1
 }
}
if (region == "NAmerica"){
 var startDST = new Date()
 var endDST = new Date()
 startDST.setMonth(3)
 startDST.setHours(2)
 startDST.setDate(1)
 var dayDST = startDST.getDay()
 if (dayDST != 0){
  startDST.setDate(8-dayDST)
  }
  else{
  startDST.setDate(1)
  }
 endDST.setMonth(9)
 endDST.setHours(1)
 endDST.setDate(31)
 dayDST = endDST.getDay()
 endDST.setDate(31-dayDST)
 var currentTime = new Date()
 currentTime.setMonth(month)
 currentTime.setYear(year)
 currentTime.setDate(day)
 currentTime.setHours(hr)
 if(currentTime >= startDST && currentTime < endDST){
  dst = 1
  }
}
if (region == "Europe"){
 var startDST = new Date()
 var endDST = new Date()
 startDST.setMonth(2)
 startDST.setHours(1)
 startDST.setDate(31)
 var dayDST = startDST.getDay()
 startDST.setDate(31-dayDST)
 endDST.setMonth(9)
 endDST.setHours(0)
 endDST.setDate(31)
 dayDST = endDST.getDay()
 endDST.setDate(31-dayDST)
 var currentTime = new Date()
 currentTime.setMonth(month)
 currentTime.setYear(year)
 currentTime.setDate(day)
 currentTime.setHours(hr)
 if(currentTime >= startDST && currentTime < endDST){
  dst = 1
  }
}
if (region == "SAmerica"){
 var startDST = new Date()
 var endDST = new Date()
 startDST.setMonth(9)
 startDST.setHours(0)
 startDST.setDate(1)
 var dayDST = startDST.getDay()
 if (dayDST != 0){
  startDST.setDate(22-dayDST)
  }
  else{
  startDST.setDate(15)
  }
 endDST.setMonth(1)
 endDST.setHours(11)
 endDST.setDate(1)
 dayDST = endDST.getDay()
 if (dayDST != 0){
  endDST.setDate(21-dayDST)
  }
  else{
  endDST.setDate(14)
  }
 var currentTime = new Date()
 currentTime.setMonth(month)
 currentTime.setYear(year)
 currentTime.setDate(day)
 currentTime.setHours(hr)
 if(currentTime >= startDST || currentTime < endDST){
  dst = 1
  }
}
if (region == "Cairo"){
 var startDST = new Date()
 var endDST = new Date()
 startDST.setMonth(3)
 startDST.setHours(0)
 startDST.setDate(30)
 var dayDST = startDST.getDay()
 if (dayDST < 5){
  startDST.setDate(28-dayDST)
  }
  else {
  startDST.setDate(35-dayDST)
  }
 endDST.setMonth(8)
 endDST.setHours(11)
 endDST.setDate(30)
 dayDST = endDST.getDay()
 if (dayDST < 4){
  endDST.setDate(27-dayDST)
  }
  else{
  endDST.setDate(34-dayDST)
  }
 var currentTime = new Date()
 currentTime.setMonth(month)
 currentTime.setYear(year)
 currentTime.setDate(day)
 currentTime.setHours(hr)
 if(currentTime >= startDST && currentTime < endDST){
  dst = 1
  }
}
if (region == "India")
{
 var startDST = new Date()
 var endDST = new Date()
 startDST.setMonth(3)
 startDST.setHours(2)
 startDST.setDate(1)
 endDST.setMonth(8)
 endDST.setHours(2)
 endDST.setDate(25)
 dayDST = endDST.getDay()
 if (dayDST != 0){
 endDST.setDate(32-dayDST)
 }
 else{
 endDST.setDate(1)
 endDST.setMonth(9)
 }
 var currentTime = new Date()
 currentTime.setMonth(month)
 currentTime.setYear(year)
 currentTime.setDate(day)
 currentTime.setHours(hr)
 if(currentTime >= startDST && currentTime < endDST){
  dst = 1
  }

}
if (region == "Beirut"){
 var startDST = new Date()
 var endDST = new Date()
 startDST.setMonth(2)
 startDST.setHours(0)
 startDST.setDate(31)
 var dayDST = startDST.getDay()
 startDST.setDate(31-dayDST)
 endDST.setMonth(9)
 endDST.setHours(11)
 endDST.setDate(31)
 dayDST = endDST.getDay()
 endDST.setDate(30-dayDST)
 var currentTime = new Date()
 currentTime.setMonth(month)
 currentTime.setYear(year)
 currentTime.setDate(day)
 currentTime.setHours(hr)
 if(currentTime >= startDST && currentTime < endDST){
  dst = 1
  }
}
if (region == "Baghdad"){
 var startDST = new Date()
 var endDST = new Date()
 startDST.setMonth(3)
 startDST.setHours(3)
 startDST.setDate(1)
 endDST.setMonth(9)
 endDST.setHours(3)
 endDST.setDate(1)
 dayDST = endDST.getDay()
  var currentTime = new Date()
 currentTime.setMonth(month)
 currentTime.setYear(year)
 currentTime.setDate(day)
 currentTime.setHours(hr)
 if(currentTime >= startDST && currentTime < endDST){
  dst = 1
  }
}
if (region == "Australia"){
 var startDST = new Date()
 var endDST = new Date()
 startDST.setMonth(9)
 startDST.setHours(2)
 startDST.setDate(31)
 var dayDST = startDST.getDay()
 startDST.setDate(31-dayDST)
 endDST.setMonth(2)
 endDST.setHours(2)
 endDST.setDate(31)
 dayDST = endDST.getDay()
 endDST.setDate(31-dayDST)
 var currentTime = new Date()
 currentTime.setMonth(month)
 currentTime.setYear(year)
 currentTime.setDate(day)
 currentTime.setHours(hr)
 if(currentTime >= startDST || currentTime < endDST){
  dst = 1
  }
}

if (dst == 1){
 hr -= -1
 if (hr >= 24){
 hr = hr-24
 day -= -1
 }
 if (hr < 10){
 hr = " " + hr
 }
 if(day > monthDays[month]){
 day = 1
 if(month == 11){
 month = 0
 year -= -1
 }
 else{
 month -= -1
 }
 }
return monthArray[month] + " " + day + ", " + year + "<br>" + hr + ":" + min + ":" + sec + " DST"
}
else{
return monthArray[month] + " " + day + ", " + year + "<br>" + hr + ":" + min + ":" + sec
}
}
function worldClockZone(){
document.getElementById("GMT").innerHTML = worldClock(0,0, "Greenwich")
document.getElementById("Melbourne").innerHTML = worldClock(10,0, "Australia")
document.getElementById("Bangalore").innerHTML = worldClock(4,30, "India")
document.getElementById("Manila").innerHTML = worldClock(8,0, "Singapore")
document.getElementById("NewYork").innerHTML = worldClock(-5,0, "NAmerica")
document.getElementById("NZ").innerHTML = worldClock(12,0, "Australia")
document.getElementById("Singapore").innerHTML = worldClock(8,0, "Singapore")
setTimeout("worldClockZone()", 1000)
}
window.onload=worldClockZone;
//-->
</script>
<style type="text/css">
.body {
color: #000;
}
.hrow {
font-weight:bold;
color: #000;
}
.hrow td{
padding-top: 20px;
width: 140px;
}
</style>
</head>
<body>
<table cellspacing="5px" align="center">
<tr class="hrow">
<td>GMT</td>
<td>Melbourne</td>
<td>Bangalore</td>
<td>Manila</td>
<td>New York</td>
<td>Auckland</td>
<td>Singapore</td>
</tr>
<tr>
<td><font color="#004165"> <span id="GMT"></span></font></td>
<td><font color="#004165"> <span id="Melbourne"></span></font></td>
<td><font color="#004165"> <span id="Bangalore"></span></font></td>
<td><font color="#004165"> <span id="Manila"></span></font></td>
<td><font color="#004165"> <span id="NewYork"></span></font></td>
<td><font color="#004165"> <span id="NZ"></span></font></td>
<td><font color="#004165"> <span id="Singapore"></span></font></td>
</tr>

</table>

</body>
</html>

Color Gantt Chart

<script type="text/javascript" src="/teams/IOBE/Canttouch%20this/jquery-1.3.2.min.js"></script>
<script type="text/javascript">
// Set PicturesPath to the URL of the library that hosts the bar images:
var PicturesPath = "/teams/IOBE/Canttouch%20this/Images";

// Collect the priority level for each task
var barColours = new Array();
var regex = /\(\d\)\s(Amar\sNaidu|Baz\sSelwyn|Carol\sFrancis|Renjiv\sRaman|Ayesha\sSultana)/;
// Find the tasks summary list
var TasksList = $(".ms-ganttOuterTable").siblings("table").find(".ms-summarystandardbody>tbody>tr:not(.ms-viewheadertr)");
if (TasksList.length == 0) TasksList = $(".ms-ganttOuterTable").siblings("table").find(".ms-listviewtable>tbody>tr:not(.ms-viewheadertr)");

TasksList.each(function(i){
try {
barColours[i] = regex.exec($(this).text())[0].substr(1,1);
}
catch(err) {barColours[i] ="";}
});
// Modify the bar color according to priority
$(".ms-ganttTaskRow").each(function(i){
$(this).find("img").each(function(){
       var source=this.src;
       source = source.replace(/.gif/, barColours[i]+".gif");
       source = source.replace(/\/_layouts\/images/,PicturesPath);
       this.src=source;
});
});
//Optional: hide the list under the Gantt view
$(".ms-summarystandardbody").hide();
$(".ms-listviewtable").hide();
</script>

Dynamic Search

Have fun!!

<SCRIPT type="text/javascript"src="SITE/Shared%20Documents/Lib/js/jquery-1.7.1.min.js"></SCRIPT>
<SCRIPT type=text/javascript>
jQuery(document).ready(function($){
    //attach a function to the keyup event on the filter box
    $('#filterInput').keyup(function()
    {
        DynamicFilter($('#filterInput').val());
    });
})
//strip off html taqs
function stripHTML (field) {
    return field.replace(/<([^>]+)>/g,'');
}
function DynamicFilter(text)
{
    //find out list view (default class for a listview is "ms-listviewtable"
    $('table [class="ms-listviewtable"]').find('tr').each(function()
        {
            //don't filter out the header row
            if ($(this).attr("class") != "ms-viewheadertr ms-vhltr")
            {
                //get the html for the row and strip off the html tabs
                source = stripHTML($(this).html());
               
                //check to see if the filter text exists in the remaining text
                if (source.indexOf(text) < 0)
                {
                    //hide the row if it doesn't contain the text
                    $(this).hide();
                } else {
                    //otherwise show it
                    $(this).show();
                }
            }
        }
    );
}
</script>
<div id="mainDiv">
    <table>
        <tr>
            <td class='Filter' width='125px'>Search: <input type="Text" id="filterInput" ></td>
        </tr>
    </table>
</div>

Followers

No Locks without Key

🌿 Bible Verse 1 Corinthians 10:13 "No temptation has overtaken you except what is common to mankind. And God is faithful; ...

Who Am I?

My photo
What is mankind that you are mindful of them, human beings that you care for them? Psalms 8:4 But he made us a little lower than Angels and Crowned with Glory and Honor. How majestic is your name in all the Earth Oh Lord our God!