From 43791f1a018fe320dd5180ec9d52899fd0770364 Mon Sep 17 00:00:00 2001 From: YuCheng Hu Date: Sat, 12 Jun 2010 18:50:45 +0000 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=88=B0=20trunk?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit +YUCHENG HU+ git-svn-id: https://svn.code.sf.net/p/hawebs/svn@160 a2543c7e-f6e9-4f8a-8bff-1ffc34733512 --- .../plugins/editors-xtd/add_attachment.css | 2 + .../plugins/editors-xtd/add_attachment.php | 131 ++++++++++++++++++ .../plugins/editors-xtd/add_attachment.png | Bin 0 -> 1253 bytes .../plugins/editors-xtd/add_attachment.xml | 20 +++ .../trunk/plugins/editors-xtd/image.php | 97 +++++++++++++ .../trunk/plugins/editors-xtd/image.xml | 16 +++ .../trunk/plugins/editors-xtd/index.html | 1 + .../trunk/plugins/editors-xtd/pagebreak.php | 68 +++++++++ .../trunk/plugins/editors-xtd/pagebreak.xml | 16 +++ .../trunk/plugins/editors-xtd/readmore.php | 83 +++++++++++ .../trunk/plugins/editors-xtd/readmore.xml | 16 +++ 11 files changed, 450 insertions(+) create mode 100644 oss/joomla/trunk/plugins/editors-xtd/add_attachment.css create mode 100644 oss/joomla/trunk/plugins/editors-xtd/add_attachment.php create mode 100644 oss/joomla/trunk/plugins/editors-xtd/add_attachment.png create mode 100644 oss/joomla/trunk/plugins/editors-xtd/add_attachment.xml create mode 100644 oss/joomla/trunk/plugins/editors-xtd/image.php create mode 100644 oss/joomla/trunk/plugins/editors-xtd/image.xml create mode 100644 oss/joomla/trunk/plugins/editors-xtd/index.html create mode 100644 oss/joomla/trunk/plugins/editors-xtd/pagebreak.php create mode 100644 oss/joomla/trunk/plugins/editors-xtd/pagebreak.xml create mode 100644 oss/joomla/trunk/plugins/editors-xtd/readmore.php create mode 100644 oss/joomla/trunk/plugins/editors-xtd/readmore.xml diff --git a/oss/joomla/trunk/plugins/editors-xtd/add_attachment.css b/oss/joomla/trunk/plugins/editors-xtd/add_attachment.css new file mode 100644 index 00000000..53a8f611 --- /dev/null +++ b/oss/joomla/trunk/plugins/editors-xtd/add_attachment.css @@ -0,0 +1,2 @@ +.button2-left .add_attachment { + background: url(../../plugins/editors-xtd/add_attachment.png) 100% 0 no-repeat; } diff --git a/oss/joomla/trunk/plugins/editors-xtd/add_attachment.php b/oss/joomla/trunk/plugins/editors-xtd/add_attachment.php new file mode 100644 index 00000000..d0cf04c9 --- /dev/null +++ b/oss/joomla/trunk/plugins/editors-xtd/add_attachment.php @@ -0,0 +1,131 @@ + 0 ) { + $id = intval($cid[0]); + } + if ( $id == 0) { + $nid = JRequest::getVar( 'id', null); + if ( !is_null($nid) ) { + $id = intval($nid); + } + } + + // Create the button object + $button = new JObject(); + + // Load the language file from the backend + $lang = & JFactory::getLanguage(); + $lang->load('plg_frontend_attachments', JPATH_ADMINISTRATOR); + + // ??? Where is the tooltip coming from? + // (Would like to use different tip for create article button) + + // Figure out where we are and construct the right link and set + // up the style sheet (to get the visual for the button working) + global $mainframe; + $doc =& JFactory::getDocument(); + if ( $mainframe->isAdmin() ) { + if ( $id == 0 ) { + // New article, explain that we can't add attachments until it is saved + + // Load the language file from the frontend + $lang = & JFactory::getLanguage(); + $lang->load('com_attachments', JPATH_SITE); + + // Save the warning message for the pop-up window + require_once(JPATH_BASE.DS.'..'.DS.'components'.DS.'com_attachments'.DS.'helper.php'); + $msg = JText::_('SAVE ARTICLE BEFORE ATTACHING')." ".JText::_('TRY APPLY BUTTON FIRST'); + AttachmentsHelper::save_warning_message($msg); + + $button->set('options', "{handler: 'iframe', size: {x: 400, y: 300}}"); + $link = "index.php?option=com_attachments&task=warning&tmpl=component"; + } + else { + $button->set('options', "{handler: 'iframe', size: {x: 800, y: 530}}"); + $link = "index.php?option=com_attachments&task=add&article_id=$id&from=closeme"; + } + $doc->addStyleSheet( $mainframe->getSiteURL() . 'plugins/editors-xtd/add_attachment.css', + 'text/css', null, array() ); + } + else { + if ( $id == 0 ) { + // Load the language file from the frontend + $lang = & JFactory::getLanguage(); + $lang->load('com_attachments', JPATH_SITE); + + // Save the warning message for the pop-up window + require_once(JPATH_BASE.DS.'components'.DS.'com_attachments'.DS.'helper.php'); + $msg = JText::_('SAVE ARTICLE BEFORE ATTACHING'); + AttachmentsHelper::save_warning_message($msg); + + // New article, explain we can't add attachments until it is saved + $button->set('options', "{handler: 'iframe', size: {x: 400, y: 300}}"); + $link = "index.php?option=com_attachments&task=warning&tmpl=component"; + } + else { + $button->set('options', "{handler: 'iframe', size: {x: 700, y: 530}}"); + $link = "index.php?option=com_attachments&task=upload&artid=$id&from=closeme"; + } + $doc->addStyleSheet( JURI::Base() . 'plugins/editors-xtd/add_attachment.css', + 'text/css', null, array() ); + } + + $button->set('modal', true); + $button->set('class', 'modal'); + $button->set('text', JText::_('ADD ATTACHMENT')); + $button->set('name', 'add_attachment'); + $button->set('link', $link); + $button->set('image', 'add_attachment.png'); + + return $button; + } +} +?> diff --git a/oss/joomla/trunk/plugins/editors-xtd/add_attachment.png b/oss/joomla/trunk/plugins/editors-xtd/add_attachment.png new file mode 100644 index 0000000000000000000000000000000000000000..52d4cc8e43697a299ae3475979810f15d48e9ae3 GIT binary patch literal 1253 zcmeAS@N?(olHy`uVBq!ia0vp^Vj#@H3?x5i&EW)6oCO|{#S9GGLLkg|>2BR0pdd@S zqpu?a!^Xav-+_~Xe1&9>AYTTCDpdxChGqtapZ|gMO9qBg0|tgy2@DKYGZ+}e^C!h0 zbz@*)W(e>JaRuu6|NsBDZ$I9@|M2tY&mTX2eEiZd|{9{o1u_mo8npc=6(e3m49xKY#ArxwB`_o;h=7=gyr?O--7bnkp(P%F4=e za&oe=vMektK$igBGYUpSfNmjh%*Wv^&@zLPAirQ>@*@Q>BrUyA!N9;M?CIhdQgJKh zqGR?U2Z6SS~(X#_R=x?qNUwuLuTVo$7*>G z`#HYZ8x{WZy`1*zmoA`aAd8s>6}J9UUs~jh64bwIx}6 z{_4XkW*G@yOjz)YV?)}*gG*SJ-|5Kxc%Z1R&|{IrMCEQvfjqlD3Bj + + Editor Button - AddAttachment + Jonathan M. Cameron + August 17, 2008 + (C) 2007, 2008 Jonathan M. Cameron. All rights reserved. + http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL + jmcameron@jmcameron.net + http://joomlacode.org/gf/project/attachments/ + 1.3.4 + ADD ATTACHMENT BUTTON PLUGIN INSTALLED + + en-GB.plg_editors-xtd_add_attachment.ini + + + add_attachment.php + add_attachment.png + add_attachment.css + + diff --git a/oss/joomla/trunk/plugins/editors-xtd/image.php b/oss/joomla/trunk/plugins/editors-xtd/image.php new file mode 100644 index 00000000..878f84f0 --- /dev/null +++ b/oss/joomla/trunk/plugins/editors-xtd/image.php @@ -0,0 +1,97 @@ +get('allowed_media_usergroup')) + { + case '1': + $acl->addACL( 'com_media', 'upload', 'users', 'publisher' ); + break; + case '2': + $acl->addACL( 'com_media', 'upload', 'users', 'publisher' ); + $acl->addACL( 'com_media', 'upload', 'users', 'editor' ); + break; + case '3': + $acl->addACL( 'com_media', 'upload', 'users', 'publisher' ); + $acl->addACL( 'com_media', 'upload', 'users', 'editor' ); + $acl->addACL( 'com_media', 'upload', 'users', 'author' ); + break; + case '4': + $acl->addACL( 'com_media', 'upload', 'users', 'publisher' ); + $acl->addACL( 'com_media', 'upload', 'users', 'editor' ); + $acl->addACL( 'com_media', 'upload', 'users', 'author' ); + $acl->addACL( 'com_media', 'upload', 'users', 'registered' ); + break; + } + + //Make sure the user is authorized to view this page + $user = & JFactory::getUser(); + if (!$user->authorize( 'com_media', 'popup' )) { + return; + } + $doc =& JFactory::getDocument(); + $template = $mainframe->getTemplate(); + + $link = 'index.php?option=com_media&view=images&tmpl=component&e_name='.$name; + + JHTML::_('behavior.modal'); + + $button = new JObject(); + $button->set('modal', true); + $button->set('link', $link); + $button->set('text', JText::_('Image')); + $button->set('name', 'image'); + $button->set('options', "{handler: 'iframe', size: {x: 570, y: 400}}"); + + return $button; + } +} diff --git a/oss/joomla/trunk/plugins/editors-xtd/image.xml b/oss/joomla/trunk/plugins/editors-xtd/image.xml new file mode 100644 index 00000000..15083621 --- /dev/null +++ b/oss/joomla/trunk/plugins/editors-xtd/image.xml @@ -0,0 +1,16 @@ + + + Button - Image + Joomla! Project + August 2004 + Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. + http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL + admin@joomla.org + www.joomla.org + 1.0.0 + DESCIMAGE + + image.php + + + \ No newline at end of file diff --git a/oss/joomla/trunk/plugins/editors-xtd/index.html b/oss/joomla/trunk/plugins/editors-xtd/index.html new file mode 100644 index 00000000..fa6d84e8 --- /dev/null +++ b/oss/joomla/trunk/plugins/editors-xtd/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/oss/joomla/trunk/plugins/editors-xtd/pagebreak.php b/oss/joomla/trunk/plugins/editors-xtd/pagebreak.php new file mode 100644 index 00000000..db7aa7af --- /dev/null +++ b/oss/joomla/trunk/plugins/editors-xtd/pagebreak.php @@ -0,0 +1,68 @@ +getTemplate(); + + $link = 'index.php?option=com_content&task=ins_pagebreak&tmpl=component&e_name='.$name; + + JHTML::_('behavior.modal'); + + $button = new JObject(); + $button->set('modal', true); + $button->set('link', $link); + $button->set('text', JText::_('Pagebreak')); + $button->set('name', 'pagebreak'); + $button->set('options', "{handler: 'iframe', size: {x: 400, y: 85}}"); + + return $button; + } +} \ No newline at end of file diff --git a/oss/joomla/trunk/plugins/editors-xtd/pagebreak.xml b/oss/joomla/trunk/plugins/editors-xtd/pagebreak.xml new file mode 100644 index 00000000..7981f147 --- /dev/null +++ b/oss/joomla/trunk/plugins/editors-xtd/pagebreak.xml @@ -0,0 +1,16 @@ + + + Button - Pagebreak + Joomla! Project + August 2004 + Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. + http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL + admin@joomla.org + www.joomla.org + 1.5 + DESCPAGEBREAK + + pagebreak.php + + + diff --git a/oss/joomla/trunk/plugins/editors-xtd/readmore.php b/oss/joomla/trunk/plugins/editors-xtd/readmore.php new file mode 100644 index 00000000..4c4936dc --- /dev/null +++ b/oss/joomla/trunk/plugins/editors-xtd/readmore.php @@ -0,0 +1,83 @@ +getTemplate(); + + // button is not active in specific content components + + $getContent = $this->_subject->getContent($name); + $present = JText::_('ALREADY EXISTS', true) ; + $js = " + function insertReadmore(editor) { + var content = $getContent + if (content.match(//i)) { + alert('$present'); + return false; + } else { + jInsertEditorText('
', editor); + } + } + "; + + $doc->addScriptDeclaration($js); + + $button = new JObject(); + $button->set('modal', false); + $button->set('onclick', 'insertReadmore(\''.$name.'\');return false;'); + $button->set('text', JText::_('Readmore')); + $button->set('name', 'readmore'); + // TODO: The button writer needs to take into account the javascript directive + //$button->set('link', 'javascript:void(0)'); + $button->set('link', '#'); + + return $button; + } +} \ No newline at end of file diff --git a/oss/joomla/trunk/plugins/editors-xtd/readmore.xml b/oss/joomla/trunk/plugins/editors-xtd/readmore.xml new file mode 100644 index 00000000..25f405c4 --- /dev/null +++ b/oss/joomla/trunk/plugins/editors-xtd/readmore.xml @@ -0,0 +1,16 @@ + + + Button - Readmore + Joomla! Project + March 2006 + Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. + http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL + admin@joomla.org + www.joomla.org + 1.5 + DESCREADMORE + + readmore.php + + +