Re: [rt-users] [phish?] Re: clarification on callbacks
On Wed, Oct 12, 2016 at 8:44 PM, Alex Hall wrote: > >> You would use local versions of the Mason components. RT doesn't (at >> this point) have that modular or dynamic of an architecture. > > I hoped you weren't going to say that. :) I was looking earlier, to find > where exactly the download/with headers links and other extras get assembled > and inserted. I couldn't find any of it anywhere. I found ShowHistory and > ShowTransaction, but I couldn't find where the text of replies and other > transactions gets turned into what you see on the web UI. I must have missed > something obvious, but I can't see what. You could always get (by paying) BPS to make the modifications to upstream - then you'd get something that is supported for the future and the community would benefit by getting new functionality. -m - RT 4.4 and RTIR training sessions, and a new workshop day! https://bestpractical.com/training * Boston - October 24-26 * Los Angeles - Q1 2017
Re: [rt-users] [phish?] Re: clarification on callbacks
> On Oct 12, 2016, at 21:37, Matt Zagrabelny wrote: > > On Wed, Oct 12, 2016 at 3:53 PM, Alex Hall wrote: >> Callbacks I get now, at least I'm pretty sure I do. I've been reading the >> docs for RT objects, and if I can use any of the properties and methods I've >> found, I can see how plugins are so powerful. >> >> My sticking point now is modifying what's already there. I can remove items >> from a menu with deleteKey, but I haven't found a way to remove items from >> other areas of RT and replace them with my own. > > You would use local versions of the Mason components. RT doesn't (at > this point) have that modular or dynamic of an architecture. I hoped you weren't going to say that. :) I was looking earlier, to find where exactly the download/with headers links and other extras get assembled and inserted. I couldn't find any of it anywhere. I found ShowHistory and ShowTransaction, but I couldn't find where the text of replies and other transactions gets turned into what you see on the web UI. I must have missed something obvious, but I can't see what. > > It'd be great to have flexibility for users to see what they want in > the layout - it'd probably be a big-ish undertaking to implement it. > > My ultimate goal, as I've >> said, is to redo the ticket history section on ticket summary and history >> pages, to make it easier to read and follow. I have an idea of how I'd make >> the display I want to see, but how do I also get rid of the default one? > > From: > > https://docs.bestpractical.com/rt/4.4.1/writing_portlets.html > > "Copy /opt/rt4/html/share/SelfService/index.html to > /opt/rt4/local/html/SelfService/index.html" > > So if you wanted un-callback-able modifications made to your RT, then > you'd copy, for instance: > > /opt/rt4/html/share/Ticket/Display.html > > to > > /opt/rt4/html/local/Ticket/Display.html > > and then hack on the latter. > > -m - RT 4.4 and RTIR training sessions, and a new workshop day! https://bestpractical.com/training * Boston - October 24-26 * Los Angeles - Q1 2017
[rt-users] [phish?] Re: clarification on callbacks
On Wed, Oct 12, 2016 at 3:53 PM, Alex Hall wrote: > Callbacks I get now, at least I'm pretty sure I do. I've been reading the > docs for RT objects, and if I can use any of the properties and methods I've > found, I can see how plugins are so powerful. > > My sticking point now is modifying what's already there. I can remove items > from a menu with deleteKey, but I haven't found a way to remove items from > other areas of RT and replace them with my own. You would use local versions of the Mason components. RT doesn't (at this point) have that modular or dynamic of an architecture. It'd be great to have flexibility for users to see what they want in the layout - it'd probably be a big-ish undertaking to implement it. My ultimate goal, as I've > said, is to redo the ticket history section on ticket summary and history > pages, to make it easier to read and follow. I have an idea of how I'd make > the display I want to see, but how do I also get rid of the default one? From: https://docs.bestpractical.com/rt/4.4.1/writing_portlets.html "Copy /opt/rt4/html/share/SelfService/index.html to /opt/rt4/local/html/SelfService/index.html" So if you wanted un-callback-able modifications made to your RT, then you'd copy, for instance: /opt/rt4/html/share/Ticket/Display.html to /opt/rt4/html/local/Ticket/Display.html and then hack on the latter. -m - RT 4.4 and RTIR training sessions, and a new workshop day! https://bestpractical.com/training * Boston - October 24-26 * Los Angeles - Q1 2017
Re: [rt-users] Create ticket via API ignores Requestors field on notify requestors?
On Tue, 2016-10-11 at 23:18 -0400, Bill Cole wrote: > On 11 Oct 2016, at 15:58, Andrew Ruthven wrote: > > > Any other suggestions? I'm kinda grasping at straws here. > > Perhaps you need to make Scrip 22 runs in the "Batch" scrip stage? Hi Bill, Yes, that worked perfectly. Thanks for the suggestion. Cheers, Andrew -- Andrew Ruthven, Wellington, New Zealand and...@etc.gen.nz | linux.conf.au 2017, Hobart, AU New Zealand's only Cloud: | The Future of Open Source https://catalyst.net.nz/cloud | http://linux.conf.au - RT 4.4 and RTIR training sessions, and a new workshop day! https://bestpractical.com/training * Boston - October 24-26 * Los Angeles - Q1 2017
Re: [rt-users] clarification on callbacks
Callbacks I get now, at least I'm pretty sure I do. I've been reading the docs for RT objects, and if I can use any of the properties and methods I've found, I can see how plugins are so powerful. My sticking point now is modifying what's already there. I can remove items from a menu with deleteKey, but I haven't found a way to remove items from other areas of RT and replace them with my own. My ultimate goal, as I've said, is to redo the ticket history section on ticket summary and history pages, to make it easier to read and follow. I have an idea of how I'd make the display I want to see, but how do I also get rid of the default one? Callbacks let you insert your own functionality at certain points, but--understandably--they don't seem as willing to let you get at the existing structure. If I wanted to get rid of history and put in my own, or hide the time worked/estimated section entirely, could I do so? If I can, where is a good place to start reading about how? Thanks! On Tue, Oct 11, 2016 at 4:38 PM, Matt Zagrabelny wrote: > Hey Alex, > > On Tue, Oct 11, 2016 at 3:27 PM, Alex Hall wrote: > > Hello list, > > I'm considering trying out a callback. Ken suggested it as a way to add a > > link to pages that will let users toggle between self-service and > standard > > interfaces, and I'm very much hoping I can use it to customize the way > > history displays on ticket summary pages. > > > > From what I've read so far, it seems like a callback is analogous to a > > subclass. If I have a 'renderer' class that can make pretty text from raw > > HTML, I might then subclass it and override the function that parses > text to > > make it work on XML. Yes, it's a very terrible example, but hopefully the > > idea is correct. > > > > Anyway, a callback in RT seems a lot like that. I want the ticket page to > > display how it already does, but I don't like the history part. Thus, I > copy > > the file to the proper callback directory, then modify it. RT will, when > it > > knows it has to use Display.html, look in callbacks first and use my > > version. Only if I don't provide one will it use the default one in > > share/html/Tickets. > > > > Do I have this right--copy the existing file to callbacks and modify it? > Or > > do I make a blank file, override only the bits I want to in there, and > not > > copy the whole thing? Am I thinking about callbacks all wrong? > > You are thinking about Callbacks wrong. :) > > They are hook points in the HTML (Mason) of RT. > > Many (most?) RT extension will have some callbacks in them. Here is a > nice easy one to get your feet wet: > > https://github.com/bestpractical/rt-extension-commentoncreate > > Take a look at the source for this extension and note the > html/Callbacks directory. Then look in your RT share/html directory > for where those callbacks would appear. > > In this particular instance, rt-extension-commentoncreate adds a > "comment" box just below the "create" content box on the > Ticket/Create.html page. > > So you can see from the source of the extension, it will add something > to the AfterMessageBox callback in the Create.html Mason component. > > I'll let you dig a little bit more with this extension or another one > to get more familiar with callbacks. > > Also, read the documentation: > > https://docs.bestpractical.com/rt/4.4.1/writing_extensions.html#Callbacks > > -m > -- Alex Hall Automatic Distributors, IT department ah...@autodist.com - RT 4.4 and RTIR training sessions, and a new workshop day! https://bestpractical.com/training * Boston - October 24-26 * Los Angeles - Q1 2017
[rt-users] Downloading attachments via REST
Hello, I am currently in the process of writing a script for simple transferring of tickets from one instance to another. Both instances run 4.2.8, and I'm using Python for the script. Unfortunately, I have met a problem when it comes to attachments. The script uses the requests-library, and rt_get is just a wrapper around the session.get() function. Text files seem fine, but other files(i.e. pdf) aren't stored correctly. >From what I've gathered, even though the Content-Transfer-Encoding says >base64, this is not the case, as base64.decoding outputs a 98 byte file. It's >not correct to output it as utf-8 encoded either, because that gives a file of >475957 bytes. The original file is 236633 bytes. Also, decoding/encoding the >string buffer as Latin-1 throws an error. Have anyone done this before? Is the problem that the pdf file has some other encoding then UTF-8/Latin-1? Will this be different from all files? Are there any ways to just treat the content-response as bits and bytes, and write them directly to a file? A simple example of the code can be seen below, and all kinds of decode/encode attempts have been resultless. #!/usr/bin/env python2 from __future__ import print_function import requests import getpass import re import base64 from rtrequestlib import rt_get, rt_post # Fix Python 2.x. try: input = raw_input except NameError: pass fromSess = requests.Session() fromBase = "https://rt.uio.no/REST/1.0/"; username = input("Username: ") password = getpass.getpass() payload = {"user": username, "pass": password} loginS = rt_post(fromSess, fromBase, "", payload) attHead = rt_get(fromSess, fromBase, "ticket/2305592/attachments/26780830/content") # PDF attachment to a ticket # Remove REST-response and last three newlines pdfFile = attHead.text[17:-3] with open("test1.pdf", "wb") as f: f.write(pdfFile.encode("utf-8")) # only 98 bytes with open("test64.pdf", "wb") as f: f.write(base64.decodestring(pdfFile.encode("utf-8"))) with open("test2.pdf", "wb") as f: f.write(pdfFile.encode("iso-8859-1")) # THROWS UnicodeEncodeError Med vennlig hilsen, Thomas Oddsund SDS/USIT - RT 4.4 and RTIR training sessions, and a new workshop day! https://bestpractical.com/training * Boston - October 24-26 * Los Angeles - Q1 2017
Re: [rt-users] Using self service interface for privileged users in 4.4.1?
On Wed, Oct 12, 2016 at 8:51 AM, Alex Hall wrote: > The below code is great, thank you. I'm trying now to figure out a way to > toggle the interface while staying on the current page, but I'll have to do > more reading first. > > Using callbacks, can I remove items from existing templates? That is, could > I remove the 'Assets' menu item in addition to adding my own menu items? Yep. We add menu items for our own extensions and also remove/repurpose other menu items. -m - RT 4.4 and RTIR training sessions, and a new workshop day! https://bestpractical.com/training * Boston - October 24-26 * Los Angeles - Q1 2017
Re: [rt-users] Adding an Action link to Ticket/Display.html/BeforeActionList
well, here is one solution that works for me. my $referer = RT::Interface::Web::RequestENV('HTTP_REFERER'); https://github.com/MarkHofstetter/RT-Extension-OneClickClose On 12.10.2016 12:16, David Schmidt wrote: How can I access the referer in a callback? I managed to add the link using this callback: file: html/Callbacks/RT-Extension-OneClickClose/Elements/Tabs/Privileged <%ARGS> $Path => undef <%INIT> if ( $Path =~ m!^\/Ticket\/Display\.html! ) { if ( $DECODED_ARGS->{id} && $DECODED_ARGS->{id} =~ m/\d+/ ) { my $ticket_id = $DECODED_ARGS->{id}; my $actions = PageMenu()->child( 'actions' ); $actions->child( 'OneClickClose', title => 'OneClickClose', path => "/Ticket/Update.html?Status=resolved&SubmitTicket=1&id=$ticket_id&AfterSubmitReturn=1", ); } } On 06.10.2016 14:40, David Schmidt wrote: I'll answer myself: if an action is not a ref it is rendered in the result box. bit unexpected but im sure there is a reason. (code in share/html/Elements/ListActions) https://github.com/bestpractical/rt/blob/stable/share/html/Elements/ListActions#L49 On 06.10.2016 13:53, David Schmidt wrote: When/Where are the actions added to @Actions? 1) for some reason the \@Actions ArrayRef is empty when I access it in the callback. Where do the Actions come from? I am talking about the links "Reply", "Comment", "Forward", "Stall", ... 2) If I push a simple string to \@Actions they end up in a yellow "Results" Widget. see attached screenshot #local/plugins/RT-Extension-OneClickClose/html/Callbacks/RT-Extension-OneClickClose/Ticket/Display.html/BeforeActionList <%init> use Data::Dumper; $RT::Logger->debug("\n\n###\n".Dumper($Actions)."\n\n###\n"); push @$Actions, "foo"; <%args> $Actions => undef $TicketObj => undef Output: ### $VAR1 = []; ### (/opt/rt4/local/plugins/RT-Extension-OneClickClose/html/Callbacks/RT-Extension-OneClickClose/Ticket/Display.html/BeforeActionList:3) - RT 4.4 and RTIR training sessions, and a new workshop day! https://bestpractical.com/training * Boston - October 24-26 * Los Angeles - Q1 2017 - RT 4.4 and RTIR training sessions, and a new workshop day! https://bestpractical.com/training * Boston - October 24-26 * Los Angeles - Q1 2017 - RT 4.4 and RTIR training sessions, and a new workshop day! https://bestpractical.com/training * Boston - October 24-26 * Los Angeles - Q1 2017 - RT 4.4 and RTIR training sessions, and a new workshop day! https://bestpractical.com/training * Boston - October 24-26 * Los Angeles - Q1 2017
Re: [rt-users] The role of roles in 4.4
Alex Hall Wrote: >In the release notes for RT 4.4.0, the concept of "roles" is brought up. >The note says: > > * RT now has support for custom roles, along the lines of Requestor, >Owner, >Cc, and AdminCc. These roles can be single-member or multi-member. >Privileges can be assigned to members of custom roles, you can search >based >on custom role membership, you can notify custom role members in >scrips, and so on. > >This may be an obvious question to long-time users of RT, but what do roles >offer that groups don't? That is, what is the advantage to setting up a >custom role over making a group? In either case you have users assigned >rights based on membership, whether to a group or a role. Thanks. A group membership gives permission 100% of the time. A role membership gives permission only some of the time. If you give permission to close a ticket only to Owner, but not to a group, then you can only close tickets you own. If you gave it to a group instead, then you could close any ticket, even ones you don't own. /jeff The information contained in this e-mail is for the exclusive use of the intended recipient(s) and may be confidential, proprietary, and/or legally privileged. Inadvertent disclosure of this message does not constitute a waiver of any privilege. If you receive this message in error, please do not directly or indirectly use, print, copy, forward, or disclose any part of this message. Please also delete this e-mail and all copies and notify the sender. Thank you. - RT 4.4 and RTIR training sessions, and a new workshop day! https://bestpractical.com/training * Boston - October 24-26 * Los Angeles - Q1 2017
Re: [rt-users] create transaction record
Thanks Bill I should have thought of that, I will pursue one of those options. Thanks Bryon Baker Network Operations Manager Copesan - Specialists in Pest Solutions 800-267-3726 Ext. 2296 * 262-783-6261 Ext. 2296 bba...@copesan.com www.copesan.com "Servicing North America with Local Care" -Original Message- From: rt-users [mailto:rt-users-boun...@lists.bestpractical.com] On Behalf Of Bill Cole Sent: Tuesday, October 11, 2016 11:16 PM To: rt-users Subject: Re: [rt-users] create transaction record On 10 Oct 2016, at 17:16, Bryon Baker wrote: > Hello List > > I have created a custom scrip the will respond to an email via a web > service call. I would like to create a transaction with the return > message. > > Can someone give me a little code snippet or some direction on how to > create the transaction? With our creating or updating a custom field. > > I have read about the _RecoredTransaction but I think this may be the > wrong route and I have not found any example code to help me out. Have you read https://docs.bestpractical.com/rt/4.4.1/RT/Transaction.html#Create ? Probably more useful: https://docs.bestpractical.com/rt/4.4.1/RT/Ticket.html#Comment The simplest way to call it, given a RT::Ticket object named ticket: $ticket->Comment( Content => "I'm A Little Teapot" ); And now you have a new comment transaction. - RT 4.4 and RTIR training sessions, and a new workshop day! https://bestpractical.com/training * Boston - October 24-26 * Los Angeles - Q1 2017 - RT 4.4 and RTIR training sessions, and a new workshop day! https://bestpractical.com/training * Boston - October 24-26 * Los Angeles - Q1 2017
Re: [rt-users] Using self service interface for privileged users in 4.4.1?
The below code is great, thank you. I'm trying now to figure out a way to toggle the interface while staying on the current page, but I'll have to do more reading first. Using callbacks, can I remove items from existing templates? That is, could I remove the 'Assets' menu item in addition to adding my own menu items? Or provide my own implementation of something, like modifying the text of an existing menu item? My ultimate goal is still to simplify the history display on ticket summaries, but the menu seems a safe place to get my feet wet. I did also download and look at the source of that extension. It's making some sense, but I'm still very new to Perl and Mason, so am learning them at the same time as the callback mechanisms. I'll get there. :) On Wed, Oct 12, 2016 at 3:23 AM, Emmanuel Lacour wrote: > Le 11/10/2016 à 20:11, Matt Zagrabelny a écrit : > > On Tue, Oct 11, 2016 at 8:05 AM, Alex Hall wrote: > >> Hello list, > >> I have 4.4.1 running. Someone said on this list that it included the > option > >> to use the self service interface, even for privileged users? I don't > see > >> that option in my user preferences. How do I enable it, and can I have a > >> toggle for users to switch between the two without leaving the ticket > >> they're viewing? Thanks. > > Privileged users can always browse to: > > > > rt.example.com/SelfService > > > > You can probably use a callback to add a link to the self service URL > > for displaying a ticket. > > link from standard UI to selfservice: > > rt/local/html/Callbacks/YourOrg/Elements/Tabs/Privileged: > > <%init> > Menu->child( 'simplified-ui' => title => loc("SelfService"), sort_order > => 1, path => '/SelfService/', attributes => { style => 'font-style: > italic;' }); > > > > link back to standard UI from selfservice: > > rt/local/html/Callbacks/YourOrg/Elements/Tabs/SelfService: > <%init> > # Add link to full UI if allowed > if ( $session{CurrentUser}->Privileged ) { > Menu->child( 'full-ui' => title => loc("Full web interface"), sort_order > => 1, path => '/index.html', attributes => { style => 'font-style: > italic;' }); > } > > > > > > ;) > - > RT 4.4 and RTIR training sessions, and a new workshop day! > https://bestpractical.com/training > * Boston - October 24-26 > * Los Angeles - Q1 2017 > -- Alex Hall Automatic Distributors, IT department ah...@autodist.com - RT 4.4 and RTIR training sessions, and a new workshop day! https://bestpractical.com/training * Boston - October 24-26 * Los Angeles - Q1 2017
Re: [rt-users] Adding an Action link to Ticket/Display.html/BeforeActionList
How can I access the referer in a callback? I managed to add the link using this callback: file: html/Callbacks/RT-Extension-OneClickClose/Elements/Tabs/Privileged <%ARGS> $Path => undef <%INIT> if ( $Path =~ m!^\/Ticket\/Display\.html! ) { if ( $DECODED_ARGS->{id} && $DECODED_ARGS->{id} =~ m/\d+/ ) { my $ticket_id = $DECODED_ARGS->{id}; my $actions = PageMenu()->child( 'actions' ); $actions->child( 'OneClickClose', title => 'OneClickClose', path => "/Ticket/Update.html?Status=resolved&SubmitTicket=1&id=$ticket_id&AfterSubmitReturn=1", ); } } On 06.10.2016 14:40, David Schmidt wrote: I'll answer myself: if an action is not a ref it is rendered in the result box. bit unexpected but im sure there is a reason. (code in share/html/Elements/ListActions) https://github.com/bestpractical/rt/blob/stable/share/html/Elements/ListActions#L49 On 06.10.2016 13:53, David Schmidt wrote: When/Where are the actions added to @Actions? 1) for some reason the \@Actions ArrayRef is empty when I access it in the callback. Where do the Actions come from? I am talking about the links "Reply", "Comment", "Forward", "Stall", ... 2) If I push a simple string to \@Actions they end up in a yellow "Results" Widget. see attached screenshot #local/plugins/RT-Extension-OneClickClose/html/Callbacks/RT-Extension-OneClickClose/Ticket/Display.html/BeforeActionList <%init> use Data::Dumper; $RT::Logger->debug("\n\n###\n".Dumper($Actions)."\n\n###\n"); push @$Actions, "foo"; <%args> $Actions => undef $TicketObj => undef Output: ### $VAR1 = []; ### (/opt/rt4/local/plugins/RT-Extension-OneClickClose/html/Callbacks/RT-Extension-OneClickClose/Ticket/Display.html/BeforeActionList:3) - RT 4.4 and RTIR training sessions, and a new workshop day! https://bestpractical.com/training * Boston - October 24-26 * Los Angeles - Q1 2017 - RT 4.4 and RTIR training sessions, and a new workshop day! https://bestpractical.com/training * Boston - October 24-26 * Los Angeles - Q1 2017 - RT 4.4 and RTIR training sessions, and a new workshop day! https://bestpractical.com/training * Boston - October 24-26 * Los Angeles - Q1 2017
Re: [rt-users] Cannot see changes in UI
--- Begin Message --- Thank you Alex, but I 've already tried that. Not any change appeared! However, the solution is here: https://rt-wiki.bestpractical.com/wiki/CleanMasonCache I had to clear the Mason cache! Dimitris On Tuesday, October 11, 2016 11:35 PM, Alex Hall wrote: At a guess, I'd say to restart your web server. RT seems to need a restart before changes will be reflected in the web UI. --- End Message --- - RT 4.4 and RTIR training sessions, and a new workshop day! https://bestpractical.com/training * Boston - October 24-26 * Los Angeles - Q1 2017
Re: [rt-users] Using self service interface for privileged users in 4.4.1?
Le 11/10/2016 à 20:11, Matt Zagrabelny a écrit : > On Tue, Oct 11, 2016 at 8:05 AM, Alex Hall wrote: >> Hello list, >> I have 4.4.1 running. Someone said on this list that it included the option >> to use the self service interface, even for privileged users? I don't see >> that option in my user preferences. How do I enable it, and can I have a >> toggle for users to switch between the two without leaving the ticket >> they're viewing? Thanks. > Privileged users can always browse to: > > rt.example.com/SelfService > > You can probably use a callback to add a link to the self service URL > for displaying a ticket. link from standard UI to selfservice: rt/local/html/Callbacks/YourOrg/Elements/Tabs/Privileged: <%init> Menu->child( 'simplified-ui' => title => loc("SelfService"), sort_order => 1, path => '/SelfService/', attributes => { style => 'font-style: italic;' }); link back to standard UI from selfservice: rt/local/html/Callbacks/YourOrg/Elements/Tabs/SelfService: <%init> # Add link to full UI if allowed if ( $session{CurrentUser}->Privileged ) { Menu->child( 'full-ui' => title => loc("Full web interface"), sort_order => 1, path => '/index.html', attributes => { style => 'font-style: italic;' }); } ;) - RT 4.4 and RTIR training sessions, and a new workshop day! https://bestpractical.com/training * Boston - October 24-26 * Los Angeles - Q1 2017