How to show values on new web page

English! place to talk about development, programming and coding
Post Reply
GMunjal
Znuny advanced
Posts: 108
Joined: 23 Oct 2013, 09:17
Znuny Version: 3.3.0 beta 2
Real Name: Gaurav Munjal
Company: Nagarro

How to show values on new web page

Post by GMunjal »

Hi,

I am writing a new ticket menu module. In the perl module I fetched data from database and sending it to the .dtl page in the form of hash. Now I don't know how can I see data on new web page, means what is the procedure to show data from the hashes.
e.g:

from Perl module the hash %LinkData is sending but what should I write on .dtl page to access the data from %LinkData!

Thanks in Advance!
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: How to show values on new web page

Post by crythias »

Take a look at what happens for a [something].dtl and the associated Kernel/Modules/[something].dtl

You'll see something like

Code: Select all

$Self->{LayoutObject}->Block(
    Name => 'SomeName',
    Data => {
        Key => Value,
        Key2 => 'Another Value',
    }
  )
And then you'll see, in the DTL

Code: Select all

<!-- dtl:block:SomeName -->
<a href="http://somewhere/#anchor">$QData{"Key"}</a>
<!-- dtl:block:SomeName -->
Sometimes, you'll see table generation:

Code: Select all

<table>
<thead><tr><th>Key</th><th>Key2</th></tr></thead>
<tbody>
<!-- dtl:block:TableRow -->
<tr>
<td>$QData{"Key"}</td>
<td>$QData{"Key2"}</td>
</tr>
<!-- dtl:block:TableRow -->
</tbody>
</table>
This would come from multiple Blocks of TableRow.
As an example, see Kernel/Output/HTML/DashboardTicketGeneric.pm and Kernel/Output/HTML/Standard/AgentDashboardTicketGeneric.dtl

The general principal is in #show tickets ...

Code: Select all

for my $TicketID(@{$TicketIDs}) {
... do stuff ...
        $Self->{LayoutObject}->Block(
            Name => 'ContentLargeTicketGenericRow',
            Data => \%Ticket,
        );
... do other stuff ...
}
You'll probably want to foreach your data per record/row.
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
GMunjal
Znuny advanced
Posts: 108
Joined: 23 Oct 2013, 09:17
Znuny Version: 3.3.0 beta 2
Real Name: Gaurav Munjal
Company: Nagarro

Re: How to show values on new web page

Post by GMunjal »

Thanks for the reply! Now I am able to show data on UI. Now I am facing a new problem : I am not able to click on any ''link'' on this page. I don't know what the problem is! Please help me!

Thanks
Gaurav
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: How to show values on new web page

Post by crythias »

GMunjal wrote: I am not able to click on any ''link'' on this page. I don't know what the problem is! Please help me!
ditto.
Your mouse might be broken.
Your links might be broken
Your code might be broken.
Your finger might be broken.

It's impossible to provide an answer to the problem as stated. Provide code, examples, read my help about asking good questions.
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
GMunjal
Znuny advanced
Posts: 108
Joined: 23 Oct 2013, 09:17
Znuny Version: 3.3.0 beta 2
Real Name: Gaurav Munjal
Company: Nagarro

Re: How to show values on new web page

Post by GMunjal »

Code: Select all

<!-- dtl:block:Link -->
<div class="LayoutPopup ARIARoleMain">

      <div class="Header">
        <h1>
            $Text{"Link Object: %s", "$Data{"SourceObjectLong"}"}
        </h1>
        <p>
            <a href="$Env{"Baselink"}Action=AgentLinkObject;Subaction=Close" id="CloseLink">$Text{"Close window"}</a>

<!--dtl:js_on_document_complete-->
		<script type="text/javascript">//<![CDATA[
    			$('#CloseLink').bind('click', function (Event) {
        		window.close();
        		return false;
    			});
		//]]></script>
<!--dtl:js_on_document_complete-->


<!-- dtl:block:LinkMenuDelete -->
            $Text{"or"}
            <a href="$Env{"Baselink"}Action=AgentLinkObject;Subaction=LinkDelete;Mode="Normal";SourceObject="Ticket";SourceKey=$LQData{"TicketID"};TargetIdentifier="Ticket"">
                $Text{"go to link delete screen"}
            </a>
