Re-uploading www directory: 06 Oct 2010 21:15 GTM+1
[dtn] / www / DTN_Technical_Details / Scripts / Widgets / FooterControls / FooterControls.js
1 //
2 //  iWeb - FooterControls.js
3 //  Copyright (c) 2007-2008 Apple Inc. All rights reserved.
4 //
5
6 var FooterControls=Class.create(Widget,{widgetIdentifier:"com-apple-iweb-widget-footercontrols",initialize:function($super,instanceID,widgetPath,sharedPath,sitePath,preferences,runningInApp)
7 {if(instanceID!=null)
8 {$super(instanceID,widgetPath,sharedPath,sitePath,preferences,runningInApp);NotificationCenter.addObserver(this,FooterControls.prototype.p_handlePaginationContentsNotification,"paginationSpanContents",this.p_mediaGridID());this.updateFromPreferences();}},onload:function()
9 {if(this.preferences&&this.preferences.postNotification)
10 {this.preferences.postNotification("BLWidgetIsSafeToDrawNotification",1);}},onunload:function()
11 {},updateFromPreferences:function()
12 {this.setPage(0);},changedPreferenceForKey:function(key)
13 {if(this.runningInApp)
14 {if(key=="x-paginationSpanContents")
15 {this.p_setPaginationControls(this.p_paginationSpanContents());}}},prevPage:function()
16 {if(this.runningInApp)
17 {this.setPreferenceForKey(null,"x-previousPage");}
18 else
19 {NotificationCenter.postNotification(new IWNotification("PreviousPage",this.p_mediaGridID(),null));}},nextPage:function()
20 {if(this.runningInApp)
21 {this.setPreferenceForKey(null,"x-nextPage");}
22 else
23 {NotificationCenter.postNotification(new IWNotification("NextPage",this.p_mediaGridID(),null));}},setPage:function(pageIndex)
24 {if(this.runningInApp)
25 {this.setPreferenceForKey(pageIndex,"x-setPage");}
26 else
27 {NotificationCenter.postNotification(new IWNotification("SetPage",this.p_mediaGridID(),{pageIndex:pageIndex}));}},p_mediaGridID:function()
28 {var mediaGridID=null;if(this.preferences)
29 {mediaGridID=this.preferenceForKey("gridID");}
30 if(mediaGridID===undefined)
31 {mediaGridID=null;}
32 return mediaGridID;},p_paginationSpanContents:function()
33 {var paginationSpanContents=null;if(this.preferences)
34 {paginationSpanContents=this.preferenceForKey("x-paginationSpanContents");}
35 if(paginationSpanContents===undefined)
36 {paginationSpanContents=null;}
37 return paginationSpanContents;},p_handlePaginationContentsNotification:function(notification)
38 {var userInfo=notification.userInfo();var controls=userInfo.controls||"";this.p_setPaginationControls(controls);},p_setPaginationControls:function(controls)
39 {var template=new Template(controls);var myControls=template.evaluate({WIDGET_ID:this.instanceID});this.getElementById("pagination_controls").update(myControls);}});