View Issue Details

IDProjectCategoryView StatusLast Update
0011523mantisbtjavascriptpublic2011-08-29 07:05
Reporterstappel Assigned Todhx  
PriorityhighSeveritymajorReproducibilityalways
Status closedResolutionwon't fix 
Product Version1.2.0rc2 
Summary0011523: Ajax not defined on bug_update_page.php
Description

When visiting bug_update_page.php (which is bug_update_advanced_page.php) there are 3 "Ajax is not defined" errors in my firefox console.

The javascript pages prototype.js and scriptaculous.js are not loaded.

I solved it with editing the file: core/projax_api.php
change:

enables the projax library for this page.

$g_enable_projax = true;

into:

enables the projax library for this page.

global $g_enable_projax;
$g_enable_projax = true;

Tagspatch
Attached Files
mantisbt-ajax.JPG (38,778 bytes)   
mantisbt-ajax.JPG (38,778 bytes)   

Relationships

related to 0009117 closeddhx Please remove projax from mantis 

Activities

stappel

stappel

2010-02-19 06:42

reporter   ~0024438

it is on HEAD

dhx

dhx

2010-02-25 01:16

reporter   ~0024505

Unable to reproduce. I've also looked at the code and confirmed that projax_api.php is being loaded after html_api.php (thus $g_enable_projax = true).

There is no need for "global $g_enable_projax;" unless projax_api.php is being included from a function and you want that function to make use of the global variables in projax_api.php. I've grepped the Mantis source code and projax_api.php is never included from within the scope of a function. It is always included from the global scope, thus making variables defined in projax_api.php global.

I suggest you delete your MantisBT directory (after backing it up) and extract a fresh copy of MantisBT 1.2.0 in it's place. I'm guessing your directory has a mix of files from different versions of MantisBT.

stappel

stappel

2010-02-25 05:48

reporter   ~0024515

it is on the master branch in git. not on 1.2.0. i checked, i downloaded the 1.2.0 tar and it does not show the error. a "git checkout -f" gave me the error again on that page in firefox console2.

if I edit projax.php and set a simple isset infront of the $g_enable_projax =true; like:
if (isset($g_enable_projax)) {
echo "xxxx";
} else {
echo "yyyy";
}
it shows a yyyy on that page. so it does not exists yet and it redefines the var.

on the page you can see it also because there is a big white field below the platform and os boxes.

as you state it is not a var in a function there must be a problem with the sequence of the includes.

dhx

dhx

2010-02-25 08:40

reporter   ~0024520

I can't reproduce this problem on the latest 1.3.x master branch. AJAX support for the "Reporter" field on bug_update_page.php is working fine for me.

Can I ask what version of PHP you are using?

Have you tried:
git reset --hard origin/master
git clean -xfd

To reset your git directory to the exact same content as the git repository on git.mantisbt.org? Note that when using those commands above, it'll delete anything (including your configuration files) not in the official git repository. Do a backup first if you have something to lose.

stappel

stappel

2010-02-26 09:41

reporter   ~0024543

php -v

PHP 5.2.12 (cli) (built: Jan 10 2010 14:24:47)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies
with DBG v3.8.10, (C) 2000,2009, by Dmitri Dmitrienko

git reset --hard origin/master

HEAD is now at ecb7cc0 Fix 0011565: $g_enable_profiles not respected on bug report page

git clean -xf

cp ../config_inc.php .

The "Reporter" field works fine, it is the "Platform", "OS" and "OS version" which have the problem.
The reportfield uses: ajax_click_to_edit()
the platformfield uses: projax_autocomplete()

PAB

PAB

2010-03-09 05:01

reporter   ~0024682

I've got a similar problem and solved it by uninstalling jQuery-Plugin.

jreese

jreese

2010-04-19 15:37

reporter   ~0025156

I've pushed an update to the jQuery plugin that makes it cooperate with the Projax/Prototype libraries that MantisBT uses. You should be able to download or update to the latest version of that plugin, as well as any other plugins that rely on the jQuery plugin, to fix this problem.

stappel

stappel

2010-04-20 05:37

reporter   ~0025161

no jQuery plugin installed on my Mantis system

dhx

dhx

2010-04-21 08:06

reporter   ~0025180

Do you have any other plugins installed?

stappel

stappel

2010-04-21 08:17

reporter   ~0025183

Last edited: 2010-04-21 08:24

Nope, can reproduce it on a clean download:

#cd /var/www/html
#mkdir temp1
#cd temp1
#git clone git://git.mantisbt.org/mantisbt.git
Initialized empty Git repository in /opt/webserver/ik/mantisbt/.git/
remote: Counting objects: 55612, done.
remote: Compressing objects: 100% (17832/17832), done.
remote: Total 55612 (delta 45636), reused 45503 (delta 37284)
Receiving objects: 100% (55612/55612), 17.13 MiB | 203 KiB/s, done.
Resolving deltas: 100% (45636/45636), done.
#cd mantisbt
#cp /tmp/config_inc.php .

config_inc.php is my saved config

the blank space is still there. See attached picture

dhx

dhx

2010-06-23 00:45

reporter   ~0025955

OK I can reproduce this now. Thanks for being patient.

Will look into the problem and get a fix committed.

dhx

dhx

2010-06-23 01:25

reporter   ~0025956

The problem is that Projax and jQuery conflict with each other. MantisBT now includes jQuery code by default.

I think it's best at this point to remove Projax from MantisBT entirely pending a new jQuery or HTML5 autocomplete feature.

As such, please see 0009117 on progress towards removing Projax (and thus fixing this problem).

stappel

stappel

2010-06-23 06:20

reporter   ~0025960

Thanks for sorting this out.

please reconsider the easy/quick fix by just adding global $g_enable_projax;
This solved it for me and can help others. This line can be removed when 0009117 is fixed.

Bedlore

Bedlore

2010-07-04 23:33

reporter   ~0026021

@stappel: That "one line fix" doesn't appear to work in Mantis 1.2.1

stappel

stappel

2010-07-06 07:28

reporter   ~0026025

Sorry that is what worked for me. have you tried uninstalling jQuery-Plugin?

johnericson

johnericson

2011-07-29 05:55

reporter   ~0029322

I discovered this problem today on my installation which I upgraded yesterday to 1.2.6.

The quick fixes in core/projax_api.php didn't work for me and I didn't try to replace Projax with jQuery as that seems to be too complex of a change to do in a stable system.

Instead I set "$g_use_javascript = OFF;" in config_inc.php which solved the problem for me.