OSDN Git Service

Modify JavaScript parse error in item edit page when the login user turn it off to...
[nucleus-jp/nucleus-jp-ancient.git] / utf8 / nucleus / libs / PAGEFACTORY.php
index 41235b4..3a2a7eb 100755 (executable)
@@ -1,7 +1,7 @@
 <?php\r
 /*\r
  * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)\r
- * Copyright (C) 2002-2009 The Nucleus Group\r
+ * Copyright (C) 2002-2010 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
@@ -11,7 +11,7 @@
  */\r
 /**\r
  * @license http://nucleuscms.org/license.txt GNU General Public License\r
- * @copyright Copyright (C) 2002-2009 The Nucleus Group\r
+ * @copyright Copyright (C) 2002-2010 The Nucleus Group\r
  * @version $Id$\r
  * $NucleusJP: PAGEFACTORY.php,v 1.8.2.2 2007/10/30 16:12:27 shizuki Exp $\r
  */\r
@@ -267,28 +267,41 @@ class PAGEFACTORY extends BaseActions {
        }\r
 \r
        function parse_contents($which) {\r
+               if (!isset($this->variables[$which])) $this->variables[$which] = '';\r
                echo htmlspecialchars($this->variables[$which],ENT_QUOTES);\r
        }\r
 \r
        function parse_checkedonval($value, $name) {\r
+               if (!isset($this->variables[$name])) $this->variables[$name] = '';\r
                if ($this->variables[$name] == $value)\r
                        echo 'checked="checked"';\r
        }\r
 \r
        // extra javascript for input and textarea fields\r
        function parse_jsinput($which) {\r
-               global $CONF;\r
-               $out = 'name="' . $which . '" id="input' . $which . '"';\r
+               global $CONF, $member;\r
+               \r
+               $attributes  = " name=\"{$which}\"";\r
+               $attributes .= " id=\"input{$which}\"";\r
+               \r
                if ($CONF['DisableJsTools'] != 1) {\r
-                       $out .= 'onkeyup="storeCaret(this); updPreview(' . $which . '); doMonitor();"'\r
-                                 . 'onclick="storeCaret(this);"'\r
-                                 . 'onselect="storeCaret(this);"';\r
-               } elseif ($CONF['DisableJsTools'] == 0) {\r
-                       $out .= ' onkeyup="doMonitor();" onkeypress="shortCuts();"';\r
-               } else {\r
-                       $out .= ' onkeyup="doMonitor();"';\r
+                       $attributes .= ' onclick="storeCaret(this);"';\r
+                       $attributes .= ' onselect="storeCaret(this);"';\r
+                       if ($member->getAutosave()) {\r
+                               $attributes .= " onkeyup=\"storeCaret(this); updPreview('{$which}'); doMonitor();\"";\r
+                       } else {\r
+                               $attributes .= " onkeyup=\"storeCaret(this); updPreview('{$which}');\"";\r
+                       }\r
+               }\r
+               else {\r
+                       if ($CONF['DisableJsTools'] == 0) {\r
+                               $attributes .= ' onkeypress="shortCuts();"';\r
+                       }\r
+                       if ($member->getAutosave()) {\r
+                               $attributes .= ' onkeyup="doMonitor();"';\r
+                       }\r
                }\r
-               echo $out;\r
+               echo $attributes;\r
        }\r
 \r
        // shows the javascript button bar\r
@@ -410,14 +423,15 @@ class PAGEFACTORY extends BaseActions {
         * convenience method\r
         */\r
        function _jsbutton($type, $code ,$tooltip) {\r
-               echo <<<__JSBUTTON__\r
-                       <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="{$code}">\r
-                               <img src="images/button-{$type}.gif" alt="{$tooltip}" width="16" height="16" />\r
+       ?>\r
+                       <span class="jsbutton"\r
+                               onmouseover="BtnHighlight(this);"\r
+                               onmouseout="BtnNormal(this);"\r
+                               onclick="<?php echo $code?>" >\r
+                               <img src="images/button-<?php echo $type?>.gif" alt="<?php echo $tooltip?>" title="<?php echo $tooltip?>" width="16" height="16"/>\r
                        </span>\r
-\r
-__JSBUTTON__;\r
-       }\r
-\r
+       <?php   }\r
+       \r
        function _jsbuttonspacer() {\r
                echo '<span class="jsbuttonspacer">&nbsp;</span>';\r
        }\r