"Something went wrong ... "

Installation Problems And Solutions

"Something went wrong ... "

Postby iwm21 on Thu Jan 14, 2010 10:27 am

First time I've installed it and having followed the steps in the README (more than once!!), when running Example1.php or Example2.php, I get;

"Something went wrong ...
Most likely the AJAX url is incorrect
..."

What AJAX URL? (he asks in frustration)
There's nothing in the README or Common.php files to indicate any URLs (FQDN's or paths) that need to be accurate.

There is nothing in my Apache error_log, the local error_log or messages to indicate I was looking for something that didn't exist.

Where do I look?
What have I done?

Please e-mail me ... it's quicker ... iwm21 _at_ cam ac uk
iwm21
 
Posts: 6
Joined: Thu Jan 14, 2010 10:18 am

Re: "Something went wrong ... "

Postby admin on Thu Jan 14, 2010 2:39 pm

The ajax url is set to the php $_SERVER['PHP_SELF'] variable. If for some reason this variable is incorrect you can hard code it. For example in Example1.php on line 51 you would change
Code: Select all
var ajaxUrl = '<?php echo $_SERVER['PHP_SELF']; ?>';

to
Code: Select all
var ajaxUrl = 'Example1.php';
admin
Site Admin
 
Posts: 1290
Joined: Fri Jul 11, 2008 1:34 am

Re: "Something went wrong ... "

Postby iwm21 on Fri Jan 15, 2010 11:49 pm

Thanks for the rapid response but still nothing

I've edited the php.ini to show debug and made the changes you've suggested but still the same?

The are of the site was protected so I've moved it to an un-protected are and still the same

