=== Inline Google Docs === Contributors: codex.is.poetry Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=codex%2eis%2epoetry%40gmail%2ecom&item_name=Inline%20Google%20Docs&no_shipping=0&no_note=1&tax=0¤cy_code=SGD&lc=SG&bn=PP%2dDonationsBF&charset=UTF%2d8 Tags: google, documents, gdoc, inline, embed, spreadsheets Requires at least: 2.5 Tested up to: 2.8.3 Stable tag: 0.9
This plugin allows you to embed Google Document/Spreadsheet content in posts and pages using shortcode.
== Description ==
Many people maintain dynamic content on Google Documents or hold volatile data on Google Spreadsheets. These change when collaborators save an update or users submit a form. Occasionally, one may wish to embed the contents of one's Google Documents or Spreadsheets in a post or page to reflect the latest updates on one's blog. This plugin seeks to provide this functionality without using an <iframe>
. In addition, it caches contents of the Google Documents or Spreadsheets to speed up page loading.
Currently, the plugin can only access published documents, but can access both private and public spreadsheets.
After you have installed the plugin, go to the Write Page or Write Post form on your Wordpress blog and type the following where you want your document to appear:
[gdocs id='<doc-id>' type='document']
or
[gdocs st_id='<spreadsheet-id>' wt_id='<worksheet-id>' type='spreadsheet']
or
[gdocs st_id='<spreadsheet-id>' wt_id='<worksheet-id>' cell_id='<cell-id>' type='cell']
Replace <doc-id>
, <spreadsheet-id>
, and <worksheet-id>
with the ID of the document or worksheet that you wish to embed. The ID's are available at the plugin's configuration page. Don't forget to enclose them in quotes.
When embedding a single cell, specify the coordinates of the cell in the worksheet as R
As of v0.5, you may embed a document or spreadsheet by simply clicking on its link in the Google Documents/Spreadsheets panel at the bottom of the page. This may be the preferred method as it relieves you of the technical task of typing the shortcode. Just place your caret where you want your document to appear and click on the title of your chosen document in the panel. This works in both Visual and HTML modes.
If the list of documents and spreadsheets shown in the panel is outdated, just click on the refresh button located at the top left-hand corner of the panel and an updated list will be retrieved immediately.
HTML 5 Drag & Drop
v0.7 introduces a new drag and drop functionality based on HTML 5 specifications. If your browser has native support for HTML 5 drag and drop events (at the time of writing, only Firefox 3.5), you can drag the document/spreadsheet from the panel and drop it in the textarea where you want it to appear.
Javascript needs to be enabled for this to work.
v0.5 also introduced 2 optional attributes for spreadsheets, namely headings
and style
(style
will be described in detail in a later section.) Due to technical reasons, all the column headings retrieved from Google Spreadsheets have their spaces removed and characters converted to the lowercase. Furthermore, if a column heading is left blank on the Google Spreadsheet, the Google API will replace it with a random string of characters.
As a workaround, the user may supply the plugin with a string of comma-separated headings that will be displayed in place of the headings retrieved from Google Spreadsheets. The replacement works from left to right i.e. if you provide only one heading and the spreadsheet has 3 columns, the heading of the leftmost column will be replaced.
Selectors
All embedded worksheets are formatted as valid tables with the following structure:
<table>
<thead>
<tr><th>...</th></tr>
</tbody>
<tbody>
<tr><td>...</td></tr>
</tbody>
</table>
A typical table
element has the following attributes:
<table id="gdocs_<spreadsheet-id>_<worksheet-id>" class="gdocs gdocs_<spreadsheet-id>">
A typical tr
element has the following attributes:
<tr class="row_<x> <odd|even>">
A th
element:
<th class="col_<x> <odd|even>">
Finally, a td
element:
<td class="col_<x> <odd|even>">
Given the above markup, the following selectors are available:
table.gdocs
table.gdocs_<spreadsheet_id>
table#gdocs_<spreadsheet-id>_<worksheet-id>
td.col_<x>
tr.row_<x>
tr.row_<x> td.col_<y>
tr.odd
td.even
Stylesheets
You may also define a new style class and specify it using the style
attribute in the shortcode. Refer to the stylesheets in inline-google-docs/styles/
for examples.
For example, suppose you would like to define a new class named my-class for your tables. First, create a new CSS file in inline-google-docs/styles/
and name it my-class.css. Then, specify the class in your shortcode, as follows:
[gdocs st_id='...' wt_id='...' type='spreadsheet' style='my-class']
If you need to use images, create a new folder in inline-google-docs/styles
and move my-class.css as well as all your images into this folder. Name this folder after your class.
Inline Google Docs now includes tablesorter!
To use tablesorter without passing any parameters, set sort
to true
in your shortcode, as follows:
[gdocs ... sort="true"]
To pass simple parameters to tablesorter, simply include them within braces in the sort
attribute, as follows:
[gdocs ... sort="{cancelSelection:false,...}"]
Certain characters, such as square brackets, will confuse the shortcode parser. If you have complex parameters, pass them through a Javascript variable, as follows:
<script type='text/javascript'>
var properties = {cancelSelection:false, sortList:[[1,1]]};
</script>
[gdocs type='spreadsheet' st_id='twRDk9_BEs9E6Jevb82ETvw' wt_id='od7' style='tablesorter' sort="properties" headings='A, B, C, D, E, F, G, H']
v0.8 also includes the default blue theme; set style
to tablesorter
to use it to style your tables.
This plugin has been tested on IE 7, IE 8, Chrome, Firefox 2, Firefox 3, Firefox 3.5, Opera 9, and Safari 3. If you are using another browser, please update this wiki if it works and post a new issue if it doesn't.
== Installation ==
inline-google-docs
folder into the /wp-content/plugins/
directoryinline-google-docs/cache/
and inline-google-docs/cache/error.log.php
writable.= File Permissions =
Unfortunately, you need to correct the file permissions on your own as SVN automatically resets all file permissions on uploaded files. I recommend the following settings (assuming FTP user as codex and Web user as www-data):
-rw-r----- codex www-data some-file.php
drwxr-x--- codex www-data some-directory
As for the cache and error log:
drwxrwx--- codex www-data cache
-rw-rw---- codex www-data error.log.php
The UNIX commands are provided below:
cd /path/to/Wordpress/wp-content/plugins/inline-google-docs;
find . -type d -exec chmod 750 {} \;
find . -type f -exec chmod 640 {} \;
chmod -R g+w ./cache;
== Frequently Asked Questions ==
= Which PHP version does the plugin require? =
PHP 5.
= Does it use iframes? =
No, it doesn't.
= How do I create zebra patterns for my tables? =
As of v0.7, all rows and columns have an additional class that marks it as even or odd. Use these to create alternating patterns.
== Changelog ==
tr
and td
to allow alternating (zebra) styling<div>
instead of a <p>
gdocs
classgdocs_
col_0
row_0
tr#row_3 td.col_7
as the CSS selector== Screenshots ==