GoogleControl |
|
Concept | Presentation | Install | Use | Internals |
GoogleControl user guideForewordGoogleControl implements the three forms of PageBox control described in Control concept:
GoogleControl implements a user interface to the Google API and allows setting:
The pages of a given directory can call GoogleControl with a specific setting to provide a consistent look and feel. This setting depends on the control type. HTTP controlThe components that implements the HTTP control form are GoogleForm.aspx for server pages and GoogleForm2.aspx for browsers. ConfigurationThe configuration is retrieved:
Here is an example of GoogleControl.xml:
You must define all elements. However you only need to set the license element. licenselicense should contain the Google license that you got on Google site when you registered. For more information visit http://www.google.com/apis/. We define a special account – offline – for tests that don’t require actually calling Google. csscss should contain the URL of the CSS file used in the pages that call GoogleForm. It is used to display the second page of GoogleForm with the same CSS as the calling page. title-csstitle-css contains the CSS class used to display the title “Google control”. table-min-widthtable-min-width contains the initial and min size of the control. table-max-widthtable-max-width contains the max size of the control. table-cssThe different components of the control are stored in a HTML table. table-css contains the CSS class used to display this table. datagrid-header-cssThe control uses two DataGrids:
The headers of both DataGrids are displayed using the CSS class defined in datagrid-header-css. datagrid-cssThe items of both DataGrids are displayed using the CSS class defined in datagrid-css. datagrid-alt-cssThe alternate items of both DataGrids are displayed using the CSS class defined in datagrid-alt-css. status-cssstatus-css contains the CSS class used to display error and information messages. copyright-csscopyright-css contains the CSS class used to display the copyright information. Use from a server pageThe server page (that acts as a control client) retrieves the control generated HTML using HTTP GET. Here is a C# snippet. Because the client only gets the generated HTML, it can be written in PHP or Java.
url is the URL of GoogleForm that can be on a different Web server and even domain. The snippet builds a query string made of the GoogleForm URL and of a from parameter that contains the URL of the client page. Then the snippet uses the query string to call the GoogleForm.aspx page. Next the snippet writes the response on its response stream. The snippet is implemented in the include method of ControlClient.aspx.cs. To adapt a static page to use the control, you only need
ExampleHere is an example of use of ControlClient.aspx with the dotnet-custom.html document of this site. dotnet-custom.html was originally authored with Cuckoo. It was renamed dotnet-get.aspx. You can find it in GoogleControl.zip in the GoogleTest directory.
GoogleForm uses the CSS classes defined in GoogleControl.xml and defined in the CSS of dotnet-get.aspx. The size of the control is the min size defined in GoogleControl.xml. When we click on the Search button a new window is opened. Here we also clicked on a Sel button to display an entry details.
GoogleForm uses:
The size of the control is now the max size defined in GoogleControl.xml. Use from a browser IFrameThe page uses an IFrame to host the control display. Here is an example that works with IE5.5 and above and with Gecko engine (Mozilla and Netscape 6):
The IFrame must have a GoogleControl ID to be resized by the control. A server-side piece of code builds the from parameter. Because it is written in C# the page must start with <%@ Page language="c#"%>. Let’s assume that your page is accessed using http://localhost/GoogleTest/dotnet-iframe.aspx. Then the from parameter will be localhost/GoogleTest/dotnet-iframe.aspx. So the from parameter doesn’t contain http://. It is easy to generate the same thing with any server technology. It is also window.location without http://. IFrame exampleHere is an example of use of IFrame use with the dotnet-custom.html document of this site. dotnet-custom.html was originally authored with Cuckoo. It was renamed dotnet-iframe.aspx. You can find it in GoogleControl.zip in the GoogleTest directory.
GoogleForm2 uses the CSS classes defined in GoogleControl.xml and defined in the CSS of dotnet-iframe.aspx. The size of the control is the min size defined in GoogleControl.xml. When we click on the Search button a new window is opened. Here we also clicked on a Sel button to display an entry details.
GoogleForm2 uses:
The size of the control is now the max size defined in GoogleControl.xml. Include controlThe component that implements the Include control form is GoogleInclude.aspx. ConfigurationThe configuration is retrieved from GoogleControl.xml file in the GoogleForm.aspx directory, which is typically also the directory of the client page. GoogleControl.xml has the same definition as for HTTP control. UseTo adapt a static page to use the control, you only need
ExampleHere is an example of use of GoogleInclude.aspx with the dotnet-custom.html document. It was renamed dotnet-include.aspx. You can find it in GoogleControl.zip in the GoogleControl directory.
GoogleInclude uses the CSS classes defined in GoogleControl.xml and defined in the CSS of dotnet-include.aspx. The size of the control is the min size defined in GoogleControl.xml. When we click on the Search button the control is enlarged to the max size defined in GoogleControl.xml. Here we also clicked on a Sel button to display an entry details.
ASP.NET controlThe component that implements the ASP.NET control form is GoogleControl.ascx. UseTo adapt a static page to use the control, you need
At the beginning we register GoogleControl.ascx as a control with a tag prefix google and a tag name control. Then we can call our control with an element google:control. The attributes match GoogleControl properties:
ExampleHere is an example of use of GoogleControl.ascx with the dotnet-custom.html document. It was renamed dotnet-control.aspx. You can find it in GoogleControl.zip in the GoogleControl2 directory.
GoogleControl uses the CSS classes in its invocation attributes and defined in the CSS of dotnet-control.aspx. The size of the control is the min size defined in its invocation attributes. When we click on the Search button the control is enlarged to the max size defined in its invocation attributes.
Contact:support@pagebox.net |
|