In CustomerTicketMessage.dtl AjaxClientLookup einbauen

Hilfe zu Znuny Problemen aller Art
Locked
zrako02
Znuny newbie
Posts: 55
Joined: 13 Nov 2006, 09:01

In CustomerTicketMessage.dtl AjaxClientLookup einbauen

Post by zrako02 »

Hallo ich will in die CustomerTicketMessage.dtl folgenden AjaxClientLookup-Code einbauen.
Auf der Seite http://www.dhtmlgoodies.com/index.html? ... ent_lookup steht folgendes:
Put this into your <HEAD> section

Code: Select all

<style type="text/css">
	body{
		background-repeat:no-repeat;
		font-family: Trebuchet MS, Lucida Sans Unicode, Arial, sans-serif;
		height:100%;
		background-color: #FFF;
		margin:0px;
		padding:0px;
		background-image:url('/images/heading3.gif');
		background-repeat:no-repeat;
		padding-top:85px;
	}
	
	fieldset{
		width:500px;
		margin-left:10px;
	}

	</style>
	<script type="text/javascript" src="/AJAX/ajax.js"></script>
	<script type="text/javascript">
	/************************************************************************************************************
	Ajax client lookup
	Copyright (C) 2006  DTHMLGoodies.com, Alf Magne Kalleland
	
	This library is free software; you can redistribute it and/or
	modify it under the terms of the GNU Lesser General Public
	License as published by the Free Software Foundation; either
	version 2.1 of the License, or (at your option) any later version.
	
	This library is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
	Lesser General Public License for more details.
	
	You should have received a copy of the GNU Lesser General Public
	License along with this library; if not, write to the Free Software
	Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
	
	Dhtmlgoodies.com., hereby disclaims all copyright interest in this script
	written by Alf Magne Kalleland.
	
	Alf Magne Kalleland, 2006
	Owner of DHTMLgoodies.com
	
	
	************************************************************************************************************/	
	var ajax = new sack();
	var currentClientID=false;
	function getClientData()
	{
		var clientId = document.getElementById('clientID').value.replace(/[^0-9]/g,'');
		if(clientId.length==4 && clientId!=currentClientID){
			currentClientID = clientId
			ajax.requestFile = 'getClient.php?getClientId='+clientId;	// Specifying which file to get
			ajax.onCompletion = showClientData;	// Specify function that will be executed after file has been found
			ajax.runAJAX();		// Execute AJAX function			
		}
		
	}
	
	function showClientData()
	{
		var formObj = document.forms['clientForm'];	
		eval(ajax.response);
	}
	
	
	function initFormEvents()
	{
		document.getElementById('clientID').onblur = getClientData;
		document.getElementById('clientID').focus();
	}
	
	
	window.onload = initFormEvents;
	</script>
Put this into your <BODY> section

Code: Select all

<form name="clientForm" action="ajax-client_lookup.html" method="post">	
	<fieldset>
		<legend>Client information</legend>
		<table>
			<tr>
				<td><label for="clientID">Client ID:</label></td>
				<td><input name="clientID" id="clientID" size="5" maxlength="4"></td>
			</tr>
			<tr>
				<td><label for="firstname">First name:</label></td>
				<td><input name="firstname" id="firstname" size="20" maxlength="255"></td>
			</tr>
			<tr>
				<td><label for="lastname">Last name:</label></td>
				<td><input name="lastname" id="lastname" size="20" maxlength="255"></td>
			</tr>
			<tr>
				<td><label for="address">Address:</label></td>
				<td><input name="address" id="address" size="20" maxlength="255"></td>
			</tr>
			<tr>
				<td><label for="zipCode">Zipcode:</label></td>
				<td><input name="zipCode" id="zipCode" size="4" maxlength="5"></td>
			</tr>
			<tr>
				<td><label for="city">City:</label></td>
				<td><input name="city" id="city" size="20" maxlength="255"></td>
			</tr>
			<tr>
				<td><label for="country">Country:</label></td>
				<td><input name="country" id="country" size="20" maxlength="255"></td>
			</tr>
		</table>	
	</form>
	<p>In this script, AJAX is used to autofill the form fields after a valid client ID is entered. Valid client IDs in this example are 1001,1002,1003 and 1004.</p>
	</fieldset>
Now could anybody show me how the final CustomerTicketMessage.dtl has to look like??
larf
Znuny expert
Posts: 285
Joined: 31 May 2006, 11:20

Re: In CustomerTicketMessage.dtl AjaxClientLookup einbauen

Post by larf »

zrako02 wrote: Now could anybody show me how the final CustomerTicketMessage.dtl has to look like??
"This script requires PHP."
Produktiv-System: Centos 5 OTRS 2.3.4, MySQL 5
Test-System: Centos 4.4, OTRS 2.3.3, MySQL 4.1

Bitte keine Fragen per PM stellen! Das Forum kann euch besser helfen!
zrako02
Znuny newbie
Posts: 55
Joined: 13 Nov 2006, 09:01

Post by zrako02 »

I weiss dass das Script php benötigt. Also auf auf meinem Testserver ist php aktiviert und auch lauffähig. Ich weiss nur nicht wie man den code in die CustomerTicketMessage.dtl einbaut. Von meinem Verständnis sind doch dtl Dateien im Prizip Html Dateien oder?

Das Beispiel:
http://www.dhtmlgoodies.com/scripts/aja ... ookup.html

müsste doch von einem Experten auf die CustomerTicketMessage.dtl übertragbar sein (Vorraussetzung ist natürlich dann dass der Server auf dem OTRS läuft auch Php unterstützt.
Andre Bauer
Znuny guru
Posts: 2189
Joined: 08 Dec 2005, 17:01
Znuny Version: 5.0.x
Real Name: André Bauer
Company: Magix Software GmbH
Location: Dresden
Contact:

Post by Andre Bauer »

Prod: Ubuntu Server 16.04 / Zammad 1.2

DO NOT PM ME WITH OTRS RELATED QUESTIONS! ASK IN THE FORUMS!

OtterHub.org
larf
Znuny expert
Posts: 285
Joined: 31 May 2006, 11:20

Post by larf »

zrako02 wrote:Das Beispiel:
http://www.dhtmlgoodies.com/scripts/aja ... ookup.html

müsste doch von einem Experten auf die CustomerTicketMessage.dtl übertragbar sein (Vorraussetzung ist natürlich dann dass der Server auf dem OTRS läuft auch Php unterstützt.
Ich vermute fast, dass dieser Experte sich "Copy&Paste" nennt. Frag den doch einfach mal.
Produktiv-System: Centos 5 OTRS 2.3.4, MySQL 5
Test-System: Centos 4.4, OTRS 2.3.3, MySQL 4.1

Bitte keine Fragen per PM stellen! Das Forum kann euch besser helfen!
Locked