Archive for November, 2010

Landing page … Google maps

Some time ago I asked if anyone has recommendations for a geotargeting service.

Since the service from Google is simple and free I implemented this one for a demo for a customer. Below you can find the code. For now I display a dojo dialog when there are visitors from Canada, United States and … Sweden (because I am located there). You could of course do a redirect automatically or store the user selection in a cookie for next time. You get the point.

<?xml version=”1.0″ encoding=”UTF-8″?>
<xp:view xmlns:xp=”http://www.ibm.com/xsp/core&#8221; dojoTheme=”true”
dojoParseOnLoad=”true”>
<xp:this.resources>
<xp:styleSheet href=”../resources/dojo.css”></xp:styleSheet>
<xp:styleSheet href=”../dijit/themes/tundra/tundra.css”></xp:styleSheet>
</xp:this.resources>
<script type=”text/javascript”
src=”http://www.google.com/jsapi?key=ACME_GOOGLE_MAPS_KEY”&gt;
</script>
<script type=”text/javascript”
src=”https://ajax.googleapis.com/ajax/libs/dojo/1.5/dojo/dojo.xd.js”&gt;
</script>
<script>
dojo.require(“dojo.parser”);
dojo.require(“dijit.Dialog”);
dojo.require(“dijit.form.TextBox”);
dojo.addOnLoad(checkPref);
function checkPref(){
var location_redirect = getCookie(“site_pref”);
if (location_redirect == “”){
showDialog();
}
else{
top.location.href = window.location = location_redirect;
}
}
function showDialog(){
var cl = google.loader.ClientLocation;
var ccode = cl.address.country_code;
if ((ccode == “CA”)||(ccode == “US”)||(ccode == “SE”)){
//document.getElementById(‘your_location’).innerHTML = “Your country code = ” + ccode;
var dlg = dijit.byId(‘dialog1′);
dlg.show();
}
}
function setCookie(c_name,value,expiredays){
var exdate=new Date();
exdate.setDate(exdate.getDate()+expiredays);
document.cookie=c_name+ “=” +escape(value)+
((expiredays==null) ? “” : “;expires=”+exdate.toUTCString());
}
function getCookie(c_name){
if (document.cookie.length>0){
c_start=document.cookie.indexOf(c_name + “=”);
if (c_start!=-1){
c_start=c_start + c_name.length+1;
c_end=document.cookie.indexOf(“;”,c_start);
if (c_end==-1) c_end=document.cookie.length;
return unescape(document.cookie.substring(c_start,c_end));
}
}
return “”;
}
function loadPreferences(){
var location_redirect = getCookie(“site_pref”);
top.location.href = location_redirect;
}
</script>
<div dojoType=”dijit.Dialog” id=”dialog1″ title=”Select country”
style=”display:none;width:600px;”>
<h1>
Welcome to
<b>ACME</b>
</h1>
<div id=”your_location”></div>
<table border=”0″ width=”100%”>
<tr>
<td colspan=”2″>Visit:</td>
</tr>
<tr>
<td>
<b>USA site</b> <a href=”http://www.acme.com/us&#8221; target=”_top”>(English)</a>
<b>USA site 2</b> <a href=”javascript:setCookie(‘site_pref’,'http://www.acme.com/us’,’1000′);loadPreferences();” target=”_top”>(English)</a>
</td>
<td>
<b>Global site</b> <a href=”http://www.acme.com/&#8221; target=”_top”>(English)</a>
<b>Global site2</b> <a href=”javascript:setCookie(‘site_pref’,'http://www.acme.com/’,’1000′);loadPreferences();” target=”_top”>(English)</a>
</td>
</tr>
</table>

<div id=”divider”
style=”border-top:dashed 1px grey;margin:10px 0 10px 0″>
</div>

<div style=”float:left;width:272px;”>
<table width=”100%”>
<tr>
<td>
<b>Americas</b>
<br />
Canada,
<a href=”http://www.acme.com/us&#8221;
target=”_top”>
English
</a>
<br />
Latin America regional site,
<a href=”http://www.acme.com/cl&#8221;
target=”_top”>
Español
</a>
</td>
</tr>
<tr>
<td>
<b>Asia Pacific</b>
<br />
Asia Pacific regional site,
<a href=”http://www.acme.com/sg&#8221;
target=”_top”>
English
</a>
<br />
Australia,
<a href=”http://www.acme.com/au&#8221;
target=”_top”>
English
</a>
<br />
中国(China),
<a href=”http://www.acme.com/cn&#8221;
target=”_top”>
中文
</a>
<br />
日本 (Japan),
<a href=”http://www.acme.com/jp&#8221;
target=”_top”>
日本語
</a>
<br />
남한 (South Korea),
<a href=”http://www.acme.com/kr&#8221;
target=”_top”>
한국어
</a>
</td>
</tr>
</table>
</div>

<div>
<table width=”300px;”>
<tr>
<td>
<b>Europe</b>
<br />
CIS,
<a href=”http://www.acme.com/ru&#8221;
target=”_top”>
Россия
</a>
<br />
Suomi (Finland),
<a href=”http://www.acme.com/fi&#8221;
target=”_top”>
Suomeksi
</a>
<br />
Norge (Norway),
<a href=”http://www.acme.com/no&#8221;
target=”_top”>
Norsk
</a>
<br />
Polska (Poland),
<a href=”http://www.acme.com/pl&#8221;
target=”_top”>
Polski
</a>
<br />
Sverige (Sweden),
<a href=”http://www.acme.com/se&#8221;
target=”_top”>
Svenska
</a>
<br />
United Kingdom &amp; Ireland,
<a href=”http://www.acme.com/uk&#8221;
target=”_top”>
English
</a>
</td>
</tr>
<tr>
<td>
<b>Middle East and Africa</b>
<br />
Africa regional site,
<a href=”http://www.acme.com/za&#8221;
target=”_top”>
English
</a>
</td>
</tr>
</table>
</div>
</div>

</xp:view>

Here an example how it will look like:

Leave a Comment

Bildr – An update is upcoming

For my Bildr project on OpenNTF I am planning a new release soon. A major enhancement is the ability to upload images via a web browser. For this Mark Leusink helped me. You will be able to upload multiple images at once.

Picture: Step 1 – Enter meta data for the images to be uploaded.

Picture: Step 2 – Select your files and start uploading.

Besides this upload function a lot of minor enhancements have been implemented.

The startpage will have a 3 column layout and a datepicker:

I am currently working on improvements for the Google Map function and as soon that is finished I will release the update.

Even with the limited time to spend on the development I have the feeling that the application is becoming more mature now.

New ideas are of course always welcome!

 

Comments (4)

OpenNTF – Most active projects

When I was searching for a specific project on OpenNTF I was wondered about the appearance of some projects under the header ‘Most Active Projects‘.

Take for example XPages Wiki. Last release is dated from December 2009.

That feels like (xp)ages! So what are the criteria for most active project?

Comments (5)

Magic XPages converter

I attended the webinar yesterday organised by the LotusUserGroup. I was very curious about the responses from the attendees since I did not really get a hard-on from what I saw.

  • You do not buy a product but a service, how that service will result for you (in money) depends on your case
  • Not all items can be converted so you get a log file with items that could not be converted. So this requires manual work.
  • OneUI principles are not applied, so for a more attractive look you also need to apply manual work.

In general, as a Notes customer, I was quiet disappointed after the webinar. For each webification of a Notes application you still need to check if things work and apply some work to make the application fully work on the web. I also foresee that my customers want to apply so re-design when making an old application available for a browser so why not pay a little extra and get things done right?

What are your opinions?

 

UPDATE

I received a demonstration video from Nathan that gives a much better impression of the Transformer tool. I would like you to ask to wait untill that video becomes publicly available. For me it gave answers on many questions I had and it changed my perspective on the technical part.

I still have questions if the offering of a service in stead of a product (you can run yourself) is a proper solution. We have many databases installed, we do not know how many are candidate for web enablement and when customers will place an order for this. Performing an ad-hoc transformation (also for sales demo purposes) via an installed product would be a much better fit for me…

 

Comments (22)

Any recommendation for a good book about object-oriented JavaScript?

After reading Mastering Dojo plus HTML5: Up and Running and still waiting for the arrival of Mastering XPages there is place for a new book on my bedside cabinet.

Yesterday I read this post regarding object oriented JavaScript. So I did a quick search on Amazon (I used the German site since that is the nearest available from where I live (read: good shipping conditions)). The first book in the list (Object-Oriented JavaScript: Create scalable, reusable high-quality JavaScript applications and libraries) received not so good reviews, mainly because the code examples were too childish.

So that leaves me with the following question:

Do you have any recommendation for a good book about object-oriented JavaScript?

Comments (6)

PutInFolder method – does not allocate my private folder

For a search function in an application I would like to place results in a private (desktop) folder. For that I created a shared, private on first use folder. I do not want to have a folder residing on the server side because I fear this will blow up the view indexes. It is also a restriction in our environment (create personal folders is by default disabled).

The private folder will be created when opening the search form which is embedded in a split frame (on top the search form, in the bottom the folder).

However when I use the PutInFolder method, this tries to place result documents in the first folder it finds, in this case the shared, private on first use folder.

Call srchDoc.PutInFolder(“$fld-searchresults”)

This is also confirmed via a warning message:

If I look in design it seems the method wants to place the documents in the first folder it finds:

AddToFolder

On the other hand, when I have a document opened the AddToFolder formula has no problem with finding the correct folder:

@AddToFolder(“$fld-searchresults”;”")

Question

My question is quiet simple:

How can I make sure that my code places the documents in the private folder and not the shared one?

Comments (5)

Request: Personalize landing pages using GeoTargeting

Today I received a question from a customer if PHP could run on top of a Domino server. In the discussion that followed what the customer wants to achieve it became clear that he is more looking for a script to solve a problem rather than seeking for an integrated solution.

In short,  the customer wants to check the visitor’s IP address and popup a message in case a user from country A is looking at country B’s landing page and ask the visitor if he/she wants to be redirected to country A’s landing page.

A simple case of geotargeting which I did not smash in the face of the customer.

The question remains:

Does anyone have a Domino based solution for this?

A quick search via Google did not resulted in a JS script library containing the country-codes. Thanks in advance for your guidance!

Comments (8)

Follow

Get every new post delivered to your Inbox.