Category Archives: Notepad

osTicket 1.9.2 – Easy Custom Column in Ticket View

Dec 14 Update:While these rough instructions can be roughly used in osTicket 1.9.4, it doesn’t return the value from a list, just an ID (Which on a technical level is better in the long run, just makes this process a little harder).
I’m working on fixing this and will post the info once I’ve had a chance to work it out.
New instructions for 1.9.4 can be found here: https://www.andrewbennett.com.au/2014/12/osticket-1-9-4-easy-custom-column-in-ticket-view/

TL;DR (I rushed these notes for myself).

File to edit: /include/staff/tickets.inc.php

1) Added To the top to make things easier. (line 2-3)
The Name field (currently “field_17” ) needs to be worked out from the database by looking at the [tbl_prefix]_ticket__cdata
The Desc field (Currently “Sample 1”) is what your users will see as the column heading.

$CustomList1Name = “field_17”;
$CustomList1Desc = “Sample 1”;

2) Add custom1 to allow sorting. (~Line 157)

$sortOptions=array(‘date’=>’effective_date’,’ID’=>’ticket.`number`’,
‘pri’=>’pri.priority_urgency’,’name’=>’user.name’,’subj’=>’cdata.subject’,
‘status’=>’ticket.status’,’assignee’=>’assigned’,’staff’=>’staff’,
‘dept’=>’dept.dept_name’,
‘custom1’=>’Custom1’); //AB Added

3) Edit the last two lines, frst remove the ; after “pri.priority_color'” then add the last line  (~Line 243)
After line:

$qselect.=’ ,IF(ticket.duedate IS NULL,IF(sla.id IS NULL, NULL, DATE_ADD(ticket.created, INTERVAL sla.grace_period HOUR)), ticket.duedate) as duedate ‘
.’ ,CAST(GREATEST(IFNULL(ticket.lastmessage, 0), IFNULL(ticket.closed, 0), IFNULL(ticket.reopened, 0), ticket.created) as datetime) as effective_date ‘
.’ ,CONCAT_WS(” “, staff.firstname, staff.lastname) as staff, team.name as team ‘
.’ ,IF(staff.staff_id IS NULL,team.name,CONCAT_WS(” “, staff.lastname, staff.firstname)) as assigned ‘
.’ ,IF(ptopic.topic_pid IS NULL, topic.topic, CONCAT_WS(” / “, ptopic.topic, topic.topic)) as helptopic ‘
.’ ,cdata.priority_id, cdata.subject, pri.priority_desc, pri.priority_color’
.’ ,cdata.’.$CustomList1Name.’ as Custom1 ‘ //AB – Custom 1
;

4) Add Column Heading (~ Line 337)

<!– AB – Custom Col 1 –>
<th width=”60″>
<a <?php echo $custom1_sort; ?> href=”tickets.php?sort=custom1&order=<?php echo $negorder; ?><?php echo $qstr; ?>”
title=”Sort By <?php echo $CustomList1Desc; ?> <?php echo $negorder; ?>”><?php echo $CustomList1Desc; ?></a></th>
<!– AB – Custom Col 1 –>

5) Add Column Data (~ Line 435)

<!– AB – Custom Col 1 –>
<td nowrap>&nbsp;<?php echo $row[‘Custom1’]; ?>&nbsp;</td>
<!– AB – Custom Col 1 –>

When I get around to it I will upload the file to github or bitbucket.

Spago BI Installation

TL;DR

Installing Spago BI.

  1. First install JDK and set 3 system paths:
    • JAVA_HOME: C:\Program Files\Java\jdk<version>
    • JRE_HOME: C:\Program Files\Java\jre<version>
    • Add to PATH: ;C:\Program Files (x86)\Java\jdk<version>\bin
  2. Now run the SpagoBI installer.
  3. Run SpagoBI from Start Menu
  4. Open up a browser and enjoy.

Here are some rough notes from installing Spago BI in a somewhat blind way. (I should have probably read the docs first.)

Installation Platform:

  • Windows Server 2003 R2 x64
  • 2gb ram
  • 2 vcpus
  • XenServer 6 as host.
  1. Download the SpagoBI 4.2 installer and unzip and run.
  2. Run installer, I ticked all the options (not sure that this was the best idea).
  3. Each package selected in Step 2 has to be individually downloaded, so it takes a while.
  4. Java needs to be installed. I grabbed the JDK from Ninite.
    But the System Path Variables also need to be put in place before Spago will run. (I used the Program Files (x86) folder in the paths below).

    • JAVA_HOME: C:\Program Files\Java\jdk<version>
    • JRE_HOME: C:\Program Files\Java\jre<version>
  5. After startup, open your browser at:
    http://localhost:8080/SpagoBISpagoBI login page will appair. Log yourself as:
    – biadmin/biadmin (technical user)
    – biuser/biuser (business or functional user)
    – bidemo/bidemo (showcase user)
  6. Nothing loaded for me. Trying a reboot.
  7. Reading the console output, I possibly shouldn’t have left everything ticked in step 2, now that it has to try and load them all.
    Finally it loaded and reported the following in the console:
    INFO: Server startup in 630557 ms (that’s 10.5 minutes!)
  8. Can’t connect to sample database, I found a “start.bat” file which complained about not having access to “JAVA”. Looks like I need to add JAVA bin folder to the System Path. Restarting Spago / Tomcat
  9. This time round, a second command prompt window has also opened loading the foodmart database.
  10. Demo now appears to be working.

asp.net Clean up CSS output

How to get rid of all the ugly auto markup generated in ASP.net:

http://weblogs.asp.net/scottgu/archive/2010/03/30/cleaner-html-markup-with-asp-net-4-web-forms-client-ids-vs-2010-and-net-4-0-series.aspx

New ClientIDMode Property on Controls

ASP.NET 4 supports a new ClientIDMode property on the Control base class.  The ClientIDMode property indicates how controls should generate client ID values when they render.  The ClientIDMode property supports four possible values:

  • AutoID—Renders the output as in .NET 3.5 (auto-generated IDs which will still render prefixes like ctrl00 for compatibility)
  • Predictable (Default)— Trims any “ctl00” ID string and if a list/container control concatenates child ids (example: id=”ParentControl_ChildControl”)
  • Static—Hands over full ID naming control to the developer – whatever they set as the ID of the control is what is rendered (example: id=”JustMyId”)
  • Inherit—Tells the control to defer to the naming behavior mode of the parent container control

 

asp.net Masterpages and Metatags

There are a couple of ways to edit meta tags in MasterPages in asp.net (vb).

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Page.Title = String.Format(“Master Page Tutorials :: About :: {0:d}”, DateTime.Now)

‘ Programmatically add a <meta> element to the Header
Dim keywords As New HtmlMeta()
keywords.Name = “keywords”
keywords.Content = “master page,asp.net,tutorial”

Page.Header.Controls.Add(keywords)

‘ Programmatically add a <meta> element to the Header
Dim description As New HtmlMeta()
description.Name = “description”
description.Content = “This is a Sample Description”

Page.Header.Controls.Add(description)

End Sub

New way: (thanks to: http://weblogs.asp.net/scottgu/archive/2010/01/05/asp-net-4-seo-improvements-vs-2010-and-net-4-0-series.aspx)

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Page.Title = String.Format(“Master Page Tutorials :: About :: {0:d}”, DateTime.Now)

Page.MetaDescription = “Hello World”
Page.MetaKeywords = “Some, keywords, that, go here”

End Sub

I prefer the output of the first type, even tho it has more code involved.