From c817f22b3c6a46e0c3c92ad099842a9c2b670ff0 Mon Sep 17 00:00:00 2001 From: kmorimatsu Date: Sun, 24 Feb 2008 05:44:57 +0000 Subject: [PATCH] Ver 0.5.9.2 git-svn-id: https://svn.sourceforge.jp/svnroot/nucleus-jp/plugin@609 1ca29b6e-896d-4ea0-84a5-967f57386b96 --- trunk/NP_MitasNom/NP_MitasNom.php | 532 +++++++++++++++++++++ trunk/NP_MitasNom/mitasnom/config.php | 64 +++ .../editor/dialog/common/fck_dialog_common.js | 176 +++++++ .../mitasnom/editor/plugins/nucleus/Thumbs.db | Bin 0 -> 3584 bytes .../mitasnom/editor/plugins/nucleus/fckplugin.js | 26 + .../mitasnom/editor/plugins/nucleus/nucleus.gif | Bin 0 -> 1180 bytes trunk/NP_MitasNom/mitasnom/fckclass.php | 39 ++ trunk/NP_MitasNom/mitasnom/fckconfig.js | 191 ++++++++ trunk/NP_MitasNom/mitasnom/fckeditor.js | 192 ++++++++ trunk/NP_MitasNom/mitasnom/fckeditor.php | 162 +++++++ trunk/NP_MitasNom/mitasnom/fckstyles.xml | 47 ++ trunk/NP_MitasNom/mitasnom/fcktemplates.xml | 78 +++ trunk/NP_MitasNom/mitasnom/index.php | 1 + .../NP_MitasNom/mitasnom/language/japanese-euc.php | 26 + .../mitasnom/language/japanese-utf8.php | 26 + trunk/NP_MitasNom/mitasnom/popup.php | 48 ++ 16 files changed, 1608 insertions(+) create mode 100644 trunk/NP_MitasNom/NP_MitasNom.php create mode 100644 trunk/NP_MitasNom/mitasnom/config.php create mode 100644 trunk/NP_MitasNom/mitasnom/editor/dialog/common/fck_dialog_common.js create mode 100644 trunk/NP_MitasNom/mitasnom/editor/plugins/nucleus/Thumbs.db create mode 100644 trunk/NP_MitasNom/mitasnom/editor/plugins/nucleus/fckplugin.js create mode 100644 trunk/NP_MitasNom/mitasnom/editor/plugins/nucleus/nucleus.gif create mode 100644 trunk/NP_MitasNom/mitasnom/fckclass.php create mode 100644 trunk/NP_MitasNom/mitasnom/fckconfig.js create mode 100644 trunk/NP_MitasNom/mitasnom/fckeditor.js create mode 100644 trunk/NP_MitasNom/mitasnom/fckeditor.php create mode 100644 trunk/NP_MitasNom/mitasnom/fckstyles.xml create mode 100644 trunk/NP_MitasNom/mitasnom/fcktemplates.xml create mode 100644 trunk/NP_MitasNom/mitasnom/index.php create mode 100644 trunk/NP_MitasNom/mitasnom/language/japanese-euc.php create mode 100644 trunk/NP_MitasNom/mitasnom/language/japanese-utf8.php create mode 100644 trunk/NP_MitasNom/mitasnom/popup.php diff --git a/trunk/NP_MitasNom/NP_MitasNom.php b/trunk/NP_MitasNom/NP_MitasNom.php new file mode 100644 index 0000000..f158c69 --- /dev/null +++ b/trunk/NP_MitasNom/NP_MitasNom.php @@ -0,0 +1,532 @@ +_checkVersion(); + return 'NP_MitasNom'; + } + function getMinNucleusVersion() { return 220; } + function getAuthor() { return 'Katsumi'; } + function getVersion() { return '0.5.9.2'; } + function getURL() {return 'http://japan.nucleuscms.org/wiki/plugins:mitasnom';} + function getDescription() { return $this->translated('WYSIWYG HTML editor plagin using FCKeditor'); } + function supportsFeature($what) { return (int)($what=='SqlTablePrefix'); } + function install() { + // Install, upgrade options, and Refresh member options. + // Note: createOption() is overrided (see below). + $this->createOption('version','version','text',$this->getVersion(),'access=hidden'); + $this->createOption('width',$this->translated('Width'),'text','100%'); + $this->createOption('height',$this->translated('Height'),'text','400'); + $this->createOption('toolbar',$this->translated('Toolbar'),'select','Default','Default|Default|Full|Full|Basic|Basic|Custom|Custom'); + $this->createOption('toolbar_custom',$this->translated('Custom Toolbar'), 'textarea', + "['Source','DocProps','-','Save','NewPage','Preview','-','Templates'],\n". + "['Cut','Copy','Paste','PasteText','PasteWord','-','Print','SpellCheck'],\n". + "['Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'],\n". + "['Bold','Italic','Underline','StrikeThrough','-','Subscript','Superscript'],\n". + "['OrderedList','UnorderedList','-','Outdent','Indent'],\n". + "['JustifyLeft','JustifyCenter','JustifyRight','JustifyFull'],\n". + "['Link','Unlink','Anchor'],\n". + "['Image','Flash','Table','Rule','Smiley','SpecialChar','PageBreak','UniversalKey'],\n". + "['Form','Checkbox','Radio','TextField','Textarea','Select','Button','ImageButton','HiddenField'],'/',\n". + "['Style','FontFormat','FontName','FontSize'],\n". + "['TextColor','BGColor'],\n". + "['About']"); + $this->createOption('addremovetoolbar',$this->translated('Add new toolbar to the menu / Delete toolbar from the menu'),'text',''); + $this->createOption('returnafterbr',$this->translated('"
" => "
\n" conversion?'),'yesno','yes'); + $this->createOption('returnafterbrbr',$this->translated('"

" => "
\n
\n" conversion?'),'yesno','no'); + $this->createOption('dialogwidth',$this->translated('Width of Popup dialog'),'text','500'); + $this->createOption('dialogheight',$this->translated('Height of Popup dialog'),'text','450'); + $this->createOption('protectedsource',$this->translated('Protected Sources'), 'textarea', + '//gi'."\n". + '/<%[\s\S]*?%>/g'); + //$this->createOption('additionalpsource',$this->translated('Additional Protected Sources'), 'textarea',''); + $this->createOption('usemembersettings',$this->translated('Use member-specific settings?'),'yesno','no'); + $this->createOption('useimagemanager',$this->translated('Use Image-Manager plugin instead of media.php?'),'yesno','no'); + $this->createOption('usehttps',$this->translated('Use secure server (https) for edititing item?'),'yesno','no'); + $this->createOption('usep',$this->translated('Use P tag instead of BR for enter key (IE only)?'),'yesno','no'); + } + function getEventList() { return array('EditItemFormExtras','AddItemFormExtras','PrepareItemForEdit', + 'PreAddItem','PreUpdateItem', + 'PreItem','PostPluginOptionsUpdate','PrePluginOptionsEdit'); } + + // SkinVar is currently used for showing link to create item + function doSkinVar($skinType,$type,$text='') { + global $blogid,$CONF,$member; + switch (strtolower($type)) { + case 'newitem': + default: + if (!$member->isLoggedIn()) return; + if (!$text) $text=$this->translated('New Item with WYSIWYG'); + $url=$CONF['ActionURL'].'?action=plugin&name=MitasNom&type=createitem&blogid='.$blogid; + $url=htmlspecialchars($url); + if ($this->getOption('usehttps')=='yes') $url=preg_replace('/^http:/','https:',$url); + echo "$text\n"; + break; + } + } + + // TemplateVar is currently used for showing link to edit item + function doTemplateVar(&$item,$type,$text='') { + global $CONF,$member; + switch (strtolower($type)) { + case 'edititem': + default: + if (!$text) $text=$text=$this->translated('Edit Item with WYSIWYG'); + $itemid=$item->itemid; + $url=htmlspecialchars($url); + if ($this->getOption('usehttps')=='yes') $url=preg_replace('/^http:/','https:',$url); + $url=$CONF['ActionURL'].'?action=plugin&name=MitasNom&type=itemedit&itemid='.$itemid; + echo "$text\n"; + break; + } + } + + // Action is used to show item-editing/newitem-creating window. + function doAction($type){ + global $DIR_LIBS,$member,$manager,$CONF,$blogid,$itemid; + if (!$member->isLoggedIn()) return _NOTLOGGEDIN; + if (!strstr('createitem itemedit',$type)) return _BADACTION; + + // Resolve itemid and blogid + if (!$blogid && $itemid) $blogid=getBlogIDFromItemID($itemid); + if (!$blogid) return _BADACTION; + if (!$member->teamRights($blogid)) return _ERROR_DISALLOWED; + $blog=&$manager->getBlog($blogid); + $convBreaks=false; + if ($blog) if ($blog->convertBreaks()) $convBreaks=true; + + // Get editing HTML + $this->actionplugin=true; + include($DIR_LIBS . 'ADMIN.php'); + $a=new ADMIN(); + switch ($type) { + case 'createitem': + ob_start(); + $a->action_createitem(); + $buff=ob_get_contents(); + ob_end_clean(); + break; + case 'itemedit': + ob_start(); + $a->action_itemedit(); + $buff=ob_get_contents(); + ob_end_clean(); + break; + default: + return _BADACTION; + } + + // Return if not valid editing HTML + // These codes must be changed when non-compatible Nucleus version comes out. + if (!preg_match('//',$buff)) return _ERRORMSG; + if (!preg_match('/
/',$buff)) return _ERRORMSG; + if (!preg_match('/]*)inputbody([^>]*)>([^>]*)<\/textarea>/',$buff)) return _ERRORMSG; + if (!preg_match('/]*)inputmore([^>]*)>([^>]*)<\/textarea>/',$buff)) return _ERRORMSG; + + // Create NucleusFCKeditor instances + if (!class_exists('NucleusFCKeditor')) include ($this->getDirectory().'fckclass.php'); + $body=''; + $more=''; + if ($type=='itemedit') { + if (preg_match ('/]*)inputbody([^>]*)>([^>]*)<\/textarea>/',$buff,$matches)) + $body=$matches[3]; + $body=$this->unhtmlentities($body); + if (preg_match ('/]*)inputmore([^>]*)>([^>]*)<\/textarea>/',$buff,$matches)) + $more=$matches[3]; + $more=$this->unhtmlentities($more); + } + if ($convBreaks) { + $body=addBreaks($body); + $more=addBreaks($more); + } + $FCKedit1=new NucleusFCKEditor('body',$this,$body); + $FCKedit2=new NucleusFCKEditor('more',$this,$more); + $buff1=$FCKedit1->CreateHtml(); + $buff2=$FCKedit2->CreateHtml(); + + // Replace texts of editing page + // These codes must be changed when non-compatible Nucleus version comes out. + $buff=preg_replace ('//','', $buff,1); + $buff=preg_replace ('/
/','