different behavior jquery in mantis 2.x

Get help from other users here.

Moderators: Developer, Contributor

Post Reply
cas
Posts: 1586
Joined: 11 Mar 2006, 16:08
Contact:

different behavior jquery in mantis 2.x

Post by cas »

I am porting an older plugin to mantis version 2.x
I have an autocomplete field where the values are retrieved from the DB using the following code:

Code: Select all

<?php
require_once( '../../../core.php' );
$q = strtolower($_GET["q"]);
if (!$q) return;
$sql = "select cust_name,cust_id,id from mantis_plugin_SapData_relations_table where cust_name LIKE '%$q%' or cust_id LIKE '%$q%' LIMIT 0,45 ";
$rsd = mysql_query($sql);
while($rs = mysql_fetch_array($rsd)) {
	$id = $rs['id'];
	$cid = $rs['cust_id'];
	$cname = $rs['cust_name'];
	echo "$cid $cname |$cid\n";
}
the function used which works fine in mantis 1.x is :

Code: Select all

	function sapdata_report1($p_event, $p_project_id) {
		echo "<style type=\"text/css\">@import url(" . config_get( 'path' ) . "plugins/SapData/files/jquery.autocomplete.css);</style>\n";
		echo '<script type="text/javascript" src="',config_get( 'path' ) . 'plugins/SapData/files/jquery.autocomplete.js' , '"></script>' . "\n"; 
		?>
		<tr <?php echo helper_alternate_class() ?>>
		<td class="category" width="30%"><span class="required">*</span> 
		<?php echo lang_get( 'plugin_sapdata_relation' ) ?>
		</td>
		<td width="70%">
		<script type="text/javascript">
		jQuery(document).ready(function() {
		jQuery("#relation").autocomplete("plugins/SapData/pages/get_relation_list.php", {
			width: 500,
			matchContains: true,
			minChars: 3,
			max: 15,
			selectFirst: false
		});
		jQuery("#relation").result(function(event, data, formatted) {
		jQuery("#relation_val").val(data[1]);
		});
		});
		</script>
		<input type="text" name="relation" id="relation" size="50" />
		<input type="hidden" name="sap_relation" id="relation_val"  />

		</td>
		</tr>
		<?php
	}
Aince in mantis 2.x all the jquery javascript/css is included, i assumed that removing the lines to include the CSS and the JS would do the trick, but that is not the case. So I am overlooking something and could do with some advice :mrgreen:
stigzler
Posts: 10
Joined: 18 Mar 2019, 23:36

Re: different behavior jquery in mantis 2.x

Post by stigzler »

Hi - did you ever get this port finished? I too am looking for the 'Easy relationships manager' plugin compatible with V2 (can't install earlier versions on my installation).
cas
Posts: 1586
Joined: 11 Mar 2006, 16:08
Contact:

Re: different behavior jquery in mantis 2.x

Post by cas »

No, this is still work to be done :roll:
stigzler
Posts: 10
Joined: 18 Mar 2019, 23:36

Re: different behavior jquery in mantis 2.x

Post by stigzler »

Shame, but realise it's a long task-list!
Post Reply