<!-- dtl:block:LinkMenuDelete -->

        </p>
      	</div>

	
       	   <form action="$Env{"CGIHandle"}" method="post" id="LinkSearchForm">
                 <input type="hidden" name="Action" value="$Env{"Action"}"/>
                 <input type="hidden" name="TicketID" value="$QData{"TicketID"}"/>
			
			<table class="DataTable">
       		<thead>
				<tr>
            				<th>$Text{"Select"}</th>
					<th>$Text{"TicketNumber"}</th>
            				<th>$Text{"Title"}</th>
           				<th>$Text{"CustomerUserID"}</th>
            				<th>$Text{"Owner"}</th>
            				<th>$Text{"Age"}</th>
        			</tr>
			</thead>
			<tbody>
				<!-- dtl:block:TableRow -->
					 <tr>
						<td><input type ="checkbox" id="LinkTargetKeys" name="LinkTargetKeys" title="" alt="" value="$QData{"TicketID"}"></td>
            					<td><a href="$Env{"Baselink"}Action=AgentTicketZoom;TicketID="$QData{"TicketID"}" ">$Data{"TicketNumber"}</a></td>
            					<td>$Text{"$QData{"Title"}"}</td>	
						<td>$QData{"CustomerUserID"}</td>
            					<td>$Text{"$Data{"Owner"}"}</td>
            					<td>$Text{"$QData{"Age"}"}</td>
        				</tr>

				<!-- dtl:block:TableRow -->
			</tbody>
			</table>
			<div class="SpacingTopSmall">
				<button class="Primary" title="Add links" type="submit">Add links</button>
			</div>    
			<input type="hidden" value="Link" name="SubmitLink">            
           		</form>
        
</div>
<!-- dtl:block:Link -->
Last edited by crythias on 04 Dec 2013, 16:32, edited 1 time in total.
Reason: Please use code tags.
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: How to show values on new web page

Post by crythias »

Please describe:
What you want to happen
What is happening
Why it's not what you want to happen
What the page source renders as

Any error messages, logs, etc.,
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
GMunjal
Znuny advanced
Posts: 108
Joined: 23 Oct 2013, 09:17
Znuny Version: 3.3.0 beta 2
Real Name: Gaurav Munjal
Company: Nagarro

Re: How to show values on new web page

Post by GMunjal »

As you can see the code, there were some hyperlinks. I am not able to click them. and the second thing is about checkbox. I am not able to make any check in the checkbox!
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: How to show values on new web page

Post by crythias »

The code is how it looks before it is rendered in the browser.
View source on the rendered (in the browser) page.
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
GMunjal
Znuny advanced
Posts: 108
Joined: 23 Oct 2013, 09:17
Znuny Version: 3.3.0 beta 2
Real Name: Gaurav Munjal
Company: Nagarro

Re: How to show values on new web page

Post by GMunjal »

The problem is because javascript is not loaded yet! Can you tell me how can I load javascript? code from view source is as follow:

Code: Select all

/**
 * @function
 *      This function blocks all click events on the page until it is
 *      unblocked after all JavaScript was loaded. Implemented without
 *      jQuery because no external JavaScript is available yet.
 * @return nothing
 */
Core.App.BlockEvents = function() {
    if (document.addEventListener) {
        document.addEventListener('click', IgnoreEvent, false);
    }
    else {
        document.attachEvent('onclick', IgnoreEvent);
    }
};

/**
 * @function
 *      This function unblocks all click events on the page
 *      after all JavaScript was loaded. Implemented without
 *      jQuery because no external JavaScript is available yet.
 * @return nothing
 */
Core.App.UnblockEvents = function() {
    if (document.removeEventListener) {
        document.removeEventListener('click', IgnoreEvent, false);
    }
    else {
        document.detachEvent('onclick', IgnoreEvent);
    }
};

// Now block all click events on the page to make sure that
// an agent does not click before all JavaScript was loaded,
// as event listeners are not yet available, for example.
Core.App.BlockEvents();
[/b]
Last edited by crythias on 04 Dec 2013, 20:34, edited 1 time in total.
Reason: [code] tags
jojo
Znuny guru
Posts: 15020
Joined: 26 Jan 2007, 14:50
Znuny Version: Git Master
Contact:

Re: How to show values on new web page

Post by jojo »

you should hire an experienced OTRS developer
"Production": OTRS™ 8, OTRS™ 7, STORM powered by OTRS
"Testing": ((OTRS Community Edition)) and git Master

Never change Defaults.pm! :: Blog
Professional Services:: http://www.otrs.com :: enjoy@otrs.com
Post Reply