Fixed broken javascript magic on Admin:PageGroups
authorDan
Fri, 05 Jun 2009 22:09:42 -0400
changeset 1021 5990ac411f34
parent 1020 0867b9d38c38
child 1022 06debbf8dd75
child 1023 5a282dbf8fad
Fixed broken javascript magic on Admin:PageGroups
install/includes/cli-core.php
plugins/admin/PageGroups.php
--- a/install/includes/cli-core.php	Tue Jun 02 13:27:05 2009 -0400
+++ b/install/includes/cli-core.php	Fri Jun 05 22:09:42 2009 -0400
@@ -782,9 +782,16 @@
 
 function parse_shellcolor_string($str)
 {
+  // only compute this once (saves some CPU time)
+  static $do_colors = null;
+  if ( $do_colors === null )
+  {
+    $do_colors = ( isset($_SERVER['TERM']) && $_SERVER['TERM'] != 'dumb' );
+  }
+  
   $expr = '/<c ((?:[0-9]+)(?:;[0-9]+)*)>([\w\W]*?)<\/c>/';
   while ( preg_match($expr, $str) )
-    $str = preg_replace($expr, "\x1B[\\1m\\2\x1B[0m", $str);
+    $str = $do_colors ? preg_replace($expr, "\x1B[\\1m\\2\x1B[0m", $str) : preg_replace($expr, "\\2", $str);
   
   return $str;
 }
--- a/plugins/admin/PageGroups.php	Tue Jun 02 13:27:05 2009 -0400
+++ b/plugins/admin/PageGroups.php	Fri Jun 05 22:09:42 2009 -0400
@@ -384,11 +384,11 @@
             
       echo '  <td class="row1">
                 <div id="pg_create_normal_2" />
-                  <input type="text" style="margin-top: 3px;" name="member_page_0" id="pg_create_member_0" onkeyup="return ajaxPageNameComplete(this);" size="30" /><br />
-                  <input type="text" style="margin-top: 3px;" name="member_page_1" id="pg_create_member_1" onkeyup="return ajaxPageNameComplete(this);" size="30" /><br />
-                  <input type="text" style="margin-top: 3px;" name="member_page_2" id="pg_create_member_2" onkeyup="return ajaxPageNameComplete(this);" size="30" /><br />
-                  <input type="text" style="margin-top: 3px;" name="member_page_3" id="pg_create_member_3" onkeyup="return ajaxPageNameComplete(this);" size="30" /><br />
-                  <input type="text" style="margin-top: 3px;" name="member_page_4" id="pg_create_member_4" onkeyup="return ajaxPageNameComplete(this);" size="30" /><br />
+                  <input type="text" style="margin-top: 3px;" name="member_page_0" id="pg_create_member_0" class="autofill page" size="30" /><br />
+                  <input type="text" style="margin-top: 3px;" name="member_page_1" id="pg_create_member_1" class="autofill page" size="30" /><br />
+                  <input type="text" style="margin-top: 3px;" name="member_page_2" id="pg_create_member_2" class="autofill page" size="30" /><br />
+                  <input type="text" style="margin-top: 3px;" name="member_page_3" id="pg_create_member_3" class="autofill page" size="30" /><br />
+                  <input type="text" style="margin-top: 3px;" name="member_page_4" id="pg_create_member_4" class="autofill page" size="30" /><br />
                   <input type="button" onclick="pg_create_more_fields(); return false;" style="margin-top: 5px;" value="&nbsp;&nbsp;+&nbsp;&nbsp;" />
                 </div>
                 <div id="pg_create_tagged_2">
@@ -780,11 +780,12 @@
             var __ol_pg_edit_setup = function()
             {
               var input = document.getElementById('inptext_pg_add_member');
-              input.onkeyup = function(e) { ajaxPageNameComplete(this); };
-              <?php
-              // stupid jEdit hack
-              echo "input.onkeypress = function(e) { if ( e.keyCode == 13 ) { setTimeout('__pg_edit_ajaxadd(document.getElementById(\'' + this.id + '\'));', 500); } };";
-              ?>
+              input.onkeypress = function(e) {
+                  if ( e.keyCode == 13 )
+                  {
+                    setTimeout('__pg_edit_ajaxadd(document.getElementById(\'' + this.id + '\'));', 500);
+                  } 
+                };
             }
             addOnloadHook(__ol_pg_edit_setup);
             var __pg_edit_objcache = false;
@@ -803,7 +804,7 @@
               }
               
               // set width on parent, to prevent wrapping of ajax loading image
-              var w = $(obj).Width();
+              var w = $dynano(obj).Width();
               w = w + 24;
               obj.parentNode.style.width = w + 'px';
               
@@ -816,6 +817,7 @@
               var url = makeUrlNS('Admin', 'PageGroups', 'src=ajax');
               var page_add = escape(obj.value);
               var pg_id = document.forms.pg_edit_frm['action[edit]'].value;
+              
               ajaxPost(url, 'action[edit][add_page]=&pg_id=' + pg_id + '&new_page=' + page_add, function()
                 {
                   if ( ajax.readyState == 4 )
@@ -949,7 +951,7 @@
         echo '<tr>';
         // Add pages AJAX form
         echo '<td class="row2">' . $lang->get('acppg_field_add_page') . '<br /><small>' . $lang->get('acppg_field_add_page_hint') . '</small></td>';
-        echo '<td class="row1"><input type="text" size="30" name="pg_add_member" id="inptext_pg_add_member" /></td>';
+        echo '<td class="row1"><input type="text" size="30" name="pg_add_member" id="inptext_pg_add_member" class="autofill page" /></td>';
         echo '</tr></table></div>';
       }