]> git.mjollnir.org Git - s9y.git/commitdiff
Image selector hook support
authorgarvinhicking <garvinhicking>
Fri, 29 Apr 2005 14:37:34 +0000 (14:37 +0000)
committergarvinhicking <garvinhicking>
Fri, 29 Apr 2005 14:37:34 +0000 (14:37 +0000)
docs/NEWS
serendipity_admin_image_selector.php

index 02e9b1dc4a41d11024d74df5fbc393f0399d88ed..46d72980be42650502988d2a07e8a3616e19bc67 100644 (file)
--- a/docs/NEWS
+++ b/docs/NEWS
@@ -3,6 +3,10 @@
 Version 0.9 ()
 ------------------------------------------------------------------------
 
+    * Added hooks into the image selector admin popup for plugins to
+      support additional options. serendipity_event_imageselectorplus
+      accesses those hooks already. (garvinhicking)
+
     * Categories plugin now offers to sort by category name, description
       or creation date. (garvinhicking)
 
index 318c00389ab9d68e3286de6ff27d02eaa4a6c578..e045280de00f0564f894ff907d820eaf0ee54725 100644 (file)
@@ -117,12 +117,15 @@ switch ($serendipity['GET']['step']) {
                 $thumbHeight = $thumbsize[1];
                 $imgsrc      = $file['imgsrc'];
             }
+            $file['finishJSFunction'] = 'serendipity_imageSelector_done(\'' . $serendipity['GET']['textarea'] . '\')';
+            serendipity_plugin_api::hook_event('frontend_image_selector', $file);
 ?>
     <img align="right" src="<?php echo $imgsrc; ?>">
     <h1><?php printf(YOU_CHOSE, $file['name']); ?></h1>
     <p>
         <form action="#" method="GET" name="serendipity[selForm]" onSubmit="serendipity_imageSelector_done()">
             <div>
+                <?php serendipity_plugin_api::hook_event('frontend_image_selector_hiddenfields', $file); ?>
                 <input type="hidden" name="imgThumbWidth"  value="<?php echo $thumbWidth; ?>" />
                 <input type="hidden" name="imgThumbHeight" value="<?php echo $thumbHeight; ?>" />
                 <input type="hidden" name="imgWidth"  value="<?php echo $dimWidth; ?>" />
@@ -141,6 +144,7 @@ switch ($serendipity['GET']['step']) {
                 <br />
                 <input id="radio_link_no" type="radio" name="serendipity[linkThumbnail]" value="no" checked="checked" /><label for="radio_link_no"><?php echo I_WANT_THUMB; ?></label><br />
                 <input id="radio_link_yes" type="radio" name="serendipity[linkThumbnail]" value="yes" /><label for="radio_link_yes"><?php echo I_WANT_BIG_IMAGE; ?></label><br />
+                <?php serendipity_plugin_api::hook_event('frontend_image_selector_imagesize', $file); ?>
                 <br />
 
                 <?php if (empty($serendipity['GET']['filename_only']) || $serendipity['GET']['filename_only'] != 'true') { ?>
@@ -149,6 +153,7 @@ switch ($serendipity['GET']['step']) {
                 <input type="radio" name="serendipity[align]" value="" />                       <img src="<?php echo serendipity_getTemplateFile('img/img_align_top.png') ?>"   vspace="5" /><br />
                 <input type="radio" name="serendipity[align]" value="left" checked="checked" /> <img src="<?php echo serendipity_getTemplateFile('img/img_align_left.png') ?>"  vspace="5" /><br />
                 <input type="radio" name="serendipity[align]" value="right" />                  <img src="<?php echo serendipity_getTemplateFile('img/img_align_right.png') ?>" vspace="5" /><br />
+                <?php serendipity_plugin_api::hook_event('frontend_image_selector_imagealign', $file); ?>
                 <br />
 
                 <b><?php echo IMAGE_AS_A_LINK; ?>:</b>
@@ -156,20 +161,25 @@ switch ($serendipity['GET']['step']) {
                 <input id="radio_islink_yes" type="radio" name="serendipity[isLink]" checked="checked" /><label for="radio_islink_yes"> <?php echo I_WANT_NO_LINK; ?></label><br />
                 <input id="radio_islink_no"  type="radio" name="serendipity[isLink]" /><label for="radio_islink_no"> <?php echo I_WANT_IT_TO_LINK; ?></label>
                 <?php if ($file['hotlink']) { ?>
-                <input type="text"  name="serendipity[url]" size="30" value="<?php echo $file['path']; ?>" onfocus="value='';" /><br />
+                <input type="text"  name="serendipity[url]" size="30" value="<?php echo $file['path']; ?>" /><br />
                 <?php } else { ?>
-                <input type="text"  name="serendipity[url]" size="30" value="<?php echo $serendipity['serendipityHTTPPath'] . $serendipity['uploadPath'] . $file['path'] . $file['name'] .'.'. $file['extension']; ?>" onfocus="value='';" /><br />
+                <input type="text"  name="serendipity[url]" size="30" value="<?php echo $serendipity['serendipityHTTPPath'] . $serendipity['uploadPath'] . $file['path'] . $file['name'] .'.'. $file['extension']; ?>" /><br />
                 <?php } ?>
+                <?php serendipity_plugin_api::hook_event('frontend_image_selector_imagelink', $file); ?>
                 <br />
 
                 <b><?php echo COMMENT; ?>:</b>
                 <br />
                 <textarea id="serendipity_imagecomment" name="serendipity[imagecomment]" rows="5" cols="40"></textarea>
+                <?php serendipity_plugin_api::hook_event('frontend_image_selector_imagecomment', $file); ?>
                 <br />
                 <?php } ?>
 
+                <?php serendipity_plugin_api::hook_event('frontend_image_selector_more', $file); ?>
+
                 <input type="button" value="<?php echo BACK; ?>" onclick="history.go(-1);" />
-                <input type="button" value="<?php echo DONE; ?>" onclick="serendipity_imageSelector_done('<?php echo $serendipity['GET']['textarea'] ?>')" />
+                <input type="button" value="<?php echo DONE; ?>" onclick="<?php echo $file['finishJSFunction']; ?>" />
+                <?php serendipity_plugin_api::hook_event('frontend_image_selector_submit', $file); ?>
             </div>
         </form>
     </p>
@@ -181,6 +191,7 @@ switch ($serendipity['GET']['step']) {
         if (!empty($serendipity['GET']['filename_only'])) {
 ?>
     <script type="text/javascript">
+        <?php serendipity_plugin_api::hook_event('frontend_image_add_filenameonly', $serendipity); ?>
         self.opener.serendipity_imageSelector_addToElement('<?php echo htmlspecialchars($imgName); ?>', '<?php echo htmlspecialchars($serendipity['GET']['htmltarget']); ?>');
         self.close();
     </script>
@@ -189,6 +200,7 @@ switch ($serendipity['GET']['step']) {
 ?>
     <script type="text/javascript">
     block = '<a href="<?php echo htmlspecialchars($imgName); ?>" title="<?php echo htmlspecialchars($file['name'] . '.' . $file['extension']); ?>" target="_blank"><?php echo htmlspecialchars($file['name'] . '.' . $file['extension']); ?></a>';
+    <?php serendipity_plugin_api::hook_event('frontend_image_add_unknown', $serendipity); ?>
     if (self.opener.editorref) {
         self.opener.editorref.surroundHTML(block, '');
     } else {