OSDN Git Service

Sync ORIGINAL 3.3 Rev.1120
authorshizuki <shizuki@1ca29b6e-896d-4ea0-84a5-967f57386b96>
Tue, 13 Mar 2007 05:15:41 +0000 (05:15 +0000)
committershizuki <shizuki@1ca29b6e-896d-4ea0-84a5-967f57386b96>
Tue, 13 Mar 2007 05:15:41 +0000 (05:15 +0000)
Parse functions for image, popup and media moved to class BODYACTIONS

git-svn-id: https://svn.sourceforge.jp/svnroot/nucleus-jp/nucleus-jp/trunk@222 1ca29b6e-896d-4ea0-84a5-967f57386b96

utf8/nucleus/libs/BODYACTIONS.php

index 34031c7..d667fb2 100644 (file)
  *
  * @license http://nucleuscms.org/license.txt GNU General Public License
  * @copyright Copyright (C) 2002-2007 The Nucleus Group
- * @version $Id: BODYACTIONS.php,v 1.3 2007-02-04 06:28:46 kimitake Exp $
- * @version $NucleusJP: BODYACTIONS.php,v 1.2 2006/07/20 08:01:52 kimitake Exp $
+ * @version $Id: BODYACTIONS.php,v 1.4 2007-03-13 05:15:41 shizuki Exp $
+ * @version $NucleusJP: BODYACTIONS.php,v 1.3 2007/02/04 06:28:46 kimitake Exp $
  */
 
-class BODYACTIONS extends ITEMACTIONS {
+class BODYACTIONS extends BaseActions {
+
+       var $currentItem;
+
+       var $template;
+
+       function BODYACTIONS () {
+               $this->BaseActions();   
+       }
+       
+       function setCurrentItem(&$item) {
+               $this->currentItem =& $item;
+       }
+       
+       function setTemplate($template) {
+               $this->template =& $template;
+       }
 
        function getDefinedActions() {
                return array('image','media','popup','plugin');
@@ -47,5 +63,90 @@ class BODYACTIONS extends ITEMACTIONS {
 
                call_user_func_array(array(&$plugin,'doItemVar'), $params);
        }
+       
+       function parse_image() {
+               // image/popup calls have arguments separated by |
+               $args = func_get_args();
+               $args = explode('|',implode($args,', '));
+               call_user_func_array(array(&$this,'createImageCode'),$args);
+       }
+       
+       function createImageCode($filename, $width, $height, $text = '') {
+               global $CONF;
+
+               // select private collection when no collection given
+               if (!strstr($filename,'/')) {
+                       $filename = $this->currentItem->authorid . '/' . $filename;
+               }
+
+               $windowwidth = $width;
+               $windowheight = $height;
+
+               $vars['link']                   = htmlspecialchars($CONF['MediaURL']. $filename);
+               $vars['text']                   = htmlspecialchars($text);
+               $vars['image'] = '<img src="' . $vars['link'] . '" width="' . $width . '" height="' . $height . '" alt="' . $vars['text'] . '" title="' . $vars['text'] . '" />';
+               $vars['width']                  = $width;
+               $vars['height']                 = $height;
+               $vars['media']                  = '<a href="' . $vars['link'] . '">' . $vars['text'] . '</a>';
+
+
+               echo TEMPLATE::fill($this->template['IMAGE_CODE'],$vars);;
+
+       }
+       
+       function parse_media() {
+               // image/popup calls have arguments separated by |
+               $args = func_get_args();
+               $args = explode('|',implode($args,', '));
+               call_user_func_array(array(&$this,'createMediaCode'),$args);
+       }
+
+       function createMediaCode($filename, $text = '') {
+               global $CONF;
+
+               // select private collection when no collection given
+               if (!strstr($filename,'/')) {
+                       $filename = $this->currentItem->authorid . '/' . $filename;
+       }
+
+               $vars['link']                   = htmlspecialchars($CONF['MediaURL'] . $filename);
+               $vars['text']                   = htmlspecialchars($text);
+               $vars['media']                  = '<a href="' . $vars['link'] . '">' . $vars['text'] . '</a>';
+
+               echo TEMPLATE::fill($this->template['MEDIA_CODE'],$vars);;
+       }
+
+
+       function parse_popup() {
+               // image/popup calls have arguments separated by |
+               $args = func_get_args();
+               $args = explode('|',implode($args,', '));
+               call_user_func_array(array(&$this,'createPopupCode'),$args);
+       }
+
+       function createPopupCode($filename, $width, $height, $text = '') {
+               global $CONF;
+
+               // select private collection when no collection given
+               if (!strstr($filename,'/')) {
+                       $filename = $this->currentItem->authorid . '/' . $filename;
+               }
+
+               $windowwidth = $width;
+               $windowheight = $height;
+
+               $vars['rawpopuplink']   = $CONF['Self'] . "?imagepopup=" . htmlspecialchars($filename) . "&amp;width=$width&amp;height=$height&amp;imagetext=" . urlencode(htmlspecialchars($text));
+               $vars['popupcode']              = "window.open(this.href,'imagepopup','status=no,toolbar=no,scrollbars=no,resizable=yes,width=$windowwidth,height=$windowheight');return false;";
+               $vars['popuptext']              = htmlspecialchars($text);
+               $vars['popuplink']              = '<a href="' . $vars['rawpopuplink']. '" onclick="'. $vars['popupcode'].'" >' . $vars['popuptext'] . '</a>';
+               $vars['width']                  = $width;
+               $vars['height']                 = $height;
+               $vars['text']                   = $text;
+               $vars['link']                   = htmlspecialchars($CONF['MediaURL'] . $filename);
+               $vars['media']                  = '<a href="' . $vars['link'] . '">' . $vars['popuptext'] . '</a>';
+
+               echo TEMPLATE::fill($this->template['POPUP_CODE'],$vars);
+       }
+
 }
-?>
+?>
\ No newline at end of file