| Author |
Message |
Guest
|
Posted:
Thu Jan 06, 2005 5:41 am Post subject:
Display a warning on initial login |
|
|
I want to display a site usage terms message that fades out after 3
seconds when a user first hits the home page or when a user is
redirected to one of the sites pages from another site.
What would be the best way to accomplish this in a Sharepoint web part?
I think it would be a little easier in asp.net but I am not sure how
asp.net pages really integrate with SharePoint. |
|
| Back to top |
|
 |
Gary A. Bushey [MVP]
Guest
|
Posted:
Thu Jan 06, 2005 5:44 pm Post subject:
Re: Display a warning on initial login |
|
|
if you can write this in ASP.Net it should not be very difficult to convert
into a SPS Web part as they all use .Net (Web Parts in SPS 2003 are really
ASP.Net server controls). One thing that I have done which is similar is
to just use JavaScript to show an alert and let the person click OK.
--
Gary A. Bushey
SPS MVP
bushey@mindspring.com
<sroberts@merklenet.com> wrote in message
news:1104968518.083009.275670@z14g2000cwz.googlegroups.com...
| Quote: | I want to display a site usage terms message that fades out after 3
seconds when a user first hits the home page or when a user is
redirected to one of the sites pages from another site.
What would be the best way to accomplish this in a Sharepoint web part?
I think it would be a little easier in asp.net but I am not sure how
asp.net pages really integrate with SharePoint.
|
|
|
| Back to top |
|
 |
SARRR
Guest
|
Posted:
Thu Jan 06, 2005 10:43 pm Post subject:
Re: Display a warning on initial login |
|
|
Gary,
That sounds like a good idea simple, cross-browser. One of my
requirements is to display this warning on the home page when they
login, and on any other page if they are directed to it from another
site.
With Asp.Net sessions it would be easy, new session show the dialog,
but I see no equivalent in SharePoint.
How do you tell when a user has started a new session in SharePoint,
and when they have an existing session?
Thanks again |
|
| Back to top |
|
 |
SARRR
Guest
|
Posted:
Thu Jan 06, 2005 10:50 pm Post subject:
Re: Display a warning on initial login |
|
|
Gary,
In addition to the above It would also be ideal to have this
functionality centralized so that I would not have to manually include
this web part on every page. Maybe a script using stsadm or something? |
|
| Back to top |
|
 |
Gary A. Bushey [MVP]
Guest
|
Posted:
Fri Jan 07, 2005 5:16 pm Post subject:
Re: Display a warning on initial login |
|
|
Here is the script I use. I just paste it into a Content Editor Web Part
<SCRIPT Language="JavaScript">
function openAlertOnce()
{
if (document.cookie.indexOf("HomePopUp") == -1)
{
var notice="NOTICE. ";
alert(notice);
document.cookie="HomePopUp=used"
}
}
openAlertOnce();
</script>
--
Gary A. Bushey
SPS MVP
bushey@mindspring.com
"SARRR" <sroberts@merklenet.com> wrote in message
news:1105030204.847956.140540@f14g2000cwb.googlegroups.com...
| Quote: | Gary,
In addition to the above It would also be ideal to have this
functionality centralized so that I would not have to manually include
this web part on every page. Maybe a script using stsadm or something?
|
|
|
| Back to top |
|
 |
SARRR
Guest
|
Posted:
Fri Jan 07, 2005 8:00 pm Post subject:
Re: Display a warning on initial login |
|
|
Gary,
I made a web part that uses the UrlReferrer property to try to
determine when the site warning should be displayed. (_siteHost is the
site domain name). If the referrer is not local I send back the script
block.
/// <summary>
/// Determines if a request was referred locally.
/// </summary>
/// <returns>A boolean.</returns>
private bool ReferrerIsLocal()
{
string referrerHost = "";
// No referrer always show warning...
if(this.Page.Request.UrlReferrer == null)
return false;
else
referrerHost = this.Page.Request.UrlReferrer.Host;
// Referred from other site.
if(referrerHost != _siteHost)
return false;
// Referrer is local.
return true;
} |
|
| Back to top |
|
 |
|
|
|
|