INTEGRATING PHOTOSHARE WITH OTHER MODULES
=========================================
In order to use Photoshare's image selector from other modules you must do the
following:
1) Make sure the "photoshare/pnjavascript/findimage.js" JavaScript file is
included in the web page from which the image selector is opened. This
script supplies a function named "photoshareFindImage" which opens the image
selector window when called.
Example:
<script type="text/javascript"
src="modules/photoshare/pnjavascript/findimage.js"></script>
2) Specify an HTML "ID" attribute on the input element that Photoshare should
paste the image tag or URL into. This actual ID is up to you. The input
element may either be a text input or a textarea element (even works with
htmlArea! - see www.interactivetools.com).
Examples:
<textarea id="articleTextarea"></textarea>
<input type="text" id="imageURL"/>
3) Add a button (or other clickable element) with an "onClick" handler that
calls photoshareFindImage(inputID, selectorURL). The "inputID" parameter
holds the ID of the input from step (2). The selector URL holds the URL to
Photoshare's image selector window. You can get this URL from PHP/PostNuke
by calling:
pnModUrl('photoshare','user','findimage',
array('url' =>
'relative',
'html' =>
'img'));
The "url" and "html" arguments specifies how the image selector should paste
the result back into the external input. if "url" is "relative" then only
the relative part of the image URL is pasted - otherwise the full absolute
path is used. if "html" is "img" then a complete IMG tag with SRC set to the
URL is pasted, otherwise only the URL is pasted.
You also need to get Photoshare's thumbnail size using:
$photoshareThumbnailSize = pnModGetVar('photoshare', 'thumbnailsize');
Examples:
<input type="button" value="Insert Image"
onClick="photoshareFindImage('articleTextarea',
'http://...&url=relative&html=img',
$photoshareThumbnailSize)">
4) Make sure to include the following on the pages that contains images:
<script type="text/javascript" src="modules/photoshare/pnjavascript/showimage.js"></script>
This ensure Photoshare's popup windows works.
EXAMPLE OF HACKED POSTNUKE SUBMIT-NEWS
--------------------------------------
The following pieces can be substituted into /Submit_News/index.php in order
to use Photoshare's image selector in PostNuke's "submit news". This is not
an exact description, so you will have to fiddle around a bit yourself or see
if it has been made available for download on www.elfisk.dk:
Line 103-116:
echo "<script type=\"text/javascript\" src=\"modules/photoshare/pnjavascript/findimage.js\"></script>\n";
$photoshareFindImageURL = pnModUrl('photoshare','user','findimage',
array('url' =>
'relative',
'html' =>
'img'));
$photoshareThumbnailSize = pnModGetVar('photoshare', 'thumbnailsize');
echo "<br><br><b>"._ARTICLETEXT.
"</b> " ."("._HTMLISFINE.")<br>"
."<textarea cols=\"50\" rows=\"12\" name=\"storytext\" id=\"articleTextarea\"></textarea> "._REQUIRED."<br>"
."<input type=\"button\" value=\"Insert Image\" "
. "onClick=\"photoshareFindImage('articleTextarea','$photoshareFindImageURL')\">"
."<br><br><b>"._EXTENDEDTEXT."</b>"
."<br><textarea cols=\"50\" rows=\"12\" name=\"bodytext\" id=\"bodyTextarea\"></textarea><br>"
."<input type=\"button\" value=\"Insert Image\" "
."onClick=\"photoshareFindImage('bodyTextarea','$photoshareFindImageURL','$photoshareThumbnailSize')\">"
."<br><br>\n";
Line 246-259:
echo "<script type=\"text/javascript\" src=\"modules/photoshare/pnjavascript/findimage.js\"></script>\n";
$photoshareFindImageURL = pnModUrl('photoshare','user','findimage',
array('url' =>
'relative',
'html' =>
'img'));
$photoshareThumbnailSize = pnModGetVar('photoshare', 'thumbnailsize');
echo "<br><br><b>"._ARTICLETEXT.
"</b> " ."("._HTMLISFINE.")<br>"
."<textarea cols=\"50\" rows=\"12\" name=\"storytext\" id=\"articleTextarea\">" . pnVarPrepHTMLDisplay($storytext) . "</textarea> "._REQUIRED."<br>"
."<input type=\"button\" value=\"Insert Image\" "
. "onClick=\"photoshareFindImage('articleTextarea','$photoshareFindImageURL')\">"
."<br><br><b>"._EXTENDEDTEXT."</b>"
."<br><textarea cols=\"50\" rows=\"12\" name=\"bodytext\" id=\"bodyTextarea\">" . pnVarPrepHTMLDisplay($bodytext) . "</textarea><br>"
."<input type=\"button\" value=\"Insert Image\" "
."onClick=\"photoshareFindImage('bodyTextarea','$photoshareFindImageURL','$photoshareThumbnailSize')\">"
."<br><br>\n";