OSDN Git Service

とりあえず NP_znSpecialTemplateParts.php 対応版
authorshizuki <shizuki@1ca29b6e-896d-4ea0-84a5-967f57386b96>
Tue, 1 Jul 2008 10:13:39 +0000 (10:13 +0000)
committershizuki <shizuki@1ca29b6e-896d-4ea0-84a5-967f57386b96>
Tue, 1 Jul 2008 10:13:39 +0000 (10:13 +0000)
git-svn-id: https://svn.sourceforge.jp/svnroot/nucleus-jp/plugin@635 1ca29b6e-896d-4ea0-84a5-967f57386b96

trunk/NP_EzComment2/NP_EzComment2.php
trunk/NP_EzComment2/npezcomment2/skinbackup.xml

index 9394d99..3b16d55 100644 (file)
@@ -76,69 +76,6 @@ class NP_EzComment2 extends NucleusPlugin
                }
        }
 
-       function getEventList()
-       {
-               return array('AdminPrePageFoot','AdminPrePageHead');
-       }
-
-       function event_AdminPrePageHead($data)
-       {
-               if ($data['action'] != 'templateedit' && $data['action'] != 'templateupdate') return;
-//             if ($data['action'] == 'templateedit') {
-                       $templateId   = intRequestVar('templateid');
-                       $tempalteName = TEMPLATE::getNameFromId($templateId);
-                       $tempalteDesc = TEMPLATE::getDesc($templateId);
-                       if (strpos(strtolower($tempalteName), 'ezcommentform') === false &&
-                               strpos(strtolower($tempalteDesc), 'ezcommentform') === false) {
-                                       return;
-                       }
-//             }
-               $data['extrahead'] .= '<script type="text/javascript" src="' . $this->getAdminURL() . 'jquery-1.2.1.pack.js">'
-                                                       . '</script>'
-                                                       . '<script type="text/javascript" src="' . $this->getAdminURL() . 'jquery.cookie.js">'
-                                                       . '</script>';
-       }
-
-       function event_AdminPrePageFoot($data)
-       {
-               if ($data['action'] != 'templateedit' && $data['action'] != 'templateupdate') return;
-//             if ($data['action'] == 'templateedit') {
-                       $templateId   = intRequestVar('templateid');
-                       $tempalteName = TEMPLATE::getNameFromId($templateId);
-                       $tempalteDesc = TEMPLATE::getDesc($templateId);
-                       if (strpos(strtolower($tempalteName), 'ezcommentform') === false &&
-                               strpos(strtolower($tempalteDesc), 'ezcommentform') === false) {
-                                       return;
-                       }
-//             }
-               $title       = _NP_EZCOMMENT2_FORM_TEMPLATES;
-               $loggedin    = _NP_EZCOMMENT2_FORM_LOGGEDIN;
-               $notLoggedin = _NP_EZCOMMENT2_FORM_NOTLOGGEDIN;
-               echo <<<___SCRIPT___
-
-<script type="text/javascript">
-$('table').ready(function(){
-       var row = $('tr').get();
-       var title = $(row[5]).children();
-       title.text('{$title}');
-       for (var i=6;i<row.length-2;i++) {
-               var tcol = $(row[i]).children();
-               var txta = $(tcol[1]).children();
-               if ($(txta[0]).attr('name') == 'ITEM') {
-                       $(tcol[0]).text('{$loggedin}');
-                       $(txta[0]).attr('rows', '15')
-               } else if ($(txta[0]).attr('name') == 'COMMENTS_BODY') {
-                       $(tcol[0]).text('{$notLoggedin}');
-                       $(txta[0]).attr('rows', '15')
-               } else {
-                       $(row[i]).remove();
-               }
-       }
-});
-</script>
-
-___SCRIPT___;
-       }
 
        function doTemplateVar(&$item,
                                                        $showType       = '',
@@ -263,11 +200,11 @@ ___SCRIPT___;
                        'rememberchecked' => $checked
                );
                if ($member && $member->isLoggedIn()) {
-                       $formType = 'ITEM';
+                       $formType = 'COMMENT_FORM_LOGGEDIN';
                        $loginMember = $member->createFromID($member->getID());
                        $formdata['membername'] = $this->_hsc($loginMember->getDisplayName());
                } else {
-                       $formType = 'COMMENTS_BODY';
+                       $formType = 'COMMENT_FORM_NOTLOGGEDIN';
                }
                $contents   = $template[$formType];
                $formAction =& new EzCommentFormActions($commentItem, $formdata, $loginMember);
@@ -352,6 +289,15 @@ ___SCRIPT___;
        }
 // LIST END -----------------------------------------
 
