OSDN Git Service

ver 1.0.8.1
authorkmorimatsu <kmorimatsu@1ca29b6e-896d-4ea0-84a5-967f57386b96>
Wed, 17 Dec 2008 22:25:04 +0000 (22:25 +0000)
committerkmorimatsu <kmorimatsu@1ca29b6e-896d-4ea0-84a5-967f57386b96>
Wed, 17 Dec 2008 22:25:04 +0000 (22:25 +0000)
git-svn-id: https://svn.sourceforge.jp/svnroot/nucleus-jp/plugin@729 1ca29b6e-896d-4ea0-84a5-967f57386b96

19 files changed:
NP_Mediatocu/NP_Mediatocu.php [new file with mode: 0644]
NP_Mediatocu/mediatocu/bg.gif [new file with mode: 0644]
NP_Mediatocu/mediatocu/greybox/AJS.js [new file with mode: 0644]
NP_Mediatocu/mediatocu/greybox/AJS_fx.js [new file with mode: 0644]
NP_Mediatocu/mediatocu/greybox/g_close.gif [new file with mode: 0644]
NP_Mediatocu/mediatocu/greybox/gb_scripts.js [new file with mode: 0644]
NP_Mediatocu/mediatocu/greybox/gb_styles.css [new file with mode: 0644]
NP_Mediatocu/mediatocu/greybox/header_bg.gif [new file with mode: 0644]
NP_Mediatocu/mediatocu/greybox/indicator.gif [new file with mode: 0644]
NP_Mediatocu/mediatocu/greybox/loader_frame.html [new file with mode: 0644]
NP_Mediatocu/mediatocu/greybox/next.gif [new file with mode: 0644]
NP_Mediatocu/mediatocu/greybox/prev.gif [new file with mode: 0644]
NP_Mediatocu/mediatocu/greybox/w_close.gif [new file with mode: 0644]
NP_Mediatocu/mediatocu/index.html [new file with mode: 0644]
NP_Mediatocu/mediatocu/lang/english.php [new file with mode: 0644]
NP_Mediatocu/mediatocu/lang/japanese-euc.php [new file with mode: 0644]
NP_Mediatocu/mediatocu/lang/japanese-utf8.php [new file with mode: 0644]
NP_Mediatocu/mediatocu/media.php [new file with mode: 0644]
NP_Mediatocu/mediatocu/popups.css [new file with mode: 0644]

diff --git a/NP_Mediatocu/NP_Mediatocu.php b/NP_Mediatocu/NP_Mediatocu.php
new file mode 100644 (file)
index 0000000..ad3e3b7
--- /dev/null
@@ -0,0 +1,248 @@
+<?php\r
+class NP_Mediatocu extends NucleusPlugin\r
+{\r
+\r
+       function NP_Mediatocu()\r
+       {\r
+//             $this->baseUrl = $this->getAdminURL();\r
+               global $CONF;\r
+               $this->baseUrl = str_replace ($CONF['AdminURL'], '', $this->getAdminURL()); \r
+       }\r
+\r
+       function getName()\r
+       {\r
+               return 'mediatocu';\r
+       }\r
+\r
+       function getAuthor()\r
+       {\r
+               return 'yamamoto,shizuki,Cacher';\r
+       }\r
+\r
+       function getURL()\r
+       {\r
+//             return '';\r
+               return 'http://japan.nucleuscms.org/wiki/plugins:np_mediatocu';//2008-11-10 cacher\r
+       }\r
+\r
+       function getVersion()\r
+       {\r
+               return '1.0.8.1';\r
+       }\r
+\r
+       function getDescription()\r
+       {\r
+               return _MEDIA_PHP_37;\r
+       }\r
+\r
+       function supportsFeature($w)\r
+       {\r
+               return ($w == 'SqlTablePrefix') ? 1 : 0;\r
+       }\r
+\r
+\r
+\r
+/**2005.3--2005.09.26 00:50 keiei edit\r
+       * media-tocu3.01.zip  for register_globals=off\r
+       *\r
+       */\r
+/**\r
+       *       media-tocu3.02.zip\r
+       * T.Kosugi edit 2006.8.22 for security reason\r
+       */\r
+/**\r
+       *       media-tocu-dirs1.0.zip\r
+       *               extends media-tocu3.02.zip\r
+       * 1.0.7 m17n and making to plugin. by yamamoto\r
+       * 1.0.6 to put it even by the thumbnail image click, small bug.  by yamamoto\r
+       * 1.0.5 to put it even by the thumbnail image click, it remodels it.  by yamamoto\r
+       * 1.0.4 bug fix mkdir if memberdir is missing incase mkdir\r
+       * 1.0.3 bug fix missing memberdir in uploading file.\r
+       * 1.0.2 add checking filname with null\r
+       * 1.0.1 add first dir check\r
+       *\r
+       */\r
+// add language definition by yamamoto\r
+\r
+\r
+\r
+       function install()\r
+       {\r
+               $this->createOption(\r
+                       'thumb_width',\r
+                       _MEDIA_PHP_17,\r
+                       'text',\r
+                       '60',\r
+                       'datatype=numerical'\r
+               );\r
+               $this->createOption(\r
+                       'thumb_height',\r
+                       _MEDIA_PHP_18,\r
+                       'text',\r
+                       '45',\r
+                       'datatype=numerical'\r
+               );\r
+               $this->createOption(\r
+                       'thumb_quality',\r
+                       _MEDIA_PHP_19,\r
+                       'text',\r
+                       '70',\r
+                       'datatype=numerical'\r
+               );\r
+               $this->createOption(\r
+                       'media_per_page',\r
+                       _MEDIA_PHP_22,\r
+                       'text',\r
+                       '9',\r
+                       'datatype=numerical'\r
+               );\r
+               $this->createOption(\r
+                       'popup_width',\r
+                       _MEDIA_PHP_23,\r
+                       'text',\r
+                       '600',\r
+                       'datatype=numerical'\r
+               );//restore 2008-05-14 Cacher\r
+               $this->createOption(\r
+                       'popup_height',\r
+                       _MEDIA_PHP_24,\r
+                       'text',\r
+                       '600',\r
+                       'datatype=numerical'\r
+               );//restore 2008-05-14 Cacher\r
+               $this->createOption(\r
+                       'paste_mode_checked',\r
+                       _MEDIA_PHP_27,\r
+                       'yesno',\r
+                       'no'\r
+               );\r
+               $this->createOption(\r
+                       'hidden_dir',\r
+                       _MEDIA_PHP_43,\r
+                       'text',\r
+                       'thumb,thumbnail,phpthumb'\r
+               );\r
+               $this->createOption(\r
+                       'filename_rule',\r
+                       _MEDIA_PHP_33,\r
+                       'select',\r
+                       'default',\r
+                       _MEDIA_PHP_34 . '|default|' . _MEDIA_PHP_35 . '|ascii'\r
+               );\r
+               $this->createOption(\r
+                       'use_gray_box',\r
+                       _MEDIA_PHP_36,\r
+                       'yesno',\r
+                       'yes'\r
+               );\r
+       }\r
+\r
+       /**\r
+         * Add extra header\r
+         */\r
+       function _addExtraHead(&$data)\r
+       {\r
+               global $member;\r
+               $this->memberid = $member->id;\r
+               $this->memberadmin = $member->admin;\r
+               $this->_getExtraHead($data);\r
+       }\r
+\r
+//     function unInstall() {}\r
+//2008-11-10 cacher\r
+\r
+       function init()\r
+       {\r
+               // include language file for this plugin\r
+               $language = ereg_replace( '[\\|/]', '', getLanguageName());\r
+               if (file_exists($this->getDirectory() . 'lang/' . $language . '.php')) {\r
+                       include_once($this->getDirectory() . 'lang/' . $language . '.php');\r
+               } else {\r
+                       include_once($this->getDirectory() . 'lang/english.php');\r
+               }\r
+       }\r
+\r
+       function getEventList()\r
+       {\r
+               return array(\r
+                       'AdminPrePageHead',\r
+                       'BookmarkletExtraHead',\r
+                       'PreSendContentType'\r
+               );\r
+       }\r
+\r
+       function event_BookmarkletExtraHead(&$data)\r
+       {\r
+               $this->_addExtraHead($data['extrahead']);\r
+       }\r
+\r
+       function event_AdminPrePageHead(&$data)\r
+       {\r
+               global $member;\r
+               $action = $data['action'];\r
+               if (($action != 'createitem') && ($action != 'itemedit')) {\r
+                       return;\r
+               }\r
+               $this->_addExtraHead($data['extrahead']);\r
+       }\r
+\r
+       function event_PreSendContentType(&$data)\r
+       {\r
+               $pageType = $data['pageType'];\r
+               if (    ($pageType == 'bookmarklet-add')\r
+                       ||      ($pageType == 'bookmarklet-edit')\r
+                       ||      ($pageType == 'admin-createitem')\r
+                       ||      ($pageType == 'admin-itemedit')\r
+                  ) {\r
+                       if ($data['contentType'] == 'application/xhtml+xml') {\r
+                               $data['contentType'] = 'text/html';\r
+                       }\r
+               }\r
+       }\r
+\r
+       function _getExtraHead(&$extrahead)\r
+       {\r
+               global $CONF, $manager, $itemid, $blogid ;\r
+               if ($manager->pluginInstalled('NP_TinyMCE')) return;\r
+               $mediatocu    = $manager->getPlugin('NP_Mediatocu');\r
+               $popup_width  = $mediatocu->getOption('popup_width');//restore 2008-05-14 Cacher\r
+               $popup_height = $mediatocu->getOption('popup_height');//restore 2008-05-14 Cacher\r
+               $mediaPhpURL  = $CONF['AdminURL'] . $this->baseUrl . 'media.php';\r
+//             $GreyBox      = $mediatocu->getOption('use_gray_box');\r
+               if ($mediatocu->getOption('use_gray_box') == 'yes') {\r
+               $extrahead .= <<<_EXTRAHEAD_\r
+\r
+       <script type="text/javascript" src="plugins/mediatocu/greybox/AJS.js"></script>\r
+       <script type="text/javascript" src="plugins/mediatocu/greybox/AJS_fx.js"></script>\r
+       <script type="text/javascript">\r
+               var GB_ROOT_DIR = "./plugins/mediatocu/greybox/";\r
+       </script>\r
+       <script type="text/javascript" src="plugins/mediatocu/greybox/gb_scripts.js"></script>\r
+       <link href="plugins/mediatocu/greybox/gb_styles.css" rel="stylesheet" type="text/css" media="all" />\r
+       <style TYPE="text/css">\r
+               #GB_window td {\r
+                       border : none;\r
+                       background : url(plugins/mediatocu/greybox/header_bg.gif);\r
+               }\r
+       </style>\r
+       <script type="text/javascript">\r
+               function addMedia() {\r
+                       GB_showFullScreen('Mediatocu', '{$mediaPhpURL}');\r
+               }\r
+       </script>\r
+\r
+_EXTRAHEAD_;\r
+               } else {\r
+               $extrahead .= <<<_EXTRAHEAD_\r
+\r
+       <script type="text/javascript">\r
+               function addMedia() {\r
+                       window.open('{$mediaPhpURL}', "name" , "width=$popup_width , height=$popup_height , scrollbars=yes , resizable=yes" );\r
+               }\r
+       </script>\r
+\r
+_EXTRAHEAD_;\r
+               }\r
+       }\r
+}\r
+?>\r
diff --git a/NP_Mediatocu/mediatocu/bg.gif b/NP_Mediatocu/mediatocu/bg.gif
new file mode 100644 (file)
index 0000000..2f1e0dd
Binary files /dev/null and b/NP_Mediatocu/mediatocu/bg.gif differ
diff --git a/NP_Mediatocu/mediatocu/greybox/AJS.js b/NP_Mediatocu/mediatocu/greybox/AJS.js
new file mode 100644 (file)
index 0000000..d2463e8
--- /dev/null
@@ -0,0 +1,514 @@
+AJS={BASE_URL:"",drag_obj:null,drag_elm:null,_drop_zones:[],_cur_pos:null,getScrollTop:function(){\r
+var t;\r
+if(document.documentElement&&document.documentElement.scrollTop){\r
+t=document.documentElement.scrollTop;\r
+}else{\r
+if(document.body){\r
+t=document.body.scrollTop;\r
+}\r
+}\r
+return t;\r
+},addClass:function(){\r
+var _2=AJS.forceArray(arguments);\r
+var _3=_2.pop();\r
+var _4=function(o){\r
+if(!new RegExp("(^|\\s)"+_3+"(\\s|$)").test(o.className)){\r
+o.className+=(o.className?" ":"")+_3;\r
+}\r
+};\r
+AJS.map(_2,function(_6){\r
+_4(_6);\r
+});\r
+},setStyle:function(){\r
+var _7=AJS.forceArray(arguments);\r
+var _8=_7.pop();\r
+var _9=_7.pop();\r
+AJS.map(_7,function(_a){\r
+_a.style[_9]=AJS.getCssDim(_8);\r
+});\r
+},extend:function(_b){\r
+var _c=new this("no_init");\r
+for(k in _b){\r
+var _d=_c[k];\r
+var _e=_b[k];\r
+if(_d&&_d!=_e&&typeof _e=="function"){\r
+_e=this._parentize(_e,_d);\r
+}\r
+_c[k]=_e;\r
+}\r
+return new AJS.Class(_c);\r
+},log:function(o){\r
+if(window.console){\r
+console.log(o);\r
+}else{\r
+var div=AJS.$("ajs_logger");\r
+if(!div){\r
+div=AJS.DIV({id:"ajs_logger","style":"color: green; position: absolute; left: 0"});\r
+div.style.top=AJS.getScrollTop()+"px";\r
+AJS.ACN(AJS.getBody(),div);\r
+}\r
+AJS.setHTML(div,""+o);\r
+}\r
+},setHeight:function(){\r
+var _11=AJS.forceArray(arguments);\r
+_11.splice(_11.length-1,0,"height");\r
+AJS.setStyle.apply(null,_11);\r
+},_getRealScope:function(fn,_13){\r
+_13=AJS.$A(_13);\r
+var _14=fn._cscope||window;\r
+return function(){\r
+var _15=AJS.$FA(arguments).concat(_13);\r
+return fn.apply(_14,_15);\r
+};\r
+},documentInsert:function(elm){\r
+if(typeof (elm)=="string"){\r
+elm=AJS.HTML2DOM(elm);\r
+}\r
+document.write("<span id=\"dummy_holder\"></span>");\r
+AJS.swapDOM(AJS.$("dummy_holder"),elm);\r
+},getWindowSize:function(doc){\r
+doc=doc||document;\r
+var _18,_19;\r
+if(self.innerHeight){\r
+_18=self.innerWidth;\r
+_19=self.innerHeight;\r
+}else{\r
+if(doc.documentElement&&doc.documentElement.clientHeight){\r
+_18=doc.documentElement.clientWidth;\r
+_19=doc.documentElement.clientHeight;\r
+}else{\r
+if(doc.body){\r
+_18=doc.body.clientWidth;\r
+_19=doc.body.clientHeight;\r
+}\r
+}\r
+}\r
+return {"w":_18,"h":_19};\r
+},flattenList:function(_1a){\r
+var r=[];\r
+var _1c=function(r,l){\r
+AJS.map(l,function(o){\r
+if(o==null){\r
+}else{\r
+if(AJS.isArray(o)){\r
+_1c(r,o);\r
+}else{\r
+r.push(o);\r
+}\r
+}\r
+});\r
+};\r
+_1c(r,_1a);\r
+return r;\r
+},isFunction:function(obj){\r
+return (typeof obj=="function");\r
+},setEventKey:function(e){\r
+e.key=e.keyCode?e.keyCode:e.charCode;\r
+if(window.event){\r
+e.ctrl=window.event.ctrlKey;\r
+e.shift=window.event.shiftKey;\r
+}else{\r
+e.ctrl=e.ctrlKey;\r
+e.shift=e.shiftKey;\r
+}\r
+switch(e.key){\r
+case 63232:\r
+e.key=38;\r
+break;\r
+case 63233:\r
+e.key=40;\r
+break;\r
+case 63235:\r
+e.key=39;\r
+break;\r
+case 63234:\r
+e.key=37;\r
+break;\r
+}\r
+},removeElement:function(){\r
+var _22=AJS.forceArray(arguments);\r
+AJS.map(_22,function(elm){\r
+AJS.swapDOM(elm,null);\r
+});\r
+},_unloadListeners:function(){\r
+if(AJS.listeners){\r
+AJS.map(AJS.listeners,function(elm,_25,fn){\r
+AJS.REV(elm,_25,fn);\r
+});\r
+}\r
+AJS.listeners=[];\r
+},join:function(_27,_28){\r
+try{\r
+return _28.join(_27);\r
+}\r
+catch(e){\r
+var r=_28[0]||"";\r
+AJS.map(_28,function(elm){\r
+r+=_27+elm;\r
+},1);\r
+return r+"";\r
+}\r
+},getIndex:function(elm,_2c,_2d){\r
+for(var i=0;i<_2c.length;i++){\r
+if(_2d&&_2d(_2c[i])||elm==_2c[i]){\r
+return i;\r
+}\r
+}\r
+return -1;\r
+},isIn:function(elm,_30){\r
+var i=AJS.getIndex(elm,_30);\r
+if(i!=-1){\r
+return true;\r
+}else{\r
+return false;\r
+}\r
+},isArray:function(obj){\r
+return obj instanceof Array;\r
+},setLeft:function(){\r
+var _33=AJS.forceArray(arguments);\r
+_33.splice(_33.length-1,0,"left");\r
+AJS.setStyle.apply(null,_33);\r
+},appendChildNodes:function(elm){\r
+if(arguments.length>=2){\r
+AJS.map(arguments,function(n){\r
+if(AJS.isString(n)){\r
+n=AJS.TN(n);\r
+}\r
+if(AJS.isDefined(n)){\r
+elm.appendChild(n);\r
+}\r
+},1);\r
+}\r
+return elm;\r
+},getElementsByTagAndClassName:function(_36,_37,_38,_39){\r
+var _3a=[];\r
+if(!AJS.isDefined(_38)){\r
+_38=document;\r
+}\r
+if(!AJS.isDefined(_36)){\r
+_36="*";\r
+}\r
+var els=_38.getElementsByTagName(_36);\r
+var _3c=els.length;\r
+var _3d=new RegExp("(^|\\s)"+_37+"(\\s|$)");\r
+for(i=0,j=0;i<_3c;i++){\r
+if(_3d.test(els[i].className)||_37==null){\r
+_3a[j]=els[i];\r
+j++;\r
+}\r
+}\r
+if(_39){\r
+return _3a[0];\r
+}else{\r
+return _3a;\r
+}\r
+},isOpera:function(){\r
+return (navigator.userAgent.toLowerCase().indexOf("opera")!=-1);\r
+},isString:function(obj){\r
+return (typeof obj=="string");\r
+},hideElement:function(elm){\r
+var _40=AJS.forceArray(arguments);\r
+AJS.map(_40,function(elm){\r
+elm.style.display="none";\r
+});\r
+},setOpacity:function(elm,p){\r
+elm.style.opacity=p;\r
+elm.style.filter="alpha(opacity="+p*100+")";\r
+},insertBefore:function(elm,_45){\r
+_45.parentNode.insertBefore(elm,_45);\r
+return elm;\r
+},setWidth:function(){\r
+var _46=AJS.forceArray(arguments);\r
+_46.splice(_46.length-1,0,"width");\r
+AJS.setStyle.apply(null,_46);\r
+},createArray:function(v){\r
+if(AJS.isArray(v)&&!AJS.isString(v)){\r
+return v;\r
+}else{\r
+if(!v){\r
+return [];\r
+}else{\r
+return [v];\r
+}\r
+}\r
+},isDict:function(o){\r
+var _49=String(o);\r
+return _49.indexOf(" Object")!=-1;\r
+},isMozilla:function(){\r
+return (navigator.userAgent.toLowerCase().indexOf("gecko")!=-1&&navigator.productSub>=20030210);\r
+},removeEventListener:function(elm,_4b,fn,_4d){\r
+var _4e="ajsl_"+_4b+fn;\r
+if(!_4d){\r
+_4d=false;\r
+}\r
+fn=elm[_4e]||fn;\r
+if(elm["on"+_4b]==fn){\r
+elm["on"+_4b]=elm[_4e+"old"];\r
+}\r
+if(elm.removeEventListener){\r
+elm.removeEventListener(_4b,fn,_4d);\r
+if(AJS.isOpera()){\r
+elm.removeEventListener(_4b,fn,!_4d);\r
+}\r
+}else{\r
+if(elm.detachEvent){\r
+elm.detachEvent("on"+_4b,fn);\r
+}\r
+}\r
+},callLater:function(fn,_50){\r
+var _51=function(){\r
+fn();\r
+};\r
+window.setTimeout(_51,_50);\r
+},setTop:function(){\r
+var _52=AJS.forceArray(arguments);\r
+_52.splice(_52.length-1,0,"top");\r
+AJS.setStyle.apply(null,_52);\r
+},_createDomShortcuts:function(){\r
+var _53=["ul","li","td","tr","th","tbody","table","input","span","b","a","div","img","button","h1","h2","h3","h4","h5","h6","br","textarea","form","p","select","option","optgroup","iframe","script","center","dl","dt","dd","small","pre","i"];\r
+var _54=function(elm){\r
+AJS[elm.toUpperCase()]=function(){\r
+return AJS.createDOM.apply(null,[elm,arguments]);\r
+};\r
+};\r
+AJS.map(_53,_54);\r
+AJS.TN=function(_56){\r
+return document.createTextNode(_56);\r
+};\r
+},addCallback:function(fn){\r
+this.callbacks.unshift(fn);\r
+},bindMethods:function(_58){\r
+for(var k in _58){\r
+var _5a=_58[k];\r
+if(typeof (_5a)=="function"){\r
+_58[k]=AJS.$b(_5a,_58);\r
+}\r
+}\r
+},partial:function(fn){\r
+var _5c=AJS.$FA(arguments);\r
+_5c.shift();\r
+return function(){\r
+_5c=_5c.concat(AJS.$FA(arguments));\r
+return fn.apply(window,_5c);\r
+};\r
+},isNumber:function(obj){\r
+return (typeof obj=="number");\r
+},getCssDim:function(dim){\r
+if(AJS.isString(dim)){\r
+return dim;\r
+}else{\r
+return dim+"px";\r
+}\r
+},isIe:function(){\r
+return (navigator.userAgent.toLowerCase().indexOf("msie")!=-1&&navigator.userAgent.toLowerCase().indexOf("opera")==-1);\r
+},removeClass:function(){\r
+var _5f=AJS.forceArray(arguments);\r
+var cls=_5f.pop();\r
+var _61=function(o){\r
+o.className=o.className.replace(new RegExp("\\s?"+cls,"g"),"");\r
+};\r
+AJS.map(_5f,function(elm){\r
+_61(elm);\r
+});\r
+},setHTML:function(elm,_65){\r
+elm.innerHTML=_65;\r
+return elm;\r
+},map:function(_66,fn,_68,_69){\r
+var i=0,l=_66.length;\r
+if(_68){\r
+i=_68;\r
+}\r
+if(_69){\r
+l=_69;\r
+}\r
+for(i;i<l;i++){\r
+var val=fn(_66[i],i);\r
+if(val!=undefined){\r
+return val;\r
+}\r
+}\r
+},addEventListener:function(elm,_6e,fn,_70,_71){\r
+var _72="ajsl_"+_6e+fn;\r
+if(!_71){\r
+_71=false;\r
+}\r
+AJS.listeners=AJS.$A(AJS.listeners);\r
+if(AJS.isIn(_6e,["keypress","keydown","keyup","click"])){\r
+var _73=fn;\r
+fn=function(e){\r
+AJS.setEventKey(e);\r
+return _73.apply(window,arguments);\r
+};\r
+}\r
+var _75=AJS.isIn(_6e,["submit","load","scroll","resize"]);\r
+var _76=AJS.$A(elm);\r
+AJS.map(_76,function(_77){\r
+if(_70){\r
+var _78=fn;\r
+fn=function(e){\r
+AJS.REV(_77,_6e,fn);\r
+return _78.apply(window,arguments);\r
+};\r
+}\r
+if(_75){\r
+var _7a=_77["on"+_6e];\r
+var _7b=function(){\r
+if(_7a){\r
+fn(arguments);\r
+return _7a(arguments);\r
+}else{\r
+return fn(arguments);\r
+}\r
+};\r
+_77[_72]=_7b;\r
+_77[_72+"old"]=_7a;\r
+elm["on"+_6e]=_7b;\r
+}else{\r
+_77[_72]=fn;\r
+if(_77.attachEvent){\r
+_77.attachEvent("on"+_6e,fn);\r
+}else{\r
+if(_77.addEventListener){\r
+_77.addEventListener(_6e,fn,_71);\r
+}\r
+}\r
+AJS.listeners.push([_77,_6e,fn]);\r
+}\r
+});\r
+},preloadImages:function(){\r
+AJS.AEV(window,"load",AJS.$p(function(_7c){\r
+AJS.map(_7c,function(src){\r
+var pic=new Image();\r
+pic.src=src;\r
+});\r
+},arguments));\r
+},forceArray:function(_7f){\r
+var r=[];\r
+AJS.map(_7f,function(elm){\r
+r.push(elm);\r
+});\r
+return r;\r
+},update:function(l1,l2){\r
+for(var i in l2){\r
+l1[i]=l2[i];\r
+}\r
+return l1;\r
+},getBody:function(){\r
+return AJS.$bytc("body")[0];\r
+},HTML2DOM:function(_85,_86){\r
+var d=AJS.DIV();\r
+d.innerHTML=_85;\r
+if(_86){\r
+return d.childNodes[0];\r
+}else{\r
+return d;\r
+}\r
+},getElement:function(id){\r
+if(AJS.isString(id)||AJS.isNumber(id)){\r
+return document.getElementById(id);\r
+}else{\r
+return id;\r
+}\r
+},showElement:function(){\r
+var _89=AJS.forceArray(arguments);\r
+AJS.map(_89,function(elm){\r
+elm.style.display="";\r
+});\r
+},bind:function(fn,_8c,_8d){\r
+fn._cscope=_8c;\r
+return AJS._getRealScope(fn,_8d);\r
+},createDOM:function(_8e,_8f){\r
+var i=0,_91;\r
+var elm=document.createElement(_8e);\r
+var _93=_8f[0];\r
+if(AJS.isDict(_8f[i])){\r
+for(k in _93){\r
+_91=_93[k];\r
+if(k=="style"||k=="s"){\r
+elm.style.cssText=_91;\r
+}else{\r
+if(k=="c"||k=="class"||k=="className"){\r
+elm.className=_91;\r
+}else{\r
+elm.setAttribute(k,_91);\r
+}\r
+}\r
+}\r
+i++;\r
+}\r
+if(_93==null){\r
+i=1;\r
+}\r
+for(var j=i;j<_8f.length;j++){\r
+var _91=_8f[j];\r
+if(_91){\r
+var _95=typeof (_91);\r
+if(_95=="string"||_95=="number"){\r
+_91=AJS.TN(_91);\r
+}\r
+elm.appendChild(_91);\r
+}\r
+}\r
+return elm;\r
+},swapDOM:function(_96,src){\r
+_96=AJS.getElement(_96);\r
+var _98=_96.parentNode;\r
+if(src){\r
+src=AJS.getElement(src);\r
+_98.replaceChild(src,_96);\r
+}else{\r
+_98.removeChild(_96);\r
+}\r
+return src;\r
+},isDefined:function(o){\r
+return (o!="undefined"&&o!=null);\r
+}};\r
+AJS.$=AJS.getElement;\r
+AJS.$$=AJS.getElements;\r
+AJS.$f=AJS.getFormElement;\r
+AJS.$p=AJS.partial;\r
+AJS.$b=AJS.bind;\r
+AJS.$A=AJS.createArray;\r
+AJS.DI=AJS.documentInsert;\r
+AJS.ACN=AJS.appendChildNodes;\r
+AJS.RCN=AJS.replaceChildNodes;\r
+AJS.AEV=AJS.addEventListener;\r
+AJS.REV=AJS.removeEventListener;\r
+AJS.$bytc=AJS.getElementsByTagAndClassName;\r
+AJS.$AP=AJS.absolutePosition;\r
+AJS.$FA=AJS.forceArray;\r
+AJS.addEventListener(window,"unload",AJS._unloadListeners);\r
+AJS._createDomShortcuts();\r
+AJS.Class=function(_9a){\r
+var fn=function(){\r
+if(arguments[0]!="no_init"){\r
+return this.init.apply(this,arguments);\r
+}\r
+};\r
+fn.prototype=_9a;\r
+AJS.update(fn,AJS.Class.prototype);\r
+return fn;\r
+};\r
+AJS.Class.prototype={extend:function(_9c){\r
+var _9d=new this("no_init");\r
+for(k in _9c){\r
+var _9e=_9d[k];\r
+var cur=_9c[k];\r
+if(_9e&&_9e!=cur&&typeof cur=="function"){\r
+cur=this._parentize(cur,_9e);\r
+}\r
+_9d[k]=cur;\r
+}\r
+return new AJS.Class(_9d);\r
+},implement:function(_a0){\r
+AJS.update(this.prototype,_a0);\r
+},_parentize:function(cur,_a2){\r
+return function(){\r
+this.parent=_a2;\r
+return cur.apply(this,arguments);\r
+};\r
+}};\r
+script_loaded=true;\r
+\r
+\r
+script_loaded=true;
\ No newline at end of file
diff --git a/NP_Mediatocu/mediatocu/greybox/AJS_fx.js b/NP_Mediatocu/mediatocu/greybox/AJS_fx.js
new file mode 100644 (file)
index 0000000..8248b0c
--- /dev/null
@@ -0,0 +1,138 @@
+AJS.fx={_shades:{0:"ffffff",1:"ffffee",2:"ffffdd",3:"ffffcc",4:"ffffbb",5:"ffffaa",6:"ffff99"},highlight:function(_1,_2){\r
+var _3=new AJS.fx.Base();\r
+_3.elm=AJS.$(_1);\r
+_3.options.duration=600;\r
+_3.setOptions(_2);\r
+AJS.update(_3,{increase:function(){\r
+if(this.now==7){\r
+_1.style.backgroundColor="#fff";\r
+}else{\r
+_1.style.backgroundColor="#"+AJS.fx._shades[Math.floor(this.now)];\r
+}\r
+}});\r
+return _3.custom(6,0);\r
+},fadeIn:function(_4,_5){\r
+_5=_5||{};\r
+if(!_5.from){\r
+_5.from=0;\r
+AJS.setOpacity(_4,0);\r
+}\r
+if(!_5.to){\r
+_5.to=1;\r
+}\r
+var s=new AJS.fx.Style(_4,"opacity",_5);\r
+return s.custom(_5.from,_5.to);\r
+},fadeOut:function(_7,_8){\r
+_8=_8||{};\r
+if(!_8.from){\r
+_8.from=1;\r
+}\r
+if(!_8.to){\r
+_8.to=0;\r
+}\r
+_8.duration=300;\r
+var s=new AJS.fx.Style(_7,"opacity",_8);\r
+return s.custom(_8.from,_8.to);\r
+},setWidth:function(_a,_b){\r
+var s=new AJS.fx.Style(_a,"width",_b);\r
+return s.custom(_b.from,_b.to);\r
+},setHeight:function(_d,_e){\r
+var s=new AJS.fx.Style(_d,"height",_e);\r
+return s.custom(_e.from,_e.to);\r
+}};\r
+AJS.fx.Base=new AJS.Class({init:function(_10){\r
+this.options={onStart:function(){\r
+},onComplete:function(){\r
+},transition:AJS.fx.Transitions.sineInOut,duration:500,wait:true,fps:50};\r
+AJS.update(this.options,_10);\r
+AJS.bindMethods(this);\r
+},setOptions:function(_11){\r
+AJS.update(this.options,_11);\r
+},step:function(){\r
+var _12=new Date().getTime();\r
+if(_12<this.time+this.options.duration){\r
+this.cTime=_12-this.time;\r
+this.setNow();\r
+}else{\r
+setTimeout(AJS.$b(this.options.onComplete,this,[this.elm]),10);\r
+this.clearTimer();\r
+this.now=this.to;\r
+}\r
+this.increase();\r
+},setNow:function(){\r
+this.now=this.compute(this.from,this.to);\r
+},compute:function(_13,to){\r
+var _15=to-_13;\r
+return this.options.transition(this.cTime,_13,_15,this.options.duration);\r
+},clearTimer:function(){\r
+clearInterval(this.timer);\r
+this.timer=null;\r
+return this;\r
+},_start:function(_16,to){\r
+if(!this.options.wait){\r
+this.clearTimer();\r
+}\r
+if(this.timer){\r
+return;\r
+}\r
+setTimeout(AJS.$p(this.options.onStart,this.elm),10);\r
+this.from=_16;\r
+this.to=to;\r
+this.time=new Date().getTime();\r
+this.timer=setInterval(this.step,Math.round(1000/this.options.fps));\r
+return this;\r
+},custom:function(_18,to){\r
+return this._start(_18,to);\r
+},set:function(to){\r
+this.now=to;\r
+this.increase();\r
+return this;\r
+},setStyle:function(elm,_1c,val){\r
+if(this.property=="opacity"){\r
+AJS.setOpacity(elm,val);\r
+}else{\r
+AJS.setStyle(elm,_1c,val);\r
+}\r
+}});\r
+AJS.fx.Style=AJS.fx.Base.extend({init:function(elm,_1f,_20){\r
+this.parent();\r
+this.elm=elm;\r
+this.setOptions(_20);\r
+this.property=_1f;\r
+},increase:function(){\r
+this.setStyle(this.elm,this.property,this.now);\r
+}});\r
+AJS.fx.Styles=AJS.fx.Base.extend({init:function(elm,_22){\r
+this.parent();\r
+this.elm=AJS.$(elm);\r
+this.setOptions(_22);\r
+this.now={};\r
+},setNow:function(){\r
+for(p in this.from){\r
+this.now[p]=this.compute(this.from[p],this.to[p]);\r
+}\r
+},custom:function(obj){\r
+if(this.timer&&this.options.wait){\r
+return;\r
+}\r
+var _24={};\r
+var to={};\r
+for(p in obj){\r
+_24[p]=obj[p][0];\r
+to[p]=obj[p][1];\r
+}\r
+return this._start(_24,to);\r
+},increase:function(){\r
+for(var p in this.now){\r
+this.setStyle(this.elm,p,this.now[p]);\r
+}\r
+}});\r
+AJS.fx.Transitions={linear:function(t,b,c,d){\r
+return c*t/d+b;\r
+},sineInOut:function(t,b,c,d){\r
+return -c/2*(Math.cos(Math.PI*t/d)-1)+b;\r
+}};\r
+script_loaded=true;\r
+\r
+\r
+script_loaded=true;
\ No newline at end of file
diff --git a/NP_Mediatocu/mediatocu/greybox/g_close.gif b/NP_Mediatocu/mediatocu/greybox/g_close.gif
new file mode 100644 (file)
index 0000000..8707668
Binary files /dev/null and b/NP_Mediatocu/mediatocu/greybox/g_close.gif differ
diff --git a/NP_Mediatocu/mediatocu/greybox/gb_scripts.js b/NP_Mediatocu/mediatocu/greybox/gb_scripts.js
new file mode 100644 (file)
index 0000000..53138c3
--- /dev/null
@@ -0,0 +1,445 @@
+var GB_CURRENT=null;\r
+GB_hide=function(cb){\r
+GB_CURRENT.hide(cb);\r
+};\r
+GreyBox=new AJS.Class({init:function(_2){\r
+this.use_fx=AJS.fx;\r
+this.type="page";\r
+this.overlay_click_close=true;\r
+this.salt=0;\r
+this.root_dir=GB_ROOT_DIR;\r
+this.callback_fns=[];\r
+this.reload_on_close=false;\r
+this.src_loader=this.root_dir+"loader_frame.html";\r
+var _3=window.location.hostname.indexOf("www");\r
+var _4=this.src_loader.indexOf("www");\r
+if(_3!=-1&&_4==-1){\r
+this.src_loader=this.src_loader.replace("://","://www.");\r
+}\r
+if(_3==-1&&_4!=-1){\r
+this.src_loader=this.src_loader.replace("://www.","://");\r
+}\r
+this.show_loading=true;\r
+AJS.update(this,_2);\r
+},addCallback:function(fn){\r
+if(fn){\r
+this.callback_fns.push(fn);\r
+}\r
+},show:function(_6){\r
+GB_CURRENT=this;\r
+this.url=_6;\r
+var _7=[AJS.$bytc("object"),AJS.$bytc("select")];\r
+AJS.map(AJS.flattenList(_7),function(_8){\r
+_8.style.visibility="hidden";\r
+});\r
+this.createElements();\r
+return false;\r
+},hide:function(cb){\r
+var me=this;\r
+AJS.callLater(function(){\r
+var _b=me.callback_fns;\r
+if(_b!=[]){\r
+AJS.map(_b,function(fn){\r
+fn();\r
+});\r
+}\r
+me.onHide();\r
+if(me.use_fx){\r
+var _d=me.overlay;\r
+AJS.fx.fadeOut(me.overlay,{onComplete:function(){\r
+AJS.removeElement(_d);\r
+_d=null;\r
+},duration:300});\r
+AJS.removeElement(me.g_window);\r
+}else{\r
+AJS.removeElement(me.g_window,me.overlay);\r
+}\r
+me.removeFrame();\r
+AJS.REV(window,"scroll",_GB_setOverlayDimension);\r
+AJS.REV(window,"resize",_GB_update);\r
+var _e=[AJS.$bytc("object"),AJS.$bytc("select")];\r
+AJS.map(AJS.flattenList(_e),function(_f){\r
+_f.style.visibility="visible";\r
+});\r
+GB_CURRENT=null;\r
+if(me.reload_on_close){\r
+window.location.reload();\r
+}\r
+if(AJS.isFunction(cb)){\r
+cb();\r
+}\r
+},10);\r
+},update:function(){\r
+this.setOverlayDimension();\r
+this.setFrameSize();\r
+this.setWindowPosition();\r
+},createElements:function(){\r
+this.initOverlay();\r
+this.g_window=AJS.DIV({"id":"GB_window"});\r
+AJS.hideElement(this.g_window);\r
+AJS.getBody().insertBefore(this.g_window,this.overlay.nextSibling);\r
+this.initFrame();\r
+this.initHook();\r
+this.update();\r
+var me=this;\r
+if(this.use_fx){\r
+AJS.fx.fadeIn(this.overlay,{duration:300,to:0.7,onComplete:function(){\r
+me.onShow();\r
+AJS.showElement(me.g_window);\r
+me.startLoading();\r
+}});\r
+}else{\r
+AJS.setOpacity(this.overlay,0.7);\r
+AJS.showElement(this.g_window);\r
+this.onShow();\r
+this.startLoading();\r
+}\r
+AJS.AEV(window,"scroll",_GB_setOverlayDimension);\r
+AJS.AEV(window,"resize",_GB_update);\r
+},removeFrame:function(){\r
+try{\r
+AJS.removeElement(this.iframe);\r
+}\r
+catch(e){\r
+}\r
+this.iframe=null;\r
+},startLoading:function(){\r
+this.iframe.src=this.src_loader+"?s="+this.salt++;\r
+AJS.showElement(this.iframe);\r
+},setOverlayDimension:function(){\r
+var _11=AJS.getWindowSize();\r
+if(AJS.isMozilla()||AJS.isOpera()){\r
+AJS.setWidth(this.overlay,"100%");\r
+}else{\r
+AJS.setWidth(this.overlay,_11.w);\r
+}\r
+var _12=Math.max(AJS.getScrollTop()+_11.h,AJS.getScrollTop()+this.height);\r
+if(_12<AJS.getScrollTop()){\r
+AJS.setHeight(this.overlay,_12);\r
+}else{\r
+AJS.setHeight(this.overlay,AJS.getScrollTop()+_11.h);\r
+}\r
+},initOverlay:function(){\r
+this.overlay=AJS.DIV({"id":"GB_overlay"});\r
+if(this.overlay_click_close){\r
+AJS.AEV(this.overlay,"click",GB_hide);\r
+}\r
+AJS.setOpacity(this.overlay,0);\r
+AJS.getBody().insertBefore(this.overlay,AJS.getBody().firstChild);\r
+},initFrame:function(){\r
+if(!this.iframe){\r
+var d={"name":"GB_frame","class":"GB_frame","frameBorder":0};\r
+if(AJS.isIe()){\r
+d.src="javascript:false;document.write(\"\");";\r
+}\r
+this.iframe=AJS.IFRAME(d);\r
+this.middle_cnt=AJS.DIV({"class":"content"},this.iframe);\r
+this.top_cnt=AJS.DIV();\r
+this.bottom_cnt=AJS.DIV();\r
+AJS.ACN(this.g_window,this.top_cnt,this.middle_cnt,this.bottom_cnt);\r
+}\r
+},onHide:function(){\r
+},onShow:function(){\r
+},setFrameSize:function(){\r
+},setWindowPosition:function(){\r
+},initHook:function(){\r
+}});\r
+_GB_update=function(){\r
+if(GB_CURRENT){\r
+GB_CURRENT.update();\r
+}\r
+};\r
+_GB_setOverlayDimension=function(){\r
+if(GB_CURRENT){\r
+GB_CURRENT.setOverlayDimension();\r
+}\r
+};\r
+AJS.preloadImages(GB_ROOT_DIR+"indicator.gif");\r
+script_loaded=true;\r
+var GB_SETS={};\r
+function decoGreyboxLinks(){\r
+var as=AJS.$bytc("a");\r
+AJS.map(as,function(a){\r
+if(a.getAttribute("href")&&a.getAttribute("rel")){\r
+var rel=a.getAttribute("rel");\r
+if(rel.indexOf("gb_")==0){\r
+var _17=rel.match(/\w+/)[0];\r
+var _18=rel.match(/\[(.*)\]/)[1];\r
+var _19=0;\r
+var _1a={"caption":a.title||"","url":a.href};\r
+if(_17=="gb_pageset"||_17=="gb_imageset"){\r
+if(!GB_SETS[_18]){\r
+GB_SETS[_18]=[];\r
+}\r
+GB_SETS[_18].push(_1a);\r
+_19=GB_SETS[_18].length;\r
+}\r
+if(_17=="gb_pageset"){\r
+a.onclick=function(){\r
+GB_showFullScreenSet(GB_SETS[_18],_19);\r
+return false;\r
+};\r
+}\r
+if(_17=="gb_imageset"){\r
+a.onclick=function(){\r
+GB_showImageSet(GB_SETS[_18],_19);\r
+return false;\r
+};\r
+}\r
+if(_17=="gb_image"){\r
+a.onclick=function(){\r
+GB_showImage(_1a.caption,_1a.url);\r
+return false;\r
+};\r
+}\r
+if(_17=="gb_page"){\r
+a.onclick=function(){\r
+var sp=_18.split(/, ?/);\r
+GB_show(_1a.caption,_1a.url,parseInt(sp[1]),parseInt(sp[0]));\r
+return false;\r
+};\r
+}\r
+if(_17=="gb_page_fs"){\r
+a.onclick=function(){\r
+GB_showFullScreen(_1a.caption,_1a.url);\r
+return false;\r
+};\r
+}\r
+if(_17=="gb_page_center"){\r
+a.onclick=function(){\r
+var sp=_18.split(/, ?/);\r
+GB_showCenter(_1a.caption,_1a.url,parseInt(sp[1]),parseInt(sp[0]));\r
+return false;\r
+};\r
+}\r
+}\r
+}\r
+});\r
+}\r
+AJS.AEV(window,"load",decoGreyboxLinks);\r
+GB_showImage=function(_1d,url,_1f){\r
+var _20={width:300,height:300,type:"image",fullscreen:false,center_win:true,caption:_1d,callback_fn:_1f};\r
+var win=new GB_Gallery(_20);\r
+return win.show(url);\r
+};\r
+GB_showPage=function(_22,url,_24){\r
+var _25={type:"page",caption:_22,callback_fn:_24,fullscreen:true,center_win:false};\r
+var win=new GB_Gallery(_25);\r
+return win.show(url);\r
+};\r
+GB_Gallery=GreyBox.extend({init:function(_27){\r
+this.parent({});\r
+this.img_close=this.root_dir+"g_close.gif";\r
+AJS.update(this,_27);\r
+this.addCallback(this.callback_fn);\r
+},initHook:function(){\r
+AJS.addClass(this.g_window,"GB_Gallery");\r
+var _28=AJS.DIV({"class":"inner"});\r
+this.header=AJS.DIV({"class":"GB_header"},_28);\r
+AJS.setOpacity(this.header,0);\r
+AJS.getBody().insertBefore(this.header,this.overlay.nextSibling);\r
+var _29=AJS.TD({"id":"GB_caption","class":"caption","width":"40%"},this.caption);\r
+var _2a=AJS.TD({"id":"GB_middle","class":"middle","width":"20%"});\r
+var _2b=AJS.IMG({"src":this.img_close});\r
+AJS.AEV(_2b,"click",GB_hide);\r
+var _2c=AJS.TD({"class":"close","width":"40%"},_2b);\r
+var _2d=AJS.TBODY(AJS.TR(_29,_2a,_2c));\r
+var _2e=AJS.TABLE({"cellspacing":"0","cellpadding":0,"border":0},_2d);\r
+AJS.ACN(_28,_2e);\r
+if(this.fullscreen){\r
+AJS.AEV(window,"scroll",AJS.$b(this.setWindowPosition,this));\r
+}else{\r
+AJS.AEV(window,"scroll",AJS.$b(this._setHeaderPos,this));\r
+}\r
+},setFrameSize:function(){\r
+var _2f=this.overlay.offsetWidth;\r
+var _30=AJS.getWindowSize();\r
+if(this.fullscreen){\r
+this.width=_2f-40;\r
+this.height=_30.h-80;\r
+}\r
+AJS.setWidth(this.iframe,this.width);\r
+AJS.setHeight(this.iframe,this.height);\r
+AJS.setWidth(this.header,_2f);\r
+},_setHeaderPos:function(){\r
+AJS.setTop(this.header,AJS.getScrollTop()+10);\r
+},setWindowPosition:function(){\r
+var _31=this.overlay.offsetWidth;\r
+var _32=AJS.getWindowSize();\r
+AJS.setLeft(this.g_window,((_31-50-this.width)/2));\r
+var _33=AJS.getScrollTop()+55;\r
+if(!this.center_win){\r
+AJS.setTop(this.g_window,_33);\r
+}else{\r
+var fl=((_32.h-this.height)/2)+20+AJS.getScrollTop();\r
+if(fl<0){\r
+fl=0;\r
+}\r
+if(_33>fl){\r
+fl=_33;\r
+}\r
+AJS.setTop(this.g_window,fl);\r
+}\r
+this._setHeaderPos();\r
+},onHide:function(){\r
+AJS.removeElement(this.header);\r
+AJS.removeClass(this.g_window,"GB_Gallery");\r
+},onShow:function(){\r
+if(this.use_fx){\r
+AJS.fx.fadeIn(this.header,{to:1});\r
+}else{\r
+AJS.setOpacity(this.header,1);\r
+}\r
+}});\r
+AJS.preloadImages(GB_ROOT_DIR+"g_close.gif");\r
+GB_showFullScreenSet=function(set,_36,_37){\r
+var _38={type:"page",fullscreen:true,center_win:false};\r
+var _39=new GB_Sets(_38,set);\r
+_39.addCallback(_37);\r
+_39.showSet(_36-1);\r
+return false;\r
+};\r
+GB_showImageSet=function(set,_3b,_3c){\r
+var _3d={type:"image",fullscreen:false,center_win:true,width:300,height:300};\r
+var _3e=new GB_Sets(_3d,set);\r
+_3e.addCallback(_3c);\r
+_3e.showSet(_3b-1);\r
+return false;\r
+};\r
+GB_Sets=GB_Gallery.extend({init:function(_3f,set){\r
+this.parent(_3f);\r
+if(!this.img_next){\r
+this.img_next=this.root_dir+"next.gif";\r
+}\r
+if(!this.img_prev){\r
+this.img_prev=this.root_dir+"prev.gif";\r
+}\r
+this.current_set=set;\r
+},showSet:function(_41){\r
+this.current_index=_41;\r
+var _42=this.current_set[this.current_index];\r
+this.show(_42.url);\r
+this._setCaption(_42.caption);\r
+this.btn_prev=AJS.IMG({"class":"left",src:this.img_prev});\r
+this.btn_next=AJS.IMG({"class":"right",src:this.img_next});\r
+AJS.AEV(this.btn_prev,"click",AJS.$b(this.switchPrev,this));\r
+AJS.AEV(this.btn_next,"click",AJS.$b(this.switchNext,this));\r
+GB_STATUS=AJS.SPAN({"class":"GB_navStatus"});\r
+AJS.ACN(AJS.$("GB_middle"),this.btn_prev,GB_STATUS,this.btn_next);\r
+this.updateStatus();\r
+},updateStatus:function(){\r
+AJS.setHTML(GB_STATUS,(this.current_index+1)+" / "+this.current_set.length);\r
+if(this.current_index==0){\r
+AJS.addClass(this.btn_prev,"disabled");\r
+}else{\r
+AJS.removeClass(this.btn_prev,"disabled");\r
+}\r
+if(this.current_index==this.current_set.length-1){\r
+AJS.addClass(this.btn_next,"disabled");\r
+}else{\r
+AJS.removeClass(this.btn_next,"disabled");\r
+}\r
+},_setCaption:function(_43){\r
+AJS.setHTML(AJS.$("GB_caption"),_43);\r
+},updateFrame:function(){\r
+var _44=this.current_set[this.current_index];\r
+this._setCaption(_44.caption);\r
+this.url=_44.url;\r
+this.startLoading();\r
+},switchPrev:function(){\r
+if(this.current_index!=0){\r
+this.current_index--;\r
+this.updateFrame();\r
+this.updateStatus();\r
+}\r
+},switchNext:function(){\r
+if(this.current_index!=this.current_set.length-1){\r
+this.current_index++;\r
+this.updateFrame();\r
+this.updateStatus();\r
+}\r
+}});\r
+AJS.AEV(window,"load",function(){\r
+AJS.preloadImages(GB_ROOT_DIR+"next.gif",GB_ROOT_DIR+"prev.gif");\r
+});\r
+GB_show=function(_45,url,_47,_48,_49){\r
+var _4a={caption:_45,height:_47||500,width:_48||500,fullscreen:false,callback_fn:_49};\r
+var win=new GB_Window(_4a);\r
+return win.show(url);\r
+};\r
+GB_showCenter=function(_4c,url,_4e,_4f,_50){\r
+var _51={caption:_4c,center_win:true,height:_4e||500,width:_4f||500,fullscreen:false,callback_fn:_50};\r
+var win=new GB_Window(_51);\r
+return win.show(url);\r
+};\r
+GB_showFullScreen=function(_53,url,_55){\r
+var _56={caption:_53,fullscreen:true,callback_fn:_55};\r
+var win=new GB_Window(_56);\r
+return win.show(url);\r
+};\r
+GB_Window=GreyBox.extend({init:function(_58){\r
+this.parent({});\r
+this.img_header=this.root_dir+"header_bg.gif";\r
+this.img_close=this.root_dir+"w_close.gif";\r
+this.show_close_img=true;\r
+AJS.update(this,_58);\r
+this.addCallback(this.callback_fn);\r
+},initHook:function(){\r
+AJS.addClass(this.g_window,"GB_Window");\r
+this.header=AJS.TABLE({"class":"header"});\r
+this.header.style.backgroundImage="url("+this.img_header+")";\r
+var _59=AJS.TD({"class":"caption"},this.caption);\r
+var _5a=AJS.TD({"class":"close"});\r
+if(this.show_close_img){\r
+var _5b=AJS.IMG({"src":this.img_close});\r
+var _5c=AJS.SPAN("Close");\r
+var btn=AJS.DIV(_5b,_5c);\r
+AJS.AEV([_5b,_5c],"mouseover",function(){\r
+AJS.addClass(_5c,"on");\r
+});\r
+AJS.AEV([_5b,_5c],"mouseout",function(){\r
+AJS.removeClass(_5c,"on");\r
+});\r
+AJS.AEV([_5b,_5c],"mousedown",function(){\r
+AJS.addClass(_5c,"click");\r
+});\r
+AJS.AEV([_5b,_5c],"mouseup",function(){\r
+AJS.removeClass(_5c,"click");\r
+});\r
+AJS.AEV([_5b,_5c],"click",GB_hide);\r
+AJS.ACN(_5a,btn);\r
+}\r
+tbody_header=AJS.TBODY();\r
+AJS.ACN(tbody_header,AJS.TR(_59,_5a));\r
+AJS.ACN(this.header,tbody_header);\r
+AJS.ACN(this.top_cnt,this.header);\r
+if(this.fullscreen){\r
+AJS.AEV(window,"scroll",AJS.$b(this.setWindowPosition,this));\r
+}\r
+},setFrameSize:function(){\r
+if(this.fullscreen){\r
+var _5e=AJS.getWindowSize();\r
+overlay_h=_5e.h;\r
+this.width=Math.round(this.overlay.offsetWidth-(this.overlay.offsetWidth/100)*10);\r
+this.height=Math.round(overlay_h-(overlay_h/100)*10);\r
+}\r
+AJS.setWidth(this.header,this.width+6);\r
+AJS.setWidth(this.iframe,this.width);\r
+AJS.setHeight(this.iframe,this.height);\r
+},setWindowPosition:function(){\r
+var _5f=AJS.getWindowSize();\r
+AJS.setLeft(this.g_window,((_5f.w-this.width)/2)-13);\r
+if(!this.center_win){\r
+AJS.setTop(this.g_window,AJS.getScrollTop());\r
+}else{\r
+var fl=((_5f.h-this.height)/2)-20+AJS.getScrollTop();\r
+if(fl<0){\r
+fl=0;\r
+}\r
+AJS.setTop(this.g_window,fl);\r
+}\r
+}});\r
+AJS.preloadImages(GB_ROOT_DIR+"w_close.gif",GB_ROOT_DIR+"header_bg.gif");\r
+\r
+\r
+script_loaded=true;
\ No newline at end of file
diff --git a/NP_Mediatocu/mediatocu/greybox/gb_styles.css b/NP_Mediatocu/mediatocu/greybox/gb_styles.css
new file mode 100644 (file)
index 0000000..0e43057
--- /dev/null
@@ -0,0 +1,149 @@
+/* Last-Modified: 28/06/06 00:08:22 */\r
+#GB_overlay {\r
+    background-color: #000;\r
+    position: absolute;\r
+    margin: auto;\r
+    top: 0;\r
+    left: 0;\r
+    z-index: 100;\r
+}\r
+\r
+#GB_window {\r
+    left: 0;\r
+    top: 0;\r
+    font-size: 1px;\r
+    position: absolute;\r
+    overflow: visible;\r
+    z-index: 150;\r
+}\r
+\r
+#GB_window .content {\r
+    width: auto;\r
+    margin: 0;\r
+    padding: 0;\r
+}\r
+\r
+#GB_frame {\r
+    border: 0;\r
+    margin: 0;\r
+    padding: 0;\r
+    overflow: auto;\r
+    white-space: nowrap;\r
+}\r
+\r
+\r
+.GB_Gallery {\r
+    margin: 0 22px 0 22px;\r
+}\r
+\r
+.GB_Gallery .content {\r
+    background-color: #fff;\r
+    border: 3px solid #ddd;\r
+}\r
+\r
+.GB_header {\r
+    top: 10px;\r
+    left: 0;\r
+    margin: 0;\r
+    z-index: 500;\r
+    position: absolute;\r
+    border-bottom: 2px solid #555;\r
+    border-top: 2px solid #555;\r
+}\r
+\r
+.GB_header .inner {\r
+    background-color: #333;\r
+    font-family: Arial, Verdana, sans-serif;\r
+    padding: 2px 20px 2px 20px;\r
+}\r
+\r
+.GB_header table {\r
+    margin: 0;\r
+    width: 96%;\r
+    border:1px solid #f00;\r
+    border-collapse: collapse;\r
+}\r
+\r
+.GB_header .caption {\r
+    text-align: left;\r
+    color: #eee;\r
+    white-space: nowrap;\r
+    font-size: 20px;\r
+}\r
+\r
+.GB_header .close {\r
+    text-align: right;\r
+}\r
+\r
+.GB_header .close img {\r
+    z-index: 500;\r
+    cursor: pointer;\r
+}\r
+\r
+.GB_header .middle {\r
+    white-space: nowrap;\r
+    text-align: center;\r
+}\r
+\r
+\r
+#GB_middle {\r
+    color: #eee;\r
+}\r
+\r
+#GB_middle img {\r
+    cursor: pointer;\r
+    vertical-align: middle;\r
+}\r
+\r
+#GB_middle .disabled {\r
+    cursor: default;\r
+}\r
+\r
+#GB_middle .left {\r
+    padding-right: 10px;\r
+}\r
+\r
+#GB_middle .right {\r
+    padding-left: 10px;\r
+}\r
+\r
+\r
+.GB_Window .content {\r
+    background-color: #fff;\r
+    border: 3px solid #ccc;\r
+    border-top: none;\r
+}\r
+\r
+.GB_Window .header {\r
+    border-bottom: 1px solid #aaa;\r
+    border-top: 1px solid #999;\r
+    border-left: 3px solid #ccc;\r
+    border-right: 3px solid #ccc;\r
+    margin: 0;\r
+\r
+    height: 22px;\r
+    font-size: 12px;\r
+    padding: 3px 0;\r
+    color: #333;\r
+}\r
+\r
+.GB_Window .caption {\r
+    font-size: 12px;\r
+    text-align: left;\r
+    font-weight: bold;\r
+    white-space: nowrap;\r
+    padding-right: 20px;\r
+}\r
+\r
+.GB_Window .close { text-align: right; }\r
+.GB_Window .close span { \r
+    font-size: 12px;\r
+    cursor: pointer; \r
+}\r
+.GB_Window .close img {\r
+    cursor: pointer;\r
+    padding: 0 3px 0 0;\r
+}\r
+\r
+.GB_Window .on { border-bottom: 1px solid #333; }\r
+.GB_Window .click { border-bottom: 1px solid red; }\r
diff --git a/NP_Mediatocu/mediatocu/greybox/header_bg.gif b/NP_Mediatocu/mediatocu/greybox/header_bg.gif
new file mode 100644 (file)
index 0000000..3913cfd
Binary files /dev/null and b/NP_Mediatocu/mediatocu/greybox/header_bg.gif differ
diff --git a/NP_Mediatocu/mediatocu/greybox/indicator.gif b/NP_Mediatocu/mediatocu/greybox/indicator.gif
new file mode 100644 (file)
index 0000000..02bdbdd
Binary files /dev/null and b/NP_Mediatocu/mediatocu/greybox/indicator.gif differ
diff --git a/NP_Mediatocu/mediatocu/greybox/loader_frame.html b/NP_Mediatocu/mediatocu/greybox/loader_frame.html
new file mode 100644 (file)
index 0000000..36a2cd8
--- /dev/null
@@ -0,0 +1,104 @@
+<!--\r
+Notice: I feel so dirty doing this, but its the only way to make it cross browser.\r
+-->\r
+<html>\r
+<head>\r
+  <script>\r
+    var GB = parent.GB_CURRENT;\r
+    document.write('<script type="text/javascript" src="AJS.js"><\/script>');\r
+    if(GB.use_fx) {\r
+        document.write('<script type="text/javascript" src="AJS_fx.js"><\/script>');\r
+    }\r
+  </script>\r
+  <style>\r
+    body {\r
+      padding: 0;\r
+      margin: 0;\r
+      overflow: hidden;\r
+    }\r
+\r
+    #GB_frame {\r
+      visibility: hidden;\r
+      width: 100%;\r
+      height: 100%;\r
+    }\r
+\r
+    #loading {\r
+      padding-top: 50px;\r
+      position: absolute;\r
+      width: 100%;\r
+      top: 0;\r
+      text-align: center;\r
+      vertical-align: middle;\r
+    }\r
+  </style>\r
+</head>\r
+<body>\r
+\r
+<div id="loading">\r
+  <img src="indicator.gif">\r
+</div>\r
+\r
+<script>\r
+var loading = AJS.$('loading');\r
+var gb_type = GB.type;\r
+var gb_url = GB.url;\r
+\r
+//Start loading in the iframe\r
+if(gb_type == "page") {\r
+  document.write('<iframe id="GB_frame" src="' + gb_url + '" frameborder="0"></iframe>');\r
+}\r
+else {\r
+  var img_holder = new Image();\r
+  img_holder.src = gb_url;\r
+  document.write('<img id="GB_frame" src="' + gb_url + '">');\r
+}\r
+var frame = AJS.$('GB_frame');\r
+</script>\r
+\r
+</body>\r
+<script>\r
+function setupOuterGB() {\r
+    frame.style.visibility = 'visible';\r
+    GB.setFrameSize();\r
+    GB.setWindowPosition();\r
+}\r
+\r
+function loaded() {\r
+    AJS.removeElement(loading);\r
+\r
+    GB.overlay.innerHTML += "&nbsp;"; //Safari bugfix\r
+    \r
+    if(gb_type == "image") {\r
+        if(img_holder.width != 0 && img_holder.height != 0) {\r
+            var width = img_holder.width;\r
+            var height = img_holder.height;\r
+\r
+            GB.width = width;\r
+            GB.height = height;\r
+\r
+            setupOuterGB();\r
+\r
+            if(GB.use_fx) {\r
+                AJS.setOpacity(frame, 0);\r
+                AJS.fx.fadeIn(frame);\r
+            }\r
+        }\r
+    }\r
+    else {\r
+        GB.width = frame.offsetWidth;\r
+        GB.height = frame.offsetHeight;\r
+        setupOuterGB();\r
+    }\r
+}\r
+\r
+if(GB.show_loading) {\r
+    AJS.AEV(window, 'load', function(e) {\r
+        loaded();\r
+    });\r
+}\r
+else {\r
+    loaded();\r
+}\r
+</script>\r
+</html>\r
diff --git a/NP_Mediatocu/mediatocu/greybox/next.gif b/NP_Mediatocu/mediatocu/greybox/next.gif
new file mode 100644 (file)
index 0000000..c0f8908
Binary files /dev/null and b/NP_Mediatocu/mediatocu/greybox/next.gif differ
diff --git a/NP_Mediatocu/mediatocu/greybox/prev.gif b/NP_Mediatocu/mediatocu/greybox/prev.gif
new file mode 100644 (file)
index 0000000..d20e095
Binary files /dev/null and b/NP_Mediatocu/mediatocu/greybox/prev.gif differ
diff --git a/NP_Mediatocu/mediatocu/greybox/w_close.gif b/NP_Mediatocu/mediatocu/greybox/w_close.gif
new file mode 100644 (file)
index 0000000..3c05b15
Binary files /dev/null and b/NP_Mediatocu/mediatocu/greybox/w_close.gif differ
diff --git a/NP_Mediatocu/mediatocu/index.html b/NP_Mediatocu/mediatocu/index.html
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/NP_Mediatocu/mediatocu/lang/english.php b/NP_Mediatocu/mediatocu/lang/english.php
new file mode 100644 (file)
index 0000000..49a4cb4
--- /dev/null
@@ -0,0 +1,58 @@
+<?php\r
+// add language definition by T.Kosugi\r
+       define('_MEDIA_PHP_ACTION_DIR','Folder Management');\r
+       define('_MEDIA_PHP_ACTION_DIR_TT','Folder Management');\r
+       define('_MEDIA_PHP_ACTION_MKDIR','Make Dir');\r
+       define('_MEDIA_MKDIR_TITLE','Make Dir');\r
+       define('_MEDIA_MKDIR_MSG','Please input the made folder name. (a-z)');\r
+       define('_MEDIA_MKDIR_BUTTON','make');\r
+       define('_MEDIA_PHP_ACTION_RMDIR','Del');\r
+       define('_MEDIA_RMDIR_TITLE','Delete');\r
+       define('_MEDIA_RMDIR_MSG','Please select the deleted folder.');\r
+       define('_MEDIA_RMDIR_BUTTON','Delete');\r
+\r
+       define('_MEDIA_PHP_1','Delete');\r
+       define('_MEDIA_PHP_2','It failed in the deletion.');\r
+       define('_MEDIA_PHP_3','File name change');\r
+       define('_MEDIA_PHP_4','Click after new file name is input to change');\r
+       define('_MEDIA_PHP_5','');\r
+       define('_MEDIA_PHP_6',' Number of contents ');\r
+       define('_MEDIA_PHP_7','It displays it.');\r
+       define('_MEDIA_PHP_8','');\r
+       define('_MEDIA_PHP_9','');\r
+       define('_MEDIA_PHP_10','It failed in the name change.<BR />');\r
+       define('_MEDIA_PHP_11','Method of inserting image');\r
+       define('_MEDIA_PHP_12','Thumbnail');\r
+       define('_MEDIA_PHP_13',' Number of contents ');\r
+       define('_MEDIA_PHP_14',' Number of contents ');\r
+       define('_MEDIA_PHP_15',' Number of contents ');\r
+       define('_MEDIA_PHP_16',' Number of contents ');\r
+       define('_MEDIA_PHP_17',' Thumbnail width ');\r
+       define('_MEDIA_PHP_18',' Thumbnail height ');\r
+       define('_MEDIA_PHP_19',' Thumbnail quality ');\r
+       define('_MEDIA_PHP_20','info');\r
+       define('_MEDIA_PHP_21','');\r
+       define('_MEDIA_PHP_22','count per page');\r
+       define('_MEDIA_PHP_23','window width');\r
+       define('_MEDIA_PHP_24','window height');\r
+       define('_MEDIA_PHP_25','operation');\r
+       define('_MEDIA_PHP_26','paste');\r
+       define('_MEDIA_PHP_27','popup is default');\r
+//     define('_MEDIA_PHP_28','next &gt;&gt;&gt;');\r
+       define('_MEDIA_PHP_28','next >>>');\r
+//     define('_MEDIA_PHP_29','&lt;&lt;&lt; prev');\r
+       define('_MEDIA_PHP_29','<<< prev');\r
+       define('_MEDIA_PHP_30','execute');\r
+       define('_MEDIA_PHP_31','It narrows it partially of the file name : ');\r
+       define('_MEDIA_PHP_32','user dir');\r
+       define('_MEDIA_PHP_33','file name');\r
+       define('_MEDIA_PHP_34','don\'t regularize');\r
+       define('_MEDIA_PHP_35','regularize to ASCII');\r
+       define('_MEDIA_PHP_36','use GreyBox');\r
+       define('_MEDIA_PHP_37','Enhancing version of mediaphp');\r
+       define('_MEDIA_PHP_38','ACCESS VIOLATION');\r
+       define('_MEDIA_PHP_39','access denied(1)');\r
+       define('_MEDIA_PHP_40','access denied(2)');\r
+       define('_MEDIA_PHP_41','mkdir error : ');\r
+       define('_MEDIA_PHP_42','rmdir error');\r
+       define('_MEDIA_PHP_43','Directory not to allow it to display in collection list');\r
diff --git a/NP_Mediatocu/mediatocu/lang/japanese-euc.php b/NP_Mediatocu/mediatocu/lang/japanese-euc.php
new file mode 100644 (file)
index 0000000..18a33f7
--- /dev/null
@@ -0,0 +1,59 @@
+<?php\r
+// add language definition by T.Kosugi\r
+       define('_MEDIA_PHP_ACTION_DIR','¥Õ¥©¥ë¥À´ÉÍý >>>');\r
+       define('_MEDIA_PHP_ACTION_DIR_TT','¥Õ¥©¥ë¥À¤ò´ÉÍý¤·¤Þ¤¹');\r
+       define('_MEDIA_PHP_ACTION_MKDIR','¥Õ¥©¥ë¥ÀºîÀ®');\r
+       define('_MEDIA_MKDIR_TITLE','¥Õ¥©¥ë¥ÀºîÀ®');\r
+       define('_MEDIA_MKDIR_MSG','ºîÀ®¤¹¤ë¥Õ¥©¥ë¥À̾¤òÆþÎϤ·¤Æ¤¯¤À¤µ¤¤(a-z¾®Ê¸»ú¤ò¿ä¾©)');\r
+       define('_MEDIA_MKDIR_BUTTON','ºîÀ®');\r
+       define('_MEDIA_PHP_ACTION_RMDIR','¥Õ¥©¥ë¥Àºï½ü');\r
+       define('_MEDIA_RMDIR_TITLE','¥Õ¥©¥ë¥Àºï½ü');\r
+       define('_MEDIA_RMDIR_MSG','ºï½ü¤¹¤ë¥Õ¥©¥ë¥À¤òÁªÂò¤·¤Æ¤¯¤À¤µ¤¤');\r
+       define('_MEDIA_RMDIR_BUTTON','ºï½ü');\r
+\r
+// add language definition by yama\r
+       define('_MEDIA_PHP_1','ºï½ü');\r
+       define('_MEDIA_PHP_2','¤Îºï½ü¤Ë¼ºÇÔ¤·¤Þ¤·¤¿<BR />');\r
+       define('_MEDIA_PHP_3','¥Õ¥¡¥¤¥ë̾Êѹ¹');\r
+       define('_MEDIA_PHP_4','Êѹ¹¤·¤¿¤¤¾ì¹ç¡¢¿·¤·¤¤¥Õ¥¡¥¤¥ë̾¤òÆþÎϤ·¤Æ¤«¤é¥¯¥ê¥Ã¥¯');\r
+       define('_MEDIA_PHP_5','ËÜÅö¤Ë');\r
+       define('_MEDIA_PHP_6',' ¥³¥ó¥Æ¥ó¥Ä¿ô ');\r
+       define('_MEDIA_PHP_7','¤òɽ¼¨¤·¤Æ¤¤¤Þ¤¹¡£');\r
+       define('_MEDIA_PHP_8','ËÜÅö¤Ë');\r
+       define('_MEDIA_PHP_9','¤·¤Æ¤¤¤¤¤Ç¤¹¤«¡©');\r
+       define('_MEDIA_PHP_10','¤Î̾Á°Êѹ¹¤Ë¼ºÇÔ¤·¤Þ¤·¤¿<BR />');\r
+       define('_MEDIA_PHP_11','²èÁü¤ÎÁÞÆþÊýË¡');\r
+       define('_MEDIA_PHP_12','¥¤¥á¡¼¥¸');\r
+       define('_MEDIA_PHP_13',' ¥³¥ó¥Æ¥ó¥Ä¿ô ');\r
+       define('_MEDIA_PHP_14',' ¥³¥ó¥Æ¥ó¥Ä¿ô ');\r
+       define('_MEDIA_PHP_15',' ¥³¥ó¥Æ¥ó¥Ä¿ô ');\r
+       define('_MEDIA_PHP_16',' ¥³¥ó¥Æ¥ó¥Ä¿ô ');\r
+       define('_MEDIA_PHP_17','¥µ¥à¥Í¥¤¥ë¤Î²£Éý(px)');\r
+       define('_MEDIA_PHP_18','¥µ¥à¥Í¥¤¥ë¤Î½ÄÉý(px)');\r
+       define('_MEDIA_PHP_19','¥µ¥à¥Í¥¤¥ë¤Î²è¼Á(0-100)');\r
+       define('_MEDIA_PHP_20','¾ðÊó');\r
+       define('_MEDIA_PHP_21','<p style="color:#880000;font-weight:bold;">¥Õ¥¡¥¤¥ë̾¤ÏȾ³Ñ±Ñ¿ô»ú¤Î¤ßÍ­¸ú¡£ÆüËܸì¤Î¥Õ¥¡¥¤¥ë̾¤Ï»È¤¨¤Þ¤»¤ó¡£</p>');\r
+       define('_MEDIA_PHP_22','¥Ú¡¼¥¸¤¢¤¿¤ê¤Îɽ¼¨·ï¿ô');\r
+       define('_MEDIA_PHP_23','¥¦¥£¥ó¥É¥¦¤Î²£Éý');\r
+       define('_MEDIA_PHP_24','¥¦¥£¥ó¥É¥¦¤Î½ÄÉý');\r
+       define('_MEDIA_PHP_25','Áàºî');\r
+       define('_MEDIA_PHP_26','Ž¤êÉÕ¤±(¥¯¥ê¥Ã¥¯)');\r
+       define('_MEDIA_PHP_27','¡Ö¥Ý¥Ã¥×¥¢¥Ã¥×¡×¤ò²èÁüÁÞÆþÊýË¡¤Î´ûÄêÃͤˤ¹¤ë');\r
+//     define('_MEDIA_PHP_28','¼¡¤Ø &gt;&gt;&gt;');\r
+       define('_MEDIA_PHP_28','¼¡¤Ø >>>');\r
+//     define('_MEDIA_PHP_29','&lt;&lt;&lt; Á°¤Ø');\r
+       define('_MEDIA_PHP_29','<<< Á°¤Ø');\r
+       define('_MEDIA_PHP_30','¼Â¹Ô');\r
+       define('_MEDIA_PHP_31','¥Õ¥¡¥¤¥ë̾¤Î°ìÉô¤Ç¹Ê¤ê¹þ¤à : ');\r
+       define('_MEDIA_PHP_32','¥æ¡¼¥¶¥Õ¥©¥ë¥À');\r
+       define('_MEDIA_PHP_33','Á´³Ñ¥Õ¥¡¥¤¥ë̾Âкö ¢¨UNIX-TIME.³ÈÄ¥»Ò¤ËÊÑ´¹¤·¤Þ¤¹¡£');\r
+       define('_MEDIA_PHP_34','Âкö¤·¤Ê¤¤');\r
+       define('_MEDIA_PHP_35','Ⱦ³Ñ±Ñ¿ô»ú¤ËÊѹ¹');\r
+       define('_MEDIA_PHP_36','GreyBox¤ò»ÈÍѤ¹¤ë');\r
+       define('_MEDIA_PHP_37','media.php¤Îµ¡Ç½³ÈÄ¥ÈÇ');\r
+       define('_MEDIA_PHP_38','°ìÈÌÊݸî°ãÈ¿');\r
+       define('_MEDIA_PHP_39','¥¢¥¯¥»¥¹¤ÏµñÈݤµ¤ì¤Þ¤·¤¿(1)');\r
+       define('_MEDIA_PHP_40','¥¢¥¯¥»¥¹¤ÏµñÈݤµ¤ì¤Þ¤·¤¿(2)');\r
+       define('_MEDIA_PHP_41','¥Õ¥©¥ë¥À¤òºîÀ®¤Ç¤­¤Þ¤»¤ó¤Ç¤·¤¿ : ');\r
+       define('_MEDIA_PHP_42','¤³¤Î¥Õ¥©¥ë¥À¤Ïºï½ü¤Ç¤­¤Þ¤»¤ó');\r
+       define('_MEDIA_PHP_43','¥³¥ì¥¯¥·¥ç¥ó°ìÍ÷¤Ëɽ¼¨¤·¤Ê¤¤¥Ç¥£¥ì¥¯¥È¥ê');\r
diff --git a/NP_Mediatocu/mediatocu/lang/japanese-utf8.php b/NP_Mediatocu/mediatocu/lang/japanese-utf8.php
new file mode 100644 (file)
index 0000000..047859c
--- /dev/null
@@ -0,0 +1,59 @@
+<?php\r
+// add language definition by T.Kosugi\r
+       define('_MEDIA_PHP_ACTION_DIR','フォルダ管理 >>>');\r
+       define('_MEDIA_PHP_ACTION_DIR_TT','フォルダを管理します');\r
+       define('_MEDIA_PHP_ACTION_MKDIR','フォルダ作成');\r
+       define('_MEDIA_MKDIR_TITLE','フォルダ作成');\r
+       define('_MEDIA_MKDIR_MSG','作成するフォルダ名を入力してください(a-z小文字を推奨)');\r
+       define('_MEDIA_MKDIR_BUTTON','作成');\r
+       define('_MEDIA_PHP_ACTION_RMDIR','フォルダ削除');\r
+       define('_MEDIA_RMDIR_TITLE','フォルダ削除');\r
+       define('_MEDIA_RMDIR_MSG','削除するフォルダを選択してください');\r
+       define('_MEDIA_RMDIR_BUTTON','削除');\r
+\r
+// add language definition by yama\r
+       define('_MEDIA_PHP_1','削除');\r
+       define('_MEDIA_PHP_2','の削除に失敗しました<BR />');\r
+       define('_MEDIA_PHP_3','ファイル名変更');\r
+       define('_MEDIA_PHP_4','変更したい場合、新しいファイル名を入力してからクリック');\r
+       define('_MEDIA_PHP_5','本当に');\r
+       define('_MEDIA_PHP_6',' コンテンツ数 ');\r
+       define('_MEDIA_PHP_7','を表示しています。');\r
+       define('_MEDIA_PHP_8','本当に');\r
+       define('_MEDIA_PHP_9','していいですか?');\r
+       define('_MEDIA_PHP_10','の名前変更に失敗しました<BR />');\r
+       define('_MEDIA_PHP_11','画像の挿入方法');\r
+       define('_MEDIA_PHP_12','イメージ');\r
+       define('_MEDIA_PHP_13',' コンテンツ数 ');\r
+       define('_MEDIA_PHP_14',' コンテンツ数 ');\r
+       define('_MEDIA_PHP_15',' コンテンツ数 ');\r
+       define('_MEDIA_PHP_16',' コンテンツ数 ');\r
+       define('_MEDIA_PHP_17','サムネイルの横幅(px)');\r
+       define('_MEDIA_PHP_18','サムネイルの縦幅(px)');\r
+       define('_MEDIA_PHP_19','サムネイルの画質(0-100)');\r
+       define('_MEDIA_PHP_20','情報');\r
+       define('_MEDIA_PHP_21','<p style="color:#880000;font-weight:bold;">ファイル名は半角英数字のみ有効。日本語のファイル名は使えません。</p>');\r
+       define('_MEDIA_PHP_22','ページあたりの表示件数');\r
+       define('_MEDIA_PHP_23','ウィンドウの横幅');\r
+       define('_MEDIA_PHP_24','ウィンドウの縦幅');\r
+       define('_MEDIA_PHP_25','操作');\r
+       define('_MEDIA_PHP_26','貼り付け(クリック)');\r
+       define('_MEDIA_PHP_27','「ポップアップ」を画像挿入方法の既定値にする');\r
+//     define('_MEDIA_PHP_28','次へ &gt;&gt;&gt;');\r
+       define('_MEDIA_PHP_28','次へ >>>');\r
+//     define('_MEDIA_PHP_29','&lt;&lt;&lt; 前へ');\r
+       define('_MEDIA_PHP_29','<<< 前へ');\r
+       define('_MEDIA_PHP_30','実行');\r
+       define('_MEDIA_PHP_31','ファイル名の一部で絞り込む : ');\r
+       define('_MEDIA_PHP_32','ユーザフォルダ');\r
+       define('_MEDIA_PHP_33','全角ファイル名対策 ※UNIX-TIME.拡張子に変換します。');\r
+       define('_MEDIA_PHP_34','対策しない');\r
+       define('_MEDIA_PHP_35','半角英数字に変更');\r
+       define('_MEDIA_PHP_36','GreyBoxを使用する');\r
+       define('_MEDIA_PHP_37','media.phpの機能拡張版');\r
+       define('_MEDIA_PHP_38','一般保護違反');\r
+       define('_MEDIA_PHP_39','アクセスは拒否されました(1)');\r
+       define('_MEDIA_PHP_40','アクセスは拒否されました(2)');\r
+       define('_MEDIA_PHP_41','フォルダを作成できませんでした : ');\r
+       define('_MEDIA_PHP_42','このフォルダは削除できません');\r
+       define('_MEDIA_PHP_43','コレクション一覧に表示しないディレクトリ');\r
diff --git a/NP_Mediatocu/mediatocu/media.php b/NP_Mediatocu/mediatocu/media.php
new file mode 100644 (file)
index 0000000..166a7b5
--- /dev/null
@@ -0,0 +1,1266 @@
+<?php\r
+/*\r
+ * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)\r
+ * Copyright (C) 2002-2007 The Nucleus Group\r
+ *\r
+ * This program is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License\r
+ * as published by the Free Software Foundation; either version 2\r
+ * of the License, or (at your option) any later version.\r
+ * (see nucleus/documentation/index.html#license for more info)\r
+ */\r
+/**\r
+ * Media popup window for Nucleus\r
+ *\r
+ * Purpose:\r
+ *   - can be openen from an add-item form or bookmarklet popup\r
+ *   - shows a list of recent files, allowing browsing, search and\r
+ *     upload of new files\r
+ *   - close the popup by selecting a file in the list. The file gets\r
+ *     passed through to the add-item form (linkto, popupimg or inline img)\r
+ *\r
+ * @license http://nucleuscms.org/license.txt GNU General Public License\r
+ * @copyright Copyright (C) 2002-2007 The Nucleus Group\r
+ * @version $Id: media.php 1116 2007-02-03 08:24:29Z kimitake $\r
+ * $NucleusJP: media.php,v 1.4 2007/03/27 12:13:47 kimitake Exp $\r
+ *\r
+ */\r
+\r
+\r
+\r
+if (!defined('_MEDIA_PHP_DEFINED')) {\r
+       define('_MEDIA_PHP_DEFINED', 1);\r
+       // mymbmime choice.\r
+}\r
+// add definition end\r
+$CONF = array();\r
+\r
+// defines how much media items will be shown per page. You can override this\r
+// in config.php if you like. (changing it in config.php instead of here will\r
+// allow your settings to be kept even after a Nucleus upgrade)\r
+\r
+\r
+//rem yama 20070928 $CONF['MediaPerPage'] = $media_per_page;\r
+\r
+$Prefix_thumb = "thumb_";\r
+\r
+// include all classes and config data\r
+require('../../../config.php');\r
+\r
+// added yama20070928\r
+$mediatocu            = $manager->getPlugin('NP_Mediatocu');\r
+$media_per_page       = $mediatocu->getOption('media_per_page');\r
+$CONF['MediaPerPage'] = $media_per_page;\r
+// end yama20070928\r
+\r
+include($DIR_LIBS . 'MEDIA.php');      // media classes\r
+/*\r
+ * Start append by T.Kosugi\r
+ * Reffering /lib/MEDIA.php (v3.22)\r
+ */\r
+class MEDIADIRS extends MEDIA\r
+{\r
+       function MEDIADIRES()\r
+       {\r
+               //$this->MEDIA();\r
+       }\r
+\r
+       function getCollectionList()\r
+       {\r
+               global $member, $DIR_MEDIA, $manager;\r
+\r
+               $collections = array();\r
+               /* edit T.Kosugi 2006/09/06\r
+               // add private directory for member\r
+               $collections[$member->getID()] = _MEDIA_PHP_32;\r
+               */\r
+/*\r
+               $searchDir   = '/';\r
+               $prefix      = $member->getID();\r
+               $collections = array_merge($collections, (array)MEDIADIRS::traceCorrectionDir($searchDir, $prefix, _MEDIA_PHP_32));\r
+*/\r
+               // add global collections\r
+               if (!is_dir($DIR_MEDIA)) {\r
+                       return $collections;\r
+               }\r
+\r
+               $dirhandle = opendir($DIR_MEDIA);\r
+               while ($dirname = readdir($dirhandle)) {\r
+                       // only add non-numeric (numeric=private) dirs\r
+                       if (@is_dir($DIR_MEDIA . $dirname) && ($dirname != '.') && ($dirname != '..') && ($dirname != 'CVS') && (!is_numeric($dirname))) {\r
+                               $collections[$dirname] = $dirname;\r
+/*\r
+                               $searchDir             = '/';\r
+                               $prefix                = $dirname;\r
+                               $collections           = array_merge($collections, (array)MEDIADIRS::traceCorrectionDir($searchDir, $prefix, $dirname));\r
+*/\r
+                       }\r
+               }\r
+               closedir($dirhandle);\r
+               // add T.Kosugi 2006/09/06\r
+               // add private directory for member\r
+//             $collections[$member->getID()] = _MEDIA_PHP_32;\r
+               // add end\r
+//             ksort($collections, SORT_STRING);\r
+\r
+               $hiddendir = array();\r
+               $mediatocu = $manager->getPlugin('NP_Mediatocu');\r
+               $hiddendir = explode(',', $mediatocu->getOption('hidden_dir'));\r
+               foreach ($hiddendir as $value)\r
+               {\r
+                       $value = trim($value);\r
+                       unset($collections["$value"]);\r
+               }\r
+               foreach ($collections as $value)\r
+               {\r
+                               $searchDir             = '/';\r
+                               $prefix                = $value;\r
+                               $collections           = array_merge($collections, (array)MEDIADIRS::traceCorrectionDir($searchDir, $prefix, $value));\r
+               }\r
+               $collections[$member->getID()] = _MEDIA_PHP_32;\r
+               $searchDir   = '/';\r
+               $prefix      = $member->getID();\r
+               $collections = array_merge($collections, (array)MEDIADIRS::traceCorrectionDir($searchDir, $prefix, _MEDIA_PHP_32));\r
+               ksort($collections, SORT_STRING);\r
+               return $collections;\r
+\r
+       }\r
+\r
+       function getPrivateCollectionList()\r
+       {\r
+               global $member, $DIR_MEDIA;\r
+\r
+               $collections = array();\r
+               $prefix      = $member->getID();\r
+               $searchDir   = '/';\r
+               $collections = MEDIADIRS::traceCorrectionDir($searchDir, $prefix, _MEDIA_PHP_32);\r
+               // add private directory for member\r
+               $collections[$prefix] = _MEDIA_PHP_32;\r
+               ksort($collections, SORT_STRING);\r
+               return $collections;\r
+       }\r
+\r
+       function traceCorrectionDir($searchDir, $prefix ='', $preName)\r
+       {\r
+               global $DIR_MEDIA;\r
+               $collections = array();         //http://japan.nucleuscms.org/bb/viewtopic.php?p=21230&highlight=#21230\r
+               $dirhandle   = @opendir($DIR_MEDIA . $prefix . $searchDir);\r
+               if (!$dirhandle) {\r
+                       return;\r
+               }\r
+               while ($dirname = readdir($dirhandle)) {\r
+                       // only add non-numeric (numeric=private) dirs\r
+                       if (@is_dir($DIR_MEDIA . $prefix . $searchDir . $dirname) && ($dirname != '.') && ($dirname != '..') && ($dirname != 'CVS'))  {\r
+                               $collections[$prefix . $searchDir . $dirname] = $preName . $searchDir . $dirname;\r
+                               $collections = array_merge($collections, (array)MEDIADIRS::traceCorrectionDir($searchDir . $dirname . '/', $prefix, $preName));\r
+                       }\r
+               }\r
+               closedir($dirhandle);\r
+\r
+               return $collections;\r
+       }\r
+\r
+       function getMediaListByCollection($collection, $filter = '')\r
+       {\r
+               global $DIR_MEDIA;\r
+\r
+               $filelist = array();\r
+\r
+               // 1. go through all objects and add them to the filelist\r
+\r
+               $mediadir = $DIR_MEDIA . $collection . '/';\r
+\r
+               // return if dir does not exist\r
+               if (!is_dir($mediadir)) {\r
+                       return $filelist;\r
+               }\r
+\r
+               $dirhandle = opendir($mediadir);\r
+               while ($filename = readdir($dirhandle)) {\r
+                       // only add files that match the filter\r
+                       if (!@is_dir($mediadir . $filename) && MEDIA::checkFilter($filename, $filter)) {\r
+                               array_push($filelist, new MEDIAOBJECT($collection, $filename, filemtime($mediadir . $filename)));\r
+                       }\r
+               }\r
+               closedir($dirhandle);\r
+\r
+               // sort array so newer files are shown first\r
+               usort($filelist, 'sort_media');\r
+\r
+               return $filelist;\r
+       }\r
+}\r
+\r
+/*\r
+ * End append by T.Kosugi\r
+ */\r
+sendContentType('application/xhtml+xml', 'media');\r
+\r
+// user needs to be logged in to use this\r
+if (!$member->isLoggedIn()) {\r
+       media_loginAndPassThrough();\r
+       exit;\r
+}\r
+\r
+// check if member is on at least one teamlist\r
+$query = 'SELECT * FROM ' . sql_table('team'). ' WHERE tmember=' . $member->getID();\r
+//$teams = mysql_query($query);\r
+$teams = sql_query($query);\r
+if (mysql_num_rows($teams) == 0) {\r
+       media_doError(_ERROR_DISALLOWEDUPLOAD);\r
+}\r
+\r
+// get action\r
+$action = requestVar('action');\r
+if ($action == '') {\r
+       $action = 'selectmedia';\r
+}\r
+\r
+// check ticket\r
+$aActionsNotToCheck = array('selectmedia', _MEDIA_PHP_30, _MEDIA_COLLECTION_SELECT);\r
+if (!in_array($action, $aActionsNotToCheck)) {\r
+       if (!$manager->checkTicket()) {\r
+               media_doError(_ERROR_BADTICKET);\r
+       }\r
+}\r
+\r
+               /*-------kei edit & append 2005.5.26-------*/\r
+// <080213 fix $_POST to postVar by shizuki>\r
+//if ($_POST[targetthumb]) {//}\r
+if (postVar('targetthumb')) {\r
+//     $mediapath = $DIR_MEDIA . $_POST[currentCollection] . "/";\r
+       $mediapath = $DIR_MEDIA . postVar('currentCollection') . "/";\r
+//     switch ($_POST[myaction]) {//}\r
+       switch (postVar('myaction')) {\r
+               case _MEDIA_PHP_1:\r
+//                     $msg1 = unlink($mediapath . $_POST[targetfile]);\r
+                       $msg1 = unlink($mediapath . postVar('targetfile'));\r
+                       if (!$msg1) {\r
+                               print $selectfile . htmlspecialchars(_MEDIA_PHP_2);\r
+                       }\r
+//                     $exist = file_exists($mediapath . $_POST[targetthumb]);\r
+                       $exist = file_exists($mediapath . postVar('targetthumb'));\r
+                       if ($exist) {\r
+//                             $msg2 = unlink($mediapath.$_POST[targetthumb]);\r
+                               $msg2 = unlink($mediapath . postVar('targetthumb'));\r
+                               if (!$msg2) {\r
+//                                     print $_POST[targetthumb] . _MEDIA_PHP_2;\r
+                                       print postVar('targetthumb') . htmlspecialchars(_MEDIA_PHP_2);\r
+                               }\r
+                       }\r
+                       break;\r
+               case _MEDIA_PHP_3:\r
+                       //chmod($mediapath.$targetfile, 706);\r
+                       /*\r
+                       T.Kosugi edit 2006.8.22\r
+                       */\r
+                       // check file type against allowed types\r
+//                     $newfilename = $_POST[newname];\r
+                       $newfilename = postVar('newname');\r
+                       // T.Kosugi add 2006.9.1\r
+                       if (stristr($newfilename, '%00')) {\r
+                               media_doError(_MEDIA_PHP_38);\r
+                       }\r
+                       // T.Kosugi add end\r
+                       $ok = 0;\r
+                       $allowedtypes = explode (',', $CONF['AllowedTypes']);\r
+                       foreach ($allowedtypes as $type) {\r
+                               if (eregi("\." . $type . "$", $newfilename)) {\r
+                                       $ok = 1;\r
+                               }\r
+                       }\r
+                       if (eregi("\.php$", $newfilename)) {\r
+                               $ok = 0;\r
+                       }\r
+                       if (!$ok) {\r
+                               media_doError(_ERROR_BADFILETYPE);\r
+                       }\r
+                       /*\r
+                       T.Kosugi edit End\r
+                       */\r
+//                     $msg1 = rename($mediapath . $_POST[targetfile], $mediapath . htmlspecialchars($_POST[newname]) );\r
+                       $msg1 = rename($mediapath . postVar('targetfile'), $mediapath . htmlspecialchars(postVar('newname')) );\r
+                       if (!$msg1) {\r
+                               print $selectfile . htmlspecialchars(_MEDIA_PHP_10);\r
+                       }\r
+//                     $exist = file_exists($mediapath . $_POST[targetthumb]);\r
+                       $exist = file_exists($mediapath . postVar('targetthumb'));\r
+\r
+                       //print "targetthumb=$mediapath$_POST[targetthumb]<BR />";\r
+                       if ($exist) {\r
+//                             $thumbnewname = $Prefix_thumb . $_POST[newname];\r
+                               $thumbnewname = $Prefix_thumb . postVar('newname');\r
+//                             $msg2         = rename($mediapath . $_POST[targetthumb], $mediapath . $thumbnewname);\r
+                               $msg2         = rename($mediapath . postVar('targetthumb'), $mediapath . $thumbnewname);\r
+                               if (!$msg2) {\r
+                                       print $targetthumb . htmlspecialchars(_MEDIA_PHP_10);\r
+                               }\r
+                       }\r
+                       break;\r
+       }\r
+}\r
+// </080213 fix $_POST to postVar by shizuki>\r
+switch($action) {\r
+       case 'chooseupload':\r
+       case _MEDIA_UPLOAD_TO:\r
+       case _MEDIA_UPLOAD_NEW:\r
+               media_choose();\r
+               break;\r
+       case 'uploadfile':\r
+               media_upload();\r
+               break;\r
+       case _MEDIA_PHP_30:\r
+       case 'selectmedia':\r
+       case _MEDIA_COLLECTION_SELECT:\r
+       default:\r
+               media_select();\r
+               break;\r
+       /*\r
+               added forder action by T.Kosugi  2006/08/27\r
+       */\r
+       case _MEDIA_PHP_ACTION_DIR:\r
+       case _MEDIA_PHP_ACTION_MKDIR:\r
+       case _MEDIA_PHP_ACTION_RMDIR:\r
+       case 'rmdir':\r
+       case 'mkdir':\r
+               media_mkdir($action);\r
+               break;\r
+       /*\r
+               END added forder action by T.Kosugi  2006/08/27\r
+       */\r
+}\r
+\r
+// select a file\r
+function media_select()\r
+{\r
+       global $member, $CONF, $DIR_MEDIA, $manager;\r
+//added yama 20071013\r
+       $mediatocu = $manager->getPlugin('NP_Mediatocu');\r
+       if ($mediatocu->getOption('paste_mode_checked')=="yes") {\r
+               $paste_mode_popup_checked = 'checked="checked"';\r
+       } else {\r
+               $paste_mode_normal_checked = 'checked="checked"';\r
+       }\r
+//end yama\r
+\r
+       media_head();\r
+\r
+       // show 10 files + navigation buttons\r
+       // show msg when no files\r
+       // show upload form\r
+       // files sorted according to last modification date\r
+\r
+       // currently selected collection\r
+       $currentCollection = requestVar('collection');\r
+        /*2005.8.31  kei append*/\r
+// <080213 fix $_POST to postVar by shizuki>\r
+//     if ($_POST[currentCollection]) {//}\r
+       if (postVar('currentCollection')) {\r
+//             $currentCollection = $_POST[currentCollection];\r
+               $currentCollection = postVar('currentCollection');\r
+       }\r
+// </ 080213 fix $_POST to postVar by shizuki>\r
+       if (!$currentCollection || !@is_dir($DIR_MEDIA . $currentCollection)) {\r
+               $currentCollection = $member->getID();\r
+       }\r
+\r
+       // get collection list\r
+       // start modify by T.Kosugi 2006/08/26\r
+       //$collections = MEDIA::getCollectionList();\r
+       $collections = MEDIADIRS::getCollectionList();\r
+       // modify end\r
+       // modify start T.Kosugi 2006/09/01\r
+       // if (sizeof($collections) > 1) {\r
+       if (sizeof($collections) > 0) {\r
+       // modify end T.Kosugi 2006/09/01\r
+?>\r
+               <form method="post" action="media.php" style="margin:5px 0;"><div>\r
+                       <label for="media_collection"><?php echo htmlspecialchars(_MEDIA_COLLECTION_LABEL)?></label>\r
+                       <select name="collection" id="media_collection" onchange="return form.submit()">\r
+                               <?php\r
+                                       foreach ($collections as $dirname => $description) {\r
+                                               echo '<option value="',htmlspecialchars($dirname),'"';\r
+                                               if ($dirname == $currentCollection) {\r
+                                                       echo ' selected="selected"';\r
+                                               }\r
+                                               echo '>',htmlspecialchars($description),'</option>';\r
+                                       }\r
+                               ?>\r
+                       </select>\r
+                       <!--<input type="submit" name="action" value="<?php echo htmlspecialchars(_MEDIA_COLLECTION_SELECT) ?>" title="<?php echo htmlspecialchars(_MEDIA_COLLECTION_TT)?>" />-->\r
+                       <input type="submit" name="action" value="<?php echo htmlspecialchars(_MEDIA_UPLOAD_NEW) ?>" title="<?php echo htmlspecialchars(_MEDIA_UPLOADLINK) ?>" />\r
+<?php // add button start by T.Kosugi 2006/08/26 ?>\r
+                       <input type="submit" name="action" value="<?php echo htmlspecialchars(_MEDIA_PHP_ACTION_DIR) ?>" title="<?php echo htmlspecialchars(_MEDIA_PHP_ACTION_DIR_TT) ?>" />\r
+<?php // add bottun end by T.Kosugi 2006/08/26 ?>\r
+                       <?php $manager->addTicketHidden() ?>\r
+               </div></form>\r
+<?php\r
+       } else {\r
+?>\r
+               <form method="post" action="media.php" style="float:right"><div>\r
+                       <input type="hidden" name="collection" value="<?php echo htmlspecialchars($currentCollection)?>" />\r
+                       <input type="submit" name="action" value="<?php echo htmlspecialchars(_MEDIA_UPLOAD_NEW) ?>" title="<?php echo htmlspecialchars(_MEDIA_UPLOADLINK) ?>" />\r
+                       <?php $manager->addTicketHidden() ?>\r
+               </div></form>\r
+<?php\r
+       } // if sizeof\r
+\r
+       $filter = requestVar('filter');\r
+       $offset = intRequestVar('offset');\r
+\r
+       // start modify by T.Kosugi 2006/08/26\r
+       //$arr = MEDIA::getMediaListByCollection($currentCollection, $filter);\r
+       $arr = MEDIADIRS::getMediaListByCollection($currentCollection, $filter);\r
+       // modify end\r
+?>\r
+               <form method="post" action="media.php" style="margin:5px 0;"><div>\r
+                       <label for="media_filter"><?php echo htmlspecialchars(_MEDIA_PHP_31)?></label>\r
+                       <input id="media_filter" type="text" name="filter" value="<?php echo htmlspecialchars($filter)?>" />\r
+                       <input type="submit" name="action" value="<?php echo htmlspecialchars(_MEDIA_PHP_30) ?>" />\r
+                       <input type="hidden" name="collection" value="<?php echo htmlspecialchars($currentCollection)?>" />\r
+                       <input type="hidden" name="offset" value="<?php echo intval($offset)?>" />\r
+               </div></form>\r
+\r
+<?php\r
+       if (sizeof($arr)>0) {\r
+               $contents = array();\r
+               /*The numbers of contents except the thumbnail image are requested. */\r
+               for ($i=0;$i<sizeof($arr);$i++) {\r
+                       $obj = $arr[$i];\r
+                       if (ereg("thumb", $obj->filename)) {\r
+                               continue;\r
+                       }\r
+                       $contents[] = $obj;\r
+               }\r
+               $conts_count = sizeof($contents);\r
+               //print "conts_count=$conts_count<br />";\r
+               if ($conts_count < $CONF['MediaPerPage']) {\r
+                       $maxpage = 1;\r
+               } else {\r
+                       $maxpage = ceil($conts_count/$CONF['MediaPerPage']);\r
+               }\r
+\r
+               if ($offset==0) {\r
+                       $offset=1;\r
+               }\r
+               $idxStart = $offset;\r
+               $idxEnd   = $idxStart * $CONF['MediaPerPage'];\r
+               if ($idxEnd > $conts_count) {\r
+                       $idxEnd = $conts_count;\r
+               }\r
+               if ($idxEnd < 1) {\r
+                       $idxEnd = $CONF['MediaPerPage'];\r
+               }\r
+               $idxNext = ($idxStart-1) * $CONF['MediaPerPage'];\r
+               if ($idxNext < 0) {\r
+                       $idxNext = 0;\r
+               }\r
+       }\r
+?>\r
+\r
+               <p><?php echo htmlspecialchars(_MEDIA_COLLECTION_LABEL . $collections[$currentCollection] . _MEDIA_PHP_6 . $conts_count) . " " . intVal($idxNext+1) . " - " . htmlspecialchars($idxEnd . _MEDIA_PHP_7); ?></p>\r
+               <p>\r
+<?php\r
+       if ($idxStart >0 && $idxNext >0) {\r
+               $page = ($idxStart-1);\r
+               echo "<a href='media.php?offset=$page&amp;collection=" . urlencode($currentCollection) . "' title='$page'>" . htmlspecialchars(_MEDIA_PHP_29) . "</a> ";\r
+       }\r
+       if ($idxStart < $maxpage) {\r
+               $page = ($idxStart+1);\r
+               echo "<a href='media.php?offset=$page&amp;collection=" . urlencode($currentCollection) . "' title='$page'>" .  htmlspecialchars(_MEDIA_PHP_28) . "</a> ";\r
+       }\r
+?>\r
+               </p>\r
+<form name="top" action="media.php" style="margin:5px;">\r
+       <div>\r
+               <?php echo htmlspecialchars(_MEDIA_PHP_11) ?>\r
+               <input id="typeradio0" type="radio" class="radio" name="typeradio" onclick="setType(0);document.bottom.typeradio[0].checked=true;" onkeypress="setType(0);document.bottom.typeradio[0].checked=true;" <?php echo $paste_mode_normal_checked; ?> />\r
+               <label for="typeradio0"><?php echo htmlspecialchars(_MEDIA_INLINE);?></label>\r
+               <input <?php echo $paste_mode_popup_checked; ?> id="typeradio1" type="radio" class="radio" name="typeradio" onclick="setType(1);document.bottom.typeradio[1].checked=true;" onkeypress="setType(1);document.bottom.typeradio[1].checked=true;" />\r
+               <label for="typeradio1"><?php echo htmlspecialchars(_MEDIA_POPUP); ?></label>\r
+       </div>\r
+</form>\r
+\r
+<!-- rem yama 20070928           <th><?php echo _MEDIA_MODIFIED; ?></th> -->\r
+<!--\r
+                       <th><?php echo htmlspecialchars(_MEDIA_PHP_12); ?></th>\r
+                       <th><?php echo htmlspecialchars(_MEDIA_PHP_25); ?></th>\r
+                       <th><?php echo htmlspecialchars(_MEDIA_PHP_20); ?></th>\r
+-->\r
+<?php\r
+       if (sizeof($arr)>0) {\r
+               /*-------kei edit & append 2005.5.26-------*/\r
+               global $myaction, $targetfile, $targetthumb, $Prefix_thumb;\r
+               global $newname, $thumbnewname;\r
+\r
+               if ($msg1) {\r
+                       $targetfile = $newname;\r
+               }\r
+               if ($msg2) {\r
+                       $thumb_targetfile = $thumbnewname;\r
+                       echo "<script type='text/javascript'>\n\tlocation.replace('media.php');\n</script>";\r
+               }\r
+\r
+//             print"idxNext=$idxNext<BR />";\r
+//             print"idxEnd=$idxEnd<BR />";\r
+//             print"<BR />";\r
+               for ($i=$idxNext;$i<$idxEnd;$i++) {\r
+                       $filename = $DIR_MEDIA . $currentCollection . '/' . $contents[$i]->filename;\r
+//                     if(!$msg1)$targetfile = $contents[$i]->filename;\r
+                       $targetfile = $contents[$i]->filename;\r
+                       $old_level  = error_reporting(0);\r
+                       $size       = @GetImageSize($filename);\r
+                       error_reporting($old_level);\r
+                       $width      = intval($size[0]);\r
+                       $height     = intval($size[1]);\r
+                       $filetype   = $size[2];\r
+\r
+                       echo "<div class='box'>\n";\r
+// rem yama                    echo "<td>". date("Y-m-d",$contents[$i]->timestamp) ."</td>\n";\r
+\r
+                       // strings for javascript\r
+                       $jsCurrentCollection = str_replace("'", "\\'", $currentCollection);\r
+                       $jsFileName          = str_replace("'", "\\'", $contents[$i]->filename);\r
+                       $targetfile          = str_replace($Prefix_thumb, "", $jsFileName);\r
+                       /*-------kei append 2005.5.26-------*/\r
+                       $mediapath           = $DIR_MEDIA . $currentCollection."/";\r
+                       $thumb_file          = $Prefix_thumb . $targetfile;\r
+                       if (!$msg2) {\r
+                               $thumb_targetfile = $thumb_file;\r
+                       }\r
+                       $thumb_exist = file_exists($mediapath . $thumb_file);\r
+                       /*Thumbnail*/\r
+// <080213 shizuki add>\r
+                       $hscJsCC = htmlspecialchars($jsCurrentCollection);\r
+                       $hscTGTF = htmlspecialchars($targetfile);\r
+                       $hscTTGT = htmlspecialchars($thumb_targetfile);\r
+                       $hscJsFN = htmlspecialchars($jsFileName);\r
+                       $hscCCol = htmlspecialchars($currentCollection);\r
+                       $hscThFN = htmlspecialchars($thumb_file);\r
+                       $hscMEDA = htmlspecialchars($CONF['MediaURL']);\r
+//     2008-02-21 cacher\r
+//                     $hscMVEW = htmlspecialchars(_MEDIA_VIEW_TT);\r
+                       $hscMVEW = htmlspecialchars(_MEDIA_VIEW);\r
+                       $hscMVTT = htmlspecialchars(_MEDIA_VIEW_TT);\r
+//     /2008-02-21 cacher\r
+                       $media26 = htmlspecialchars(_MEDIA_PHP_26);\r
+// </080213 shizuki add>\r
+                       if ($filetype != 0 || $thumb_exist) {\r
+                               // image (gif/jpg/png/swf)\r
+                               $selectfile = $mediapath . $contents[$i]->filename;\r
+//                             print "selectfile=$selectfile<BR />";\r
+                               if (function_exists("ImageCreateFromGif")) {\r
+                               $pattern = array( "/.wmv/" );\r
+                               } else {\r
+                               $pattern = array( "/.gif/", "/.wmv/" );\r
+                               }\r
+                               if (!$thumb_exist) {\r
+//                                     $thumbfile2    = preg_replace($pattern,  ".png", $targetfile); //Extension conversion\r
+//                                     $thumb_file    = $Prefix_thumb . $thumbfile2;\r
+                                       $thumb_file    = $Prefix_thumb . $targetfile . ".png";\r
+                                       $thumb_exist   = file_exists($mediapath . $thumb_file);\r
+                                       $notmake_thumb = 0;\r
+                                       /*Making is tried if there is no thumbnail.  */\r
+                                       if (!$thumb_exist) {\r
+                                               $notmake_thumb = make_thumbnail($DIR_MEDIA, $currentCollection, $selectfile, $contents[$i]->filename);\r
+                                       }\r
+                               }\r
+                               if ($msg2) {\r
+                                       $thumb_file = $Prefix_thumb . $contents[$i]->filename;\r
+                               }\r
+\r
+// <080213 shizuki add>\r
+                               $hscThFN = htmlspecialchars($thumb_file);\r
+// </080213 shizuki add>\r
+//     2008-11-01 cacher\r
+                               }\r
+                               if (file_exists($mediapath . $thumb_file)) {\r
+//     /2008-11-01 cacher\r
+// <080213 mod by shizuki>\r
+//                     echo "<div class=\"tmb\">\r
+//                             <a href=\"media.php\" onclick=\"chooseImage('", htmlspecialchars($jsCurrentCollection), "','", htmlspecialchars($targetfile), "',"\r
+//                  . "'", htmlspecialchars($width), "','" , htmlspecialchars($height), "'"\r
+//                                . ")\" onkeypress=\"chooseImage('", htmlspecialchars($jsCurrentCollection), "','", htmlspecialchars($targetfile), "',"\r
+//                  . "'", htmlspecialchars($width), "','" , htmlspecialchars($height), "'"\r
+//                                . ")\" title=\"" . htmlspecialchars($targetfile). "\">\r
+//                             <img src=\"../../../media/$currentCollection/$thumb_file\" alt=\"$targetfile\" /></a></div>\n";\r
+                               echo <<<_DIVTHUMB_\r
+       <div class="tmb">\r
+               <a href="media.php" onclick="chooseImage('{$hscJsCC}', '{$hscTGTF}', '{$width}', '{$height}')" onkeypress="chooseImage('{$hscJsCC}', '{$hscTGTF}', '{$width}', '{$height}')" title="{$hscTGTF}">\r
+                       <img src="{$hscMEDA}{$hscCCol}/{$hscThFN}" alt="{$hscTGTF}" /></a></div>\r
+\r
+_DIVTHUMB_;\r
+//2008-02-21 Cacher\r
+// </ 080213 mod by shizuki>\r
+                       } else {\r
+                               // When you do not make the thumbnail with mpg and wmv, etc.\r
+//     2008-11-01 cacher\r
+                               $revname=strrev($filename);\r
+                               $file_ext=strtoupper(strrev(substr($revname,0,strpos($revname,"."))));\r
+// 2008-11-08 yama\r
+//                             echo "\t<div class=\"tmb\">$file_ext</div>\n";\r
+                               echo "\t<div class=\"media\">$file_ext</div>\n";\r
+// /2008-11-08 yama\r
+//     /2008-11-01 cacher\r
+                       }\r
+//     2008-11-01 cacher\r
+                       echo "\t";\r
+                       if ($width||$height){\r
+                               echo $width . ' x ' . $height;\r
+                       }\r
+//                     echo "<br />\n\t(" . intval(filesize($filename)) . ")<br />\n\t"        //2008-11-06 cacher\r
+                       echo "<br />\n\t" . number_format(filesize($filename)/1024, 1)." KB<br />\n\t"\r
+                               . date("Y-m-d", $contents[$i]->timestamp) . "<br class=\"clear\" />\n";\r
+//     /2008-11-01 cacher\r
+                       /*File name and size*/\r
+                       //print "targetfile=$targetfile<BR />";\r
+                       if ($filetype != 0) {\r
+                               // image (gif/jpg/png/swf)\r
+// <080213 mod by shizuki>\r
+//                             echo "<a href=\"media.php\" onclick=\"chooseImage('", htmlspecialchars($jsCurrentCollection), "','", htmlspecialchars($targetfile), "',"\r
+//                                     . "'", htmlspecialchars($width), "','" , htmlspecialchars($height), "'"\r
+//                                     . ")\" onkeypress=\"chooseImage('", htmlspecialchars($jsCurrentCollection), "','", htmlspecialchars($targetfile), "',"\r
+//                                     . "'", htmlspecialchars($width), "','" , htmlspecialchars($height), "'"\r
+//                                     . ")\" title=\"" . htmlspecialchars($targetfile). "\">"\r
+// rem yama 20070928                                      . htmlspecialchars(shorten($targetfile,25,'...'))\r
+//                                        . _MEDIA_PHP_26 //added yama 20070928\r
+//                                        ."</a>";\r
+//                        echo ' (<a href="', htmlspecialchars($CONF['MediaURL'] . $currentCollection . '/' . $targetfile), '" onclick="window.open(this.href); return false;" onkeypress="window.open(this.href); return false;" title="',htmlspecialchars(_MEDIA_VIEW_TT),'">',_MEDIA_VIEW,'</a>)';\r
+                       echo <<<_MEDIAPREVIEW_\r
+       <a href="media.php" onclick="chooseImage('{$hscJsCC}', '{$hscTGTF}', '{$width}', '{$height}')" onkeypress="chooseImage('{$hscJsCC}', '{$hscTGTF}', '{$width}', '{$height}')" title="{$hscTGTF}">\r
+               {$media26}\r
+       </a>\r
+       (<a href="{$hscMEDA}{$hscCCol}/{$hscTGTF}" onclick="window.open(this.href); return false;" onkeypress="window.open(this.href); return false;" title="{$hscMVTT}">{$hscMVEW}</a>)\r
+\r
+_MEDIAPREVIEW_;\r
+//2008-02-21 cacher\r
+// </ 080213 mod by shizuki>\r
+                       } else {\r
+                       // not image (e.g. mpg)\r
+// <080213 mod by shizuki>\r
+//                     echo "<a href=\"media.php\" onclick=\"chooseOther('" , htmlspecialchars($jsCurrentCollection), "','", htmlspecialchars($targetfile), "'"\r
+//                         . ")\" title=\"" . htmlspecialchars($targetfile). "\">"\r
+//                         . htmlspecialchars(shorten($targetfile,30,'...'))\r
+//                         ."</a>";\r
+//                             $shortFN = htmlspecialchars(shorten($targetfile, 30, '...'));\r
+                               echo <<<_MEDIAFILE_\r
+       <a href="media.php" onclick="chooseOther('{$hscJsCC}', '{$hscTGTF}')" onkeypress="chooseOther('{$hscJsCC}', '{$hscTGTF}')" title="{$hscTGTF}">\r
+               {$media26}\r
+       </a>\r
+       (<a href="{$hscMEDA}{$hscCCol}/{$hscTGTF}" onclick="window.open(this.href); return false;" onkeypress="window.open(this.href); return false;" title="{$hscMVTT}">{$hscMVEW}</a>)\r
+\r
+_MEDIAFILE_;\r
+// </080213 mod by shizuki>\r
+                       }\r
+// <080213 mod by shizuki>\r
+//             echo"<form method='post' action='media.php' style=\"margin:5px 0 2px;padding:0;\">\n\r
+//                     <div>\r
+//                     <input type='hidden' name='currentCollection' value='$currentCollection' />\r
+//                     <input type='hidden' name='offset' value=\"$offset\" />\r
+//                     <input type='hidden' name='targetfile' value=\"$targetfile\" />\r
+//                     <input type ='hidden' name='targetthumb' value=\"$thumb_targetfile\" />\r
+//                     <input type='text' name='newname' value=\"$targetfile\" size=\"24\" /><br />\r
+//                     <input type='submit' name='myaction' value='"._MEDIA_PHP_3."' title='"._MEDIA_PHP_4."' onclick='return kakunin(this.value)' onkeypress='return kakunin(this.value)' style=\"margin-left:5px;\" />\n\r
+//                     <input type='submit' name='myaction' value='"._MEDIA_PHP_1."' onclick='return kakunin(this.value)' onkeypress='return kakunin(this.value)' />\n\r
+//                     </div>\r
+//                     </form></div>\n";\r
+                       $media01 = htmlspecialchars(_MEDIA_PHP_1);\r
+                       $media03 = htmlspecialchars(_MEDIA_PHP_3);\r
+                       $media04 = htmlspecialchars(_MEDIA_PHP_4);\r
+                       echo <<<_FORMBLOCK_\r
+       <form method="post" action="media.php" style="margin:5px 0 2px; padding:0;">\r
+               <div>\r
+                       <input type="hidden" name="currentCollection" value="{$hscCCol}" />\r
+                       <input type="hidden" name="offset" value="{$offset}" />\r
+                       <input type="hidden" name="targetfile" value="{$hscTGTF}" />\r
+                       <input type="hidden" name="targetthumb" value="{$hscTTGT}" />\r
+                       <input type="text"   name="newname" value="{$hscTGTF}" size="24" /><br />\r
+                       <input type="submit" name="myaction" value="{$media03}" title="{$media04}" onclick="return kakunin(this.value)" onkeypress="return kakunin(this.value)" style="margin-left:5px;" />\r
+                       <input type="submit" name="myaction" value="{$media01}" onclick="return kakunin(this.value)" onkeypress="return kakunin(this.value)" />\r
+               </div>\r
+       </form>\r
+</div>\r
+\r
+_FORMBLOCK_;\r
+// </080213 mod by shizuki>\r
+               }\r
+       } // if (sizeof($arr)>0) }\r
+       echo '<p class="clear">' . "\n";\r
+       if ($idxStart > 0 && $idxNext > 0) {\r
+               echo "<a href='media.php?offset=" . intVal($idxStart-1) . "&amp;collection=" . urlencode($currentCollection) . "'>" . htmlspecialchars(_MEDIA_PHP_29) . "</a> ";\r
+       }\r
+       if ($idxStart < $maxpage) {\r
+               echo "<a href='media.php?offset=" . intVal($idxStart+1) . "&amp;collection=" . urlencode($currentCollection) . "'>" . htmlspecialchars(_MEDIA_PHP_28) . "</a> ";\r
+       }\r
+?>\r
+       </p><form name="bottom" action="media.php" style="margin:5px;"><div>\r
+               <?php echo htmlspecialchars(_MEDIA_PHP_11); ?> <input id="typeradio0b" type="radio" class="radio" name="typeradio" onclick="setType(0);document.top.typeradio[0].checked=true;" onkeypress="setType(0);document.top.typeradio[0].checked=true;" <?php echo $paste_mode_normal_checked; ?> /><label for="typeradio0b"><?php echo htmlspecialchars(_MEDIA_INLINE); ?></label>\r
+               <input <?php echo $paste_mode_popup_checked; ?> id="typeradio1b" type="radio" class="radio" name="typeradio" onclick="setType(1);document.top.typeradio[0].checked=true;" onkeypress="setType(1);document.top.typeradio[0].checked=true;" /><label for="typeradio1b"><?php echo htmlspecialchars(_MEDIA_POPUP); ?></label>\r
+       </div></form>\r
+\r
+<?php\r
+       media_foot();\r
+\r
+\r
+}\r
+\r
+/**\r
+  * Shows a screen where you can select the file to upload\r
+  */\r
+function media_choose()\r
+{\r
+       global $CONF, $member, $manager;\r
+\r
+       $currentCollection = requestVar('collection');\r
+\r
+       // start modify by T.Kosugi 2006/08/26\r
+//     $collections = MEDIA::getCollectionList();\r
+       $collections = MEDIADIRS::getCollectionList();\r
+       // modify end\r
+\r
+       media_head();\r
+?>\r
+       <h1><?php echo htmlspecialchars(_UPLOAD_TITLE); ?></h1>\r
+\r
+       <p><?php echo htmlspecialchars(_UPLOAD_MSG); ?></p>\r
+<!--//added yama 20070928-->\r
+       <?php echo _MEDIA_PHP_21; ?>\r
+<!--//end yama 20070928-->\r
+\r
+       <form method="post" enctype="multipart/form-data" action="media.php">\r
+       <div>\r
+         <input type="hidden" name="action" value="uploadfile" />\r
+         <?php $manager->addTicketHidden() ?>\r
+         <input type="hidden" name="MAX_FILE_SIZE" value="<?php echo intVal($CONF['MaxUploadSize']); ?>" />\r
+         File:\r
+         <br />\r
+         <input name="uploadfile" type="file" size="40" />\r
+       <?php           if (sizeof($collections) > 1) {\r
+?>\r
+               <br /><br /><label for="upload_collection">Collection:</label>\r
+               <br /><select name="collection" id="upload_collection">\r
+                       <?php\r
+                                       foreach ($collections as $dirname => $description) {\r
+                                               echo '<option value="' . htmlspecialchars($dirname) . '"';\r
+                                               if ($dirname == $currentCollection) {\r
+                                                       echo ' selected="selected"';\r
+                                               }\r
+                                               echo '>' . htmlspecialchars($description) . '</option>';\r
+                                       }\r
+                       ?>\r
+               </select>\r
+       <?php           } else {\r
+       ?>\r
+               <input name="collection" type="hidden" value="<?php echo htmlspecialchars(requestVar('collection'))?>" />\r
+       <?php           } // if sizeof\r
+       ?>\r
+         <br /><br />\r
+         <input type="submit" value="<?php echo htmlspecialchars(_UPLOAD_BUTTON); ?>" />\r
+       </div>\r
+       </form>\r
+<p><a href="javascript:history.back()"><?php echo htmlspecialchars(_BACK); ?></a></p>\r
+       <?php\r
+       media_foot();\r
+}\r
+\r
+\r
+/**\r
+  * accepts a file for upload\r
+  */\r
+function media_upload()\r
+{\r
+       global $DIR_MEDIA, $member, $CONF, $manager;\r
+\r
+       $uploadInfo   = postFileInfo('uploadfile');\r
+\r
+       $filename     = $uploadInfo['name'];\r
+       $filetype     = $uploadInfo['type'];\r
+       $filesize     = $uploadInfo['size'];\r
+       $filetempname = $uploadInfo['tmp_name'];\r
+       $fileerror    = intval($uploadInfo['error']);\r
+       $mediatocu    = $manager->getPlugin('NP_Mediatocu');\r
+// added yama 20080131\r
+       if ($mediatocu->getOption('filename_rule') == "ascii") {\r
+               $path_parts = pathinfo($filename);\r
+               $filename   = time() . "." . $path_parts['extension'];\r
+       }\r
+// end\r
+       \r
+       switch ($fileerror) {\r
+               case 0: // = UPLOAD_ERR_OK\r
+                       break;\r
+               case 1: // = UPLOAD_ERR_INI_SIZE\r
+               case 2: // = UPLOAD_ERR_FORM_SIZE\r
+                       media_doError(_ERROR_FILE_TOO_BIG);\r
+                       break;\r
+               case 3: // = UPLOAD_ERR_PARTIAL\r
+               case 4: // = UPLOAD_ERR_NO_FILE\r
+               case 6: // = UPLOAD_ERR_NO_TMP_DIR\r
+               case 7: // = UPLOAD_ERR_CANT_WRITE\r
+               default:\r
+                       // include error code for debugging\r
+                       // (see http://www.php.net/manual/en/features.file-upload.errors.php)\r
+                       media_doError(_ERROR_BADREQUEST . ' (' . $fileerror . ')');\r
+                       break;\r
+       }\r
+\r
+       // T.Kosugi add 2006.9.1\r
+       if (stristr($filename, '%00')) {\r
+               media_doError(_MEDIA_PHP_38);\r
+       }\r
+       // T.Kosugi add end\r
+       if ($filesize > $CONF['MaxUploadSize']) {\r
+               media_doError(_ERROR_FILE_TOO_BIG);\r
+       }\r
+\r
+       // check file type against allowed types\r
+       $ok           = 0;\r
+       $allowedtypes = explode (',', $CONF['AllowedTypes']);\r
+       foreach ( $allowedtypes as $type ) {\r
+               if (eregi("\." .$type. "$",$filename)) {\r
+                       $ok = 1;\r
+               }\r
+       }\r
+       if (!$ok) {\r
+               media_doError(_ERROR_BADFILETYPE);\r
+       }\r
+\r
+       if (!is_uploaded_file($filetempname)) {\r
+               media_doError(_ERROR_BADREQUEST);\r
+       }\r
+\r
+       // prefix filename with current date (YYYY-MM-DD-)\r
+       // this to avoid nameclashes\r
+       if ($CONF['MediaPrefix']) {\r
+               $filename = strftime("%Y%m%d-", time()) . $filename;\r
+       }\r
+\r
+       $collection = requestVar('collection');\r
+       $res        = MEDIA::addMediaObject($collection, $filetempname, $filename);\r
+\r
+       if ($res != '') {\r
+               media_doError($res);\r
+       }\r
+       $uppath = $DIR_MEDIA.$collection . "/";\r
+       $upfile = $DIR_MEDIA.$collection . "/" . $filename;\r
+\r
+       $res    = move_uploaded_file($filetempname, $upfile);\r
+       if ($res != '') {\r
+         media_doError($res);\r
+       }\r
+\r
+       make_thumbnail($DIR_MEDIA, $collection, $upfile, $filename);\r
+\r
+       // shows updated list afterwards\r
+       media_select();\r
+}\r
+/**\r
+  * accepts a dirname for mkdir\r
+  * added by T.Kosugi 2006/08/27\r
+  *\r
+  */\r
+function media_mkdir($action)\r
+{\r
+       global $DIR_MEDIA, $member, $CONF, $manager;\r
+       if ($action == _MEDIA_PHP_ACTION_MKDIR || $action =='mkdir' ) {\r
+               $current   = requestVar('mkdir_collection');\r
+               $mkdirname = postVar('mkdirname');\r
+               if (!($mkdirname && $current)) {\r
+                       media_select();\r
+                       return;\r
+               }\r
+               if (is_numeric($current) && !is_dir($DIR_MEDIA . '/' . $current)) {\r
+                       $oldumask = umask(0000);\r
+                       if (!@mkdir($DIR_MEDIA. '/' . $current, 0777)) {\r
+                               return _ERROR_BADPERMISSIONS;\r
+                       }\r
+                       umask($oldumask);\r
+               }\r
+               $path      = $current . '/' . $mkdirname ;\r
+               $pathArray = explode('/', $path);\r
+               if ($pathArray[0] !== $member->getID()) {\r
+                       media_doError(_MEDIA_PHP_39 . $pathArray[0] . ':' . $member->getID());\r
+               }\r
+               if (in_array('..', $pathArray)) {\r
+                       media_doError(_MEDIA_PHP_40);\r
+               }\r
+\r
+               if (is_dir($DIR_MEDIA . '/' . $current)) {\r
+                       $res = @mkdir($DIR_MEDIA . '/' . $current . '/' . $mkdirname);\r
+                       $res .= @chmod($DIR_MEDIA . '/' . $current . '/' . $mkdirname , 0777);\r
+               }\r
+               if (!$res) {\r
+                       media_doError(_MEDIA_PHP_41 . $res );\r
+               }\r
+               // shows updated list afterwards\r
+               media_select();\r
+       } elseif($action == _MEDIA_PHP_ACTION_RMDIR ||\r
+                        $action == 'rmdir') {\r
+               $rmdir_collection = postVar('rmdir_collection');\r
+               $pathArray        = explode('/', $rmdir_collection);\r
+               if ($pathArray[0] !== $member->getID()) {\r
+                       media_doError(_MEDIA_PHP_39 . $pathArray[0] . ':' . $member->getID());\r
+               }\r
+               if (in_array('..', $pathArray)) {\r
+                       media_doError(_MEDIA_PHP_40);\r
+               }\r
+               $rmdir = $DIR_MEDIA . $rmdir_collection;\r
+               $res   = @rmdir($rmdir);\r
+               if ($res) {\r
+                       media_select();\r
+               } else {\r
+                       media_doError(_MEDIA_PHP_42);\r
+               }\r
+       } else {\r
+               $current     = requestVar('collection');\r
+               $collections = MEDIADIRS::getPrivateCollectionList();\r
+\r
+               media_head();\r
+               ?>\r
+               <h1><?php echo htmlspecialchars(_MEDIA_MKDIR_TITLE); ?></h1>\r
+\r
+               <p><?php echo htmlspecialchars(_MEDIA_MKDIR_MSG); ?></p>\r
+\r
+               <form method="post" action="media.php">\r
+               <div>\r
+                 <input type="hidden" name="action" value="<?php echo htmlspecialchars(_MEDIA_PHP_ACTION_MKDIR); ?>" />\r
+                 <?php $manager->addTicketHidden() ?>\r
+                 FolderName:\r
+                 <br />\r
+                 <input name="mkdirname" type="text" size="40" />\r
+               <?php           if (sizeof($collections) > 0) {\r
+               ?>\r
+                       <br /><br /><label for="mkdir_collection">Collection:</label>\r
+                       <br /><select name="mkdir_collection" id="mkdir_collection">\r
+                               <?php\r
+                                               foreach ($collections as $dirname => $description) {\r
+                                                       echo '<option value="',htmlspecialchars($dirname),'"';\r
+                                                       if ($dirname == $current) {\r
+                                                               echo ' selected="selected"';\r
+                                                       }\r
+                                                       echo '>' . htmlspecialchars($description) . '</option>';\r
+                                               }\r
+                               ?>\r
+                       </select>\r
+               <?php           } elseif (sizeof($collections) == 1) {\r
+                                               $flipCollections = array_flip($collections);\r
+                                               $collection = array_pop($flipCollections);\r
+               ?>\r
+                       <input name="collection" type="hidden" value="<?php echo htmlspecialchars($collection);?>" />\r
+               <?php           } else {\r
+                                               media_foot();\r
+                                               return;\r
+                                       }// if sizeof\r
+               ?>\r
+                 <br /><br />\r
+                 <input type="submit" value="<?php echo htmlspecialchars(_MEDIA_MKDIR_BUTTON); ?>" />\r
+               </div>\r
+               </form>\r
+               <?php           if (sizeof($collections) > 0) {?>\r
+                       <br /><br /><h1><?php echo htmlspecialchars(_MEDIA_RMDIR_TITLE); ?></h1>\r
+\r
+               <p><?php echo htmlspecialchars(_MEDIA_RMDIR_MSG); ?></p>\r
+\r
+               <form method="post" action="media.php">\r
+               <div>\r
+                 <input type="hidden" name="action" value="<?php echo htmlspecialchars(_MEDIA_PHP_ACTION_RMDIR); ?>" />\r
+\r
+       <label for="rmdir_collection">Collection:</label>\r
+                       <br /><select name="rmdir_collection" id="rmdir_collection">\r
+                               <?php\r
+                                       foreach ($collections as $dirname => $description) {\r
+                                               if (is_numeric($dirname)) continue;\r
+                                               echo '<option value="',htmlspecialchars($dirname),'"';\r
+                                               if ($dirname == $current) {\r
+                                                       echo ' selected="selected"';\r
+                                               }\r
+                                               echo '>',htmlspecialchars($description),'</option>';\r
+                                       }\r
+                               ?>\r
+                       </select>\r
+               <?php           } else {\r
+                                               media_foot();\r
+                                               return;\r
+                                       }// if sizeof\r
+               ?>\r
+                 <br /><br />\r
+                 <?php $manager->addTicketHidden() ?>\r
+                 <input type="submit" value="<?php echo htmlspecialchars(_MEDIA_RMDIR_BUTTON); ?>" />\r
+               </div>\r
+               </form>\r
+               <p><a href="javascript:history.back()"><?php echo htmlspecialchars(_BACK); ?></a></p>\r
+               <?php\r
+               media_foot();\r
+       }\r
+}\r
+\r
+function make_thumbnail($DIR_MEDIA, $collection, $upfile, $filename)\r
+{\r
+\r
+    global $Prefix_thumb;\r
+\r
+    /*\r
+    print "DIR_MEDIA=$DIR_MEDIA<BR />";\r
+    print "collection=$collection<BR />";\r
+    print "upfile=$upfile<BR />";\r
+    */\r
+    //print "filename=$filename<BR />\n";\r
+    // Thumbnail image size specification\r
+\r
+//mod yama\r
+       global $manager;\r
+       $mediatocu  = $manager->getPlugin('NP_Mediatocu');\r
+       $thumb_w    = intVal($mediatocu->getOption('thumb_width'));\r
+       $thumb_h    = intVal($mediatocu->getOption('thumb_height'));\r
+       $quality    = intVal($mediatocu->getOption('thumb_quality'));\r
+//end yama\r
+    $size       = getimagesize($upfile);\r
+    $thumb_file = "{$DIR_MEDIA}{$collection}/{$Prefix_thumb}{$filename}";\r
+    // Resize rate\r
+    $moto_w = $size[0];\r
+    $moto_h = $size[1];\r
+    if ($moto_w > $thumb_w || $moto_h > $thumb_h) {\r
+      $ritu_w = $thumb_w /$moto_w;\r
+      $ritu_h = $thumb_h /$moto_h;\r
+      ($ritu_w < $ritu_h) ? $cv_ritu = $ritu_w : $cv_ritu = $ritu_h;\r
+      $w = ceil($moto_w * $cv_ritu);\r
+      $h = ceil($moto_h * $cv_ritu);\r
+    }\r
+\r
+    if ($w && $h) {\r
+      // Making preservation of thumbnail image\r
+      thumb_gd($upfile, $thumb_file, $w, $h, $size, $quality); //GD version\r
+    } else {\r
+      //There is no necessity about the resize. \r
+      thumb_gd($upfile, $thumb_file, $moto_w, $moto_h, $size, $quality); //GD version\r
+    }\r
+}\r
+\r
+\r
+//Thumbnail making(GD)\r
+function thumb_gd($fname, $thumbfile, $out_w, $out_h, $size, $quality)\r
+{\r
+       switch ($size[2]) {\r
+               case 1 ://.gif(or .png)\r
+                       if (function_exists("ImageCreateFromGif")) {\r
+                               $img_in = @ImageCreateFromGIF($fname);\r
+                       } else {\r
+                               $fname  = str_replace( ".gif", ".png", $fname); //Extension conversion\r
+                               $img_in = @ImageCreateFromPng($fname);\r
+                       }\r
+                       break;\r
+               case 2 ://.jpg\r
+                       $img_in = @ImageCreateFromJPEG($fname);\r
+                       break;\r
+               case 3 ://.png\r
+                       $img_in = @ImageCreateFromPng($fname);\r
+                       break;\r
+               default :\r
+                       return;\r
+       }\r
+       if (!$img_in) {\r
+               return;\r
+       }\r
+       //print "im_in=$img_in<BR />";\r
+       $img_out = ImageCreateTrueColor($out_w, $out_h);\r
+       //Former image is copied and the thumbnail is made.\r
+       ImageCopyResampled($img_out, $img_in, 0, 0, 0, 0, $out_w, $out_h, $size[0], $size[1]);\r
+       //Preservation of thumbnail image\r
+       switch ($size[2]) {\r
+               case 1 ://.gif\r
+                       ImageGif($img_out, $thumbfile);\r
+                       break;\r
+               case 2 ://.jpg\r
+                       ImageJpeg($img_out, $thumbfile, $quality);\r
+                       break;\r
+               case 3 ://.png\r
+                       ImagePng($img_out, $thumbfile);\r
+                       break;\r
+       }\r
+       //The memory that maintains the making image is liberated. \r
+       imagedestroy($img_in);\r
+       imagedestroy($img_out);\r
+}\r
+\r
+function media_loginAndPassThrough()\r
+{\r
+       media_head();\r
+       ?>\r
+               <h1><?php echo _LOGIN_PLEASE?></h1>\r
+\r
+               <form method="post" action="media.php">\r
+               <div>\r
+                       <input name="action" value="login" type="hidden" />\r
+                       <input name="collection" value="<?php echo htmlspecialchars(requestVar('collection')); ?>" type="hidden" />\r
+                       <?php echo htmlspecialchars(_LOGINFORM_NAME); ?>: <input name="login" />\r
+                       <br /><?php echo htmlspecialchars(_LOGINFORM_PWD); ?>: <input name="password" type="password" />\r
+                       <br /><input type="submit" value="<?php echo htmlspecialchars(_LOGIN); ?>" />\r
+               </div>\r
+               </form>\r
+               <p><a href="media.php" onclick="window.close();"><?php echo htmlspecialchars(_POPUP_CLOSE); ?></a></p>\r
+       <?php   media_foot();\r
+       exit;\r
+}\r
+\r
+function media_doError($msg)\r
+{\r
+       media_head();\r
+       ?>\r
+       <h1><?php echo htmlspecialchars(_ERROR); ?></h1>\r
+       <p><?php echo htmlspecialchars($msg); ?></p>\r
+       <p><a href="javascript:history.back()"><?php echo htmlspecialchars(_BACK); ?></a></p>\r
+       <?php   media_foot();\r
+       exit;\r
+}\r
+\r
+\r
+function media_head()\r
+{\r
+       global $manager, $CONF;\r
+       $mediatocu = $manager->getPlugin('NP_Mediatocu');\r
+       $thumb_w   = intVal($mediatocu->getOption('thumb_width'));\r
+       $thumb_h   = intVal($mediatocu->getOption('thumb_height'));\r
+       if ($mediatocu->getOption('paste_mode_checked') == "yes") {\r
+               $setType = "1";\r
+       } else {\r
+               $setType = "0";\r
+       }\r
+       $GreyBox   = $mediatocu->getOption('use_gray_box');\r
+?>\r
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\r
+<html xmlns="http://www.w3.org/1999/xhtml">\r
+<head>\r
+               <meta http-equiv="Content-Type" content="text/html; charset=<?php echo htmlspecialchars(_CHARSET); ?>" />\r
+               <meta http-equiv="Content-Script-Type" content="text/javascript" />\r
+               <meta http-equiv="Content-Style-Type" content="text/css" />\r
+               <title>Mediatocu</title>\r
+               <link rel="stylesheet" type="text/css" href="popups.css" />\r
+<?php\r
+               if ($manager->pluginInstalled('NP_TinyMCE')) {\r
+                       $tinyMCE = $manager->getPlugin('NP_TinyMCE');\r
+?>\r
+               <script language="javascript" type="text/javascript" src="<?php echo $tinyMCE->getAdminURL(); ?>jscripts/tiny_mce/tiny_mce_popup.js"></script>\r
+<?php\r
+               }\r
+?>\r
+               <script type="text/javascript">\r
+                       var type = <?php echo intVal($setType); ?>;\r
+                       function setType(val) { type = val; }\r
+\r
+                       function chooseImage(collection, filename, width, height) {\r
+<?php\r
+               if ($manager->pluginInstalled('NP_TinyMCE')) {\r
+?>\r
+                               var win = tinyMCEPopup.getWindowArg("w_n");\r
+                               var file_path = "<?php echo $CONF['MediaURL']; ?>" + collection + "/" + filename;\r
+                               win.document.getElementById(tinyMCEPopup.getWindowArg("f_n")).value = file_path;\r
+                               if (tinyMCEPopup.getWindowArg("file_type") == "image") {\r
+                                       if (win.ImageDialog.getImageData) win.ImageDialog.getImageData();\r
+                                       if (win.ImageDialog.showPreviewImage) win.ImageDialog.showPreviewImage(file_path);\r
+                               }\r
+                               tinyMCEPopup.close();\r
+<?php\r
+               } elseif ($GreyBox == 'yes') {\r
+?>\r
+                               top.window.focus();\r
+                               top.window.includeImage(collection,\r
+                                                                                  filename,\r
+                                                                                  type == 0 ? 'inline' : 'popup',\r
+                                                                                  width,\r
+                                                                                  height\r
+                                                                                  );\r
+                               top.window.GB_hide();\r
+<?php\r
+               } else {\r
+?>\r
+                               top.opener.focus();\r
+                               top.opener.includeImage(collection,\r
+                                                                                  filename,\r
+                                                                                  type == 0 ? 'inline' : 'popup',\r
+                                                                                  width,\r
+                                                                                  height\r
+                                                                                  );\r
+                               window.close();\r
+<?php\r
+               }\r
+?>\r
+                       }\r
+\r
+                       function chooseOther(collection, filename) {\r
+<?php\r
+               if ($manager->pluginInstalled('NP_TinyMCE')) {\r
+?>\r
+                               var win = tinyMCEPopup.getWindowArg("w_n");\r
+                               var file_path = "<?php echo $CONF['MediaURL']; ?>" + collection + "/" + filename;\r
+                               win.document.getElementById(tinyMCEPopup.getWindowArg("f_n")).value = file_path;\r
+                               tinyMCEPopup.close();\r
+<?php\r
+               } elseif ($GreyBox == 'yes') {\r
+?>\r
+                               top.window.focus();\r
+                               top.window.includeOtherMedia(collection, filename);\r
+                               top.window.GB_hide();\r
+<?php\r
+               } else {\r
+?>\r
+                               top.opener.focus();\r
+                               top.opener.includeOtherMedia(collection, filename);\r
+                               window.close();\r
+<?php\r
+               }\r
+?>\r
+                       }\r
+\r
+                       function kakunin(value){\r
+                               res=confirm('<?php echo htmlspecialchars(_MEDIA_PHP_8); ?>'+value+'<?php echo htmlspecialchars(_MEDIA_PHP_9); ?>');\r
+                               return res;\r
+                       }\r
+               </script>\r
+\r
+       <style type="text/css">\r
+/* 2008-11-08 yama*/\r
+               div.tmb, div.media {\r
+/* /2008-11-08 yama*/\r
+                       margin : 0px;\r
+                       padding : 0px;\r
+                       width : <?php echo $thumb_w ?>px;\r
+                       height : <?php echo $thumb_h ?>px;\r
+                       line-height : <?php echo $thumb_h ?>px;\r
+                       float : left;\r
+                       display : inline;\r
+/* 2008-11-08 yama*/\r
+                       border : 1px solid #999;\r
+/* /2008-11-08 yama*/\r
+                       text-align : center;\r
+               }\r
+/* 2008-11-08 yama*/\r
+               div.tmb {\r
+                       background-image: url("bg.gif");\r
+               }\r
+               div.media {\r
+                       background-color: #fff;\r
+               }\r
+               div.tmb a, div.media a {\r
+/* /2008-11-08 yama*/\r
+                       width : <?php echo $thumb_w ?>px;\r
+                       height : <?php echo $thumb_h ?>px;\r
+                       display : block;\r
+               }\r
+       </style>\r
+       \r
+       <base target="_self" />\r
+               \r
+</head>\r
+<body>\r
+<?php\r
+}\r
+\r
+function media_foot()\r
+{\r
+?>\r
+</body>\r
+</html>\r
+<?php\r
+}\r
+\r
+?>\r
diff --git a/NP_Mediatocu/mediatocu/popups.css b/NP_Mediatocu/mediatocu/popups.css
new file mode 100644 (file)
index 0000000..41c062b
--- /dev/null
@@ -0,0 +1,116 @@
+/*\r
+       media library popup\r
+       \r
+       $Id: popups.css 757 2005-08-12 07:29:40Z dekarma $\r
+       $NucleusJP: popups.css,v 1.4 2007/03/22 09:18:16 kimitake Exp $\r
+*/\r
+\r
+body {\r
+       font-family: verdana, arial;\r
+       font-size: small;\r
+       background-color: #fff;\r
+       color: #000;\r
+}\r
+\r
+img {\r
+       border: none;\r
+}\r
+\r
+a:link, a:visited {\r
+       color: #1D3565; \r
+       font-weight: bold;\r
+       text-decoration: none;\r
+}\r
+a:hover {\r
+       text-decoration: underline;\r
+}\r
+\r
+.heading {\r
+       text-align: center;\r
+       font-size: xx-large;\r
+       font-weight: bold;\r
+       color: gray;    \r
+}\r
+\r
+.heading i {\r
+       position: absolute;\r
+       top: 5px;\r
+       right: 5px;\r
+       font-size: small;\r
+       font-style: normal;\r
+       font-weight: normal;\r
+}\r
+\r
+p {\r
+       text-indent: 20px;\r
+}\r
+\r
+h1 {\r
+       border-bottom: 1px dotted gray;\r
+       font-size: x-large;\r
+       color: #596d9d;\r
+}\r
+\r
+h2 {\r
+       color: gray;\r
+       font-size: large;\r
+       margin-left: 20px;\r
+       text-indent: 10px;\r
+       border-bottom: 1px solid #ddd;\r
+}\r
+\r
+pre, .note, .faq .answer {\r
+       background-color: #ddd;\r
+       padding: 10px;\r
+       font-size: small;\r
+}\r
+\r
+.faq .question {\r
+       font-weight: bold;\r
+       margin-bottom: 0px;\r
+}\r
+\r
+.faq .answer {\r
+\r
+}\r
+\r
+.faq {\r
+       margin-bottom: 20px;\r
+}\r
+\r
+table {\r
+       border: solid 1px #ffffff; border-collapse: collapse;\r
+}\r
+\r
+th {\r
+       background-color: linen;\r
+       font-size: 95%;\r
+       letter-spacing:2px;\r
+}\r
+\r
+th, td {\r
+       padding: 5px;\r
+       border: solid 1px #ffffff;\r
+}\r
+\r
+td {\r
+       background-color: #dddddd;\r
+       font-size: small;\r
+       vertical-align: top;\r
+       text-align: left;\r
+}\r
+\r
+label {\r
+       cursor: pointer;\r
+}\r
+\r
+/*2007-12-27 cacher*/\r
+.box{\r
+       margin:1px;\r
+       padding:2px;\r
+       float:left;display:inline;\r
+       background-color: #dddddd;\r
+}\r
+.clear{\r
+       clear:both;\r
+}
\ No newline at end of file