There is nothing in the logs (/var/log/apache2/*.log, /var/log/messages specifically but I've grep'd for Example1.php in the whole of the /var/log/ area and nothing?)
iwm21
 
Posts: 6
Joined: Thu Jan 14, 2010 10:18 am

Re: "Something went wrong ... "

Postby admin on Sat Jan 16, 2010 3:57 pm

You said you've modified php.ini to show debug. I am not sure what this means, did you set display_errors = On and then restart the apache web server?

If you have access to another server you could try to install it there. Other things to do

1. Make sure the mysql information in Common.php is correct.
2. Make sure you executed the sql to create the tables in the right database.
admin
Site Admin
 
Posts: 1290
Joined: Fri Jul 11, 2008 1:34 am

Re: "Something went wrong ... "

Postby iwm21 on Wed Jan 20, 2010 11:46 am

The Common.php code is good

I edited Example1.php to include the following (expanding on lines 49 -> 55):

Code: Select all
...
         <script type="text/javascript">
            document.writeln('Test 1: <br />');
            trackHistory = false;
            document.writeln('Test:2: <br />trackhistory= ' + trackHistory + '<br />');
            var ajaxUrl = 'Example1.php';  /* option 1
            var ajaxUrl = '<?php echo $_SERVER['PHP_SELF']; ?>';   /* option 2
            document.writeln('Test:3: <br><div> '+ ajaxUrl + '</div>');
            document.writeln('Test:4: <br><div>ajaxUrl= '+ ajaxUrl + '</div>');
            toAjaxTableEditor('update_html','');
         </script>
      <?php
   }
...

... swapped lines "option 1" and "option 2" around though essentially got the following:

Code: Select all
Test 1:
Test:2:
trackhistory= false
Test:3:
/lapwing/updates/Example1.php
Test:4:
ajaxUrl= /develop/updates/Example1.php

with or without the full path depending on option 1 or 2


I got the following line from the logs when

Code: Select all
Jan 20 11:32:17 blah.foo.bar httpd2-prefork: PHP Fatal error:  Call to undefined function mb_convert_case() in /srv/www/htdocs/develop/updates/php/AjaxTableEditor.php on line 113


which is
Code: Select all
   $this->tableTitle = mb_convert_case(str_replace('_',' ',$this->tableName),MB_CASE_TITLE, "UTF-8");


p.s. I am running
  • openSUSE 11.2
    Code: Select all
    Linux blah 2.6.16.60-0.42.7-xenpae #1 SMP Tue Nov 3 11:20:42 UTC 2009 i686 i686 i386 GNU/Linux
  • php 5
    Code: Select all
    PHP 5.2.5 with Suhosin-Patch 0.9.6.2 (cli) (built: Sep 24 2009 12:23:06)
    Copyright (c) 1997-2007 The PHP Group
    Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies
  • MySQL 5.0
    Code: Select all
    mysql  Ver 14.12 Distrib 5.0.26, for suse-linux (i686) using readline 5.1
iwm21
 
Posts: 6
Joined: Thu Jan 14, 2010 10:18 am

Re: "Something went wrong ... "

Postby admin on Wed Jan 20, 2010 3:36 pm

You need to install the php-mbstring module and then restart apache to fix this error
Jan 20 11:32:17 blah.foo.bar httpd2-prefork: PHP Fatal error: Call to undefined function mb_convert_case() in /srv/www/htdocs/develop/updates/php/AjaxTableEditor.php on line 113


I am not sure exactly how to do this on opensuse. If you have yum set up try running
Code: Select all
yum install php-mbstring
admin
Site Admin
 
Posts: 1290
Joined: Fri Jul 11, 2008 1:34 am

Re: "Something went wrong ... "

Postby iwm21 on Wed Jan 20, 2010 5:57 pm

I'll try it and get back ...

p.s. it's
Code: Select all
yast install php5-mbstring

Note the php5-mbstring and yast could be yast2 on some generic openSuSe systems
iwm21
 
Posts: 6
Joined: Thu Jan 14, 2010 10:18 am

Re: "Something went wrong ... "

Postby iwm21 on Wed Jan 20, 2010 6:04 pm

Thanks ... that did it for Example2.php but Example1.php gives
There was a problem with the response tex string(342) "An error occurred in script /srv/www/htdocs/develop/updates/php/AjaxTableEditor.php on line 211:
<br />There was an error executing the following query: select * order by `first_name` asc limit 0, 20

mysql said:
Unknown column 'first_name' in 'order clause'"


I think that's my doing so I'll re-edit it and get back

Meanwhile ---- anyone that's having the same problem ... google for
php-mbstring download
iwm21
 
Posts: 6
Joined: Thu Jan 14, 2010 10:18 am

Re: "Something went wrong ... "

Postby iwm21 on Wed Jan 20, 2010 6:13 pm

That did it ...

Thanks admin
iwm21
 
Posts: 6
Joined: Thu Jan 14, 2010 10:18 am

Re: "Something went wrong ... "

Postby nanny on Fri Jan 22, 2010 2:13 am

For the life of me I cannot get this to work in my own web page - iframe works. I keep getting a response text.
Code: Select all
        <?php
    require_once('Common.php');
   require_once('php/lang/LangVars-en.php');
   require_once('php/AjaxTableEditor.php');
    class Example1 extends Common
    {
       function initiateEditor()
   {
      $tableColumns['contactid'] = array('display_text' => 'ID', 'perms' => 'TVQSXO');
      $tableColumns['name'] = array('display_text' => 'First Name', 'perms' => 'EVCTAXQSHO', 'req' => true);
      $tableColumns['name2'] = array('display_text' => 'Last Name', 'perms' => 'EVCTAXQSHO', 'req' => true);
      $tableColumns['name3'] = array('display_text' => 'Address', 'perms' => 'EVCTAXQSHO');
      $tableColumns['name4'] = array('display_text' => 'Town/City', 'perms' => 'EVCTAXQSHO');
      $tableColumns['name5'] = array('display_text' => 'Zip/Postcode', 'perms' => 'EVCTAXQSHO');
      $tableColumns['name6'] = array('display_text' => 'Shed Type', 'perms' => 'EVCTAXQSHO');
      $tableColumns['name7'] = array('display_text' => 'Store Name', 'perms' => 'EVCTAXQSHO');
      $tableColumns['name8'] = array('display_text' => 'Date Of Purchase', 'perms' => 'EVCTAXQSHO');
      $tableColumns['email'] = array('display_text' => 'Email', 'perms' => 'EVCTAXQSHO');
      $tableColumns['message'] = array('display_text' => 'Message', 'perms' => 'EVCTAXQSHO', 'textarea' => array('rows' => 5, 'cols' => 30), 'input_info' => 'style="width: 200px;"');
      $tableColumns['country'] = array('display_text' => 'Country', 'perms' => 'EVCTAXQSHO', 'select_array' => array('Argentina and South America' => 'Argentina and South America', 'Australia' => 'Australia', 'Austria' => 'Austria', 'Belgium' => 'Belgium', 'France' => 'France', 'Germany' => 'Germany', 'Ireland' => 'Ireland', 'Japan' => 'Japan', 'Netherlands' => 'Netherlands', 'New Zealand' => 'New Zealand', 'South Africa' => 'South Africa', 'Switzerland' => 'Switzerland', 'UK' => 'UK'));
      $tableColumns['contactdate'] = array('display_text' => 'Date Received', 'perms' => 'EVCTAXQSHO', 'req' => true);
      
      $tableName = 'contacts';
      $primaryCol = 'contactid';
      $errorFun = array(&$this,'logError');
      $permissions = 'EAVIDQCSXHOMUT';
      
      
      $this->Editor = new AjaxTableEditor($tableName,$primaryCol,$errorFun,$permissions,$tableColumns);
      $this->Editor->setConfig('tableInfo','cellpadding="1" width="90%" class="mateTable"');
      $this->Editor->setConfig('orderByColumn','name');
      $this->Editor->setConfig('addRowTitle','Add Warranty');
      $this->Editor->setConfig('editRowTitle','Edit Warranty');
      //$this->Editor->setConfig('iconTitle','Edit Warranty');
      $userButtons[] = array('call_back_fun' => array(&$this,'doSomething'), 'label' => 'Do Something','confirm_msg' => 'Are you sure you would like to do something?');
      $this->Editor->setConfig('userButtons',$userButtons); 

   }
   
    function doSomething($rowInfo)
{
// code to do something goes here
}
 

   function Example1()
   {
      if(isset($_POST['json']))
      {
         session_start();
         // Initiating lang vars here is only necessary for the logError, and mysqlConnect functions in Common.php.
         // If you are not using Common.php or you are using your own functions you can remove the following line of code.
         $this->langVars = new LangVars();
         $this->mysqlConnect();
         if(ini_get('magic_quotes_gpc'))
         {
            $_POST['json'] = stripslashes($_POST['json']);
         }
         if(function_exists('json_decode'))
         {
            $data = json_decode($_POST['json']);
         }
         else
         {
            require_once('php/JSON.php');
            $js = new Services_JSON();
            $data = $js->decode($_POST['json']);
         }
         if(empty($data->info) && strlen(trim($data->info)) == 0)
         {
            $data->info = '';
         }
         $this->initiateEditor();
         $this->Editor->main($data->action,$data->info);
         if(function_exists('json_encode'))
         {
            echo json_encode($this->Editor->retArr);
         }
         else
         {
            echo $js->encode($this->Editor->retArr);
         }
      }
      else if(isset($_GET['export']))
      {
            session_start();
            ob_start();
            $this->mysqlConnect();
            $this->initiateEditor();
            echo mb_convert_encoding($this->Editor->exportInfo(),"Windows-1252","UTF-8");
            header("Cache-Control: no-cache, must-revalidate");
            header("Pragma: no-cache");
            header("Content-type: application/x-msexcel");
            header('Content-Type: text/csv');
            header('Content-Disposition: attachment; filename="'.$this->Editor->tableName.'.csv"');
            exit();
        }
      
   }
}
$lte = new Example1();
?>
   <!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

            <title>Untitled Document</title>

            <!-- Link to editor files -->
            <link href="css/table_styles.css" rel="stylesheet" type="text/css" />
            <link href="css/icon_styles.css" rel="stylesheet" type="text/css" />
            <script type="text/javascript" src="js/prototype.js"></script>           
            <script type="text/javascript" src="js/ajax_table_editor.js"></script>
           
            <!-- Link to calendar files if needed -->
            <!--<link rel="stylesheet" type="text/css" media="all" href="js/jscalendar/skins/aqua/theme.css" title="win2k-cold-1" />
            <script type="text/javascript" src="js/jscalendar/calendar.js"></script>
            <script type="text/javascript" src="js/jscalendar/lang/calendar-en.js"></script>
            <script type="text/javascript" src="js/jscalendar/calendar-setup.js"></script>-->
           
            <!-- Set ajax url -->
            <script type="text/javascript">
                trackHistory = false;
                var ajaxUrl = '<?php echo $_SERVER['PHP_SELF']; ?>';
            </script>
           
        </head>
       
        <!-- Call js function on load -->
        <body onload="toAjaxTableEditor('update_html','');">
           
            <!-- Original html content -->
            <p>This is the original web page html</p>
            <!-- End original html content -->
           
            <!-- Editor HTML -->
            <div id="historyContainer">
                <div id="information">
                </div>
           
                <div id="titleLayer" style="padding: 2px; font-weight: bold; font-size: 18px; text-align: center;">
                </div>
           
                <div id="tableLayer" align="center">
                </div>
               
                <div id="recordLayer" align="center">
                </div>     
               
                <div id="searchButtonsLayer" align="center">
                </div>
            </div>
            <!--  End editor HTML -->
           
            <!-- Original html content -->
            <p>This is the original web page html</p>
            <!-- End original html content -->
           
        </body>
    </html>

nanny
 
Posts: 19
Joined: Wed Jan 20, 2010 5:18 am

Next

Return to Installation

Who is online

Users browsing this forum: No registered users and 0 guests

cron