+       function getTemplateParts()
+       {
+               $this->languageInclude();
+               return array(
+                       'COMMENT_FORM_LOGGEDIN'    => _NP_EZCOMMENT2_FORM_LOGGEDIN, 
+                       'COMMENT_FORM_NOTLOGGEDIN' => _NP_EZCOMMENT2_FORM_NOTLOGGEDIN, 
+               );
+       }
+
        function _hsc($str)
        {
                return htmlspecialchars($str, ENT_QUOTES, _CHARSET);
index 332b3fd..bae4b61 100644 (file)
@@ -1,13 +1,12 @@
 <nucleusskin>
        <meta>
-               <template name="EzCommentListDefault" />
-               <template name="EzCommentFormDefault" />
+               <template name="EzCommentTemplateDefault" />
                <info><![CDATA[Comment form template for NP_EzComment2]]></info>
        </meta>
 
 
-       <template name="EzCommentListDefault">
-               <description>EzCommentList_Default</description>
+       <template name="EzCommentTemplateDefault">
+               <description>EzCommentTemplateDefault</description>
                <part name="COMMENTS_BODY"><![CDATA[<li><a href="<%itemlink%>#c<%commentid%>"><%user(realname)%> : <%excerpt%></a></li>
 ]]></part>
 
 
                <part name="COMMENTS_ONE"><![CDATA[Comment]]></part>
 
-       </template>
-
-
-       <template name="EzCommentFormDefault">
-               <description>EzCommentForm_Default</description>
-               <part name="TEXT"><![CDATA[<a id="nucleus_cf"></a>
+               <part name="COMMENT_FORM_LOGGEDIN"><![CDATA[<a id="nucleus_cf"></a>
 <form method="post" action="#nucleus_cf">
        <div class="commentform">
 <input type="hidden" name="action" value="addcomment" />
-<input type="hidden" name="url" value="<%formdata(destinationurl)%>" />
-<input type="hidden" name="itemid" value="<%itemid%>" />
-               <%errordiv%>
+<input type="hidden" name="url" value="<formdata(destinationurl)%>" />
+<input type="hidden" name="itemid" value="<itemid()%>" />
+               <%errordiv()%>
                <label for="nucleus_cf_body"><%text(_COMMENTFORM_COMMENT)%></label>
                <textarea name="body" class="formfield" cols="40" rows="10" id="nucleus_cf_body"><%formdata(body)%></textarea>
-
                <%text(_COMMENTFORM_YOUARE)%> <%formdata(membername)%>
-               <small>(<a href="<%self%>?action=logout" title="<%text(_LOGOUT)%>"><%text(_LOGOUT)%></a>)</small>
-
+               <small>(<a href="<%self()%>?action=logout" title="<%text(_LOGOUT)%>"><%text(_LOGOUT)%></a>)</small>
                <input type="submit" alt="<%text(_COMMENTFORM_SUBMIT)%>" value="<%text(_COMMENTFORM_SUBMIT)%>" class="formbutton" />
-
                <%callback(FormExtra,commentform-loggedin)%>
        </div>
-</form>
-]]></part>
+</form>]]></part>
+
 
-               <part name="COMMENTS_BODY"><![CDATA[<a id="nucleus_cf"></a>
+               <part name="COMMENT_FORM_NOTLOGGEDIN"><![CDATA[<a id="nucleus_cf"></a>
 <form method="post" action="#nucleus_cf">
        <div class="commentform">
 <input type="hidden" name="action" value="addcomment" />
 <input type="hidden" name="url" value="<%formdata(destinationurl)%>" />
-<input type="hidden" name="itemid" value="<%itemid%>" />
-               <%errordiv%>
-
+<input type="hidden" name="itemid" value="<%itemid()%>" />             <%errordiv()%>
                <label for="nucleus_cf_body"><%text(_COMMENTFORM_COMMENT)%></label>
                <textarea name="body" class="formfield" cols="40" rows="10" id="nucleus_cf_body"><%formdata(body)%></textarea>
-
                <label for="nucleus_cf_name"><%text(_COMMENTFORM_NAME)%></label>
                <input name="user" size="40" maxlength="40" value="<%formdata(user)%>" class="formfield" id="nucleus_cf_name" />
-
                <label for="nucleus_cf_mail"><%text(_COMMENTFORM_MAIL)%></label>
                <input name="userid" size="40" maxlength="60" value="<%formdata(userid)%>" class="formfield" id="nucleus_cf_mail" />
-
                <label for="nucleus_cf_email"><%text(_COMMENTFORM_EMAIL)%></label>
                <input name="email" size="40" maxlength="100" value="<%formdata(email)%>" class="formfield" id="nucleus_cf_email" />
-
                <%callback(FormExtra,commentform-notloggedin)%>
-
                <input type="checkbox" value="1" name="remember" id="nucleus_cf_remember" <%formdata(rememberchecked)%> />
                <label for="nucleus_cf_remember"><%text(_COMMENTFORM_REMEMBER)%></label>
-
                <input type="submit" alt="<%text(_COMMENTFORM_SUBMIT)%>" value="<%text(_COMMENTFORM_SUBMIT)%>" class="formbutton" />
        </div>
-</form>
-]]></part>
+</form>]]></part>
+
+               <part name="STP_PLUGINNAME"><![CDATA[NP_EzComment2]]></part>
 
        </template>