[Rt-commit] r4681 - rtir/branches/1.9-EXPERIMENTAL
alexmv at bestpractical.com
alexmv at bestpractical.com
Sat Mar 4 04:34:21 EST 2006
Author: alexmv
Date: Sat Mar 4 04:34:20 2006
New Revision: 4681
Added:
rtir/branches/1.9-EXPERIMENTAL/add-rtfm-objects (contents, props changed)
Modified:
rtir/branches/1.9-EXPERIMENTAL/ (props changed)
rtir/branches/1.9-EXPERIMENTAL/README
Log:
r9461 at zoq-fot-pik: chmrr | 2006-03-03 20:29:47 -0800
* Script to add some default RTIR-related RTFM objects
Modified: rtir/branches/1.9-EXPERIMENTAL/README
==============================================================================
--- rtir/branches/1.9-EXPERIMENTAL/README (original)
+++ rtir/branches/1.9-EXPERIMENTAL/README Sat Mar 4 04:34:20 2006
@@ -82,7 +82,8 @@
1) Once RT 3.7 and other required package have been installed and
appear to be working properly, cd to the directory into which you
- unpacked RTIR into.
+ unpacked RTIR into. If you plan on using RTFM with RTIR, please
+ install RTFM before installing RTIR.
2) Run "perl Makefile.PL" to generate a makefile for RTIR.
@@ -105,6 +106,8 @@
6) Stop and start your web server.
+7) If you are planning on using RTFM with RTIR, run the included
+ 'add-rtfm-objects' script to set up a basic response template.
Added: rtir/branches/1.9-EXPERIMENTAL/add-rtfm-objects
==============================================================================
--- (empty file)
+++ rtir/branches/1.9-EXPERIMENTAL/add-rtfm-objects Sat Mar 4 04:34:20 2006
@@ -0,0 +1,55 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+use lib("/opt/rt3/local/lib", "/opt/rt3/lib");
+$| = 1;
+
+require RT;
+RT::LoadConfig();
+RT::Init();
+
+my $CurrentUser = RT::CurrentUser->new();
+$CurrentUser->LoadByName('RT_System');
+
+require RT::FM::Class;
+my $class = RT::FM::Class->new($CurrentUser);
+$class->Load('Templates');
+unless ($class->Id) {
+ print "Creating 'Templates' RTFM class..";
+ my ($id, $msg) = $class->Create(
+ Name => 'Templates',
+ Description => 'Response templates',
+ HotList => 1
+ );
+ die $msg unless $id;
+ print "Done\n";
+}
+
+my $response = RT::CustomField->new($CurrentUser);
+$response->Load('Response');
+unless ($response->Id) {
+ print "Creating 'Response' RTFM custom field..";
+ my ($id, $msg) = $response->Create(
+ Name => 'Response',
+ Type => 'Text',
+ Description => 'Response to be inserted into the ticket',
+ LookupType => RT::FM::Article->CustomFieldLookupType,
+ );
+ die $msg unless $id;
+ print "Done\n";
+}
+
+$response->AddToObject($class);
+$class->SetAttribute(Name => "Skip-$_", Content => 1)
+ for ("Name", "Summary", "CF-Title-".$response->Id);
+
+my $group = RT::Group->new($CurrentUser);
+$group->LoadUserDefinedGroup( "DutyTeam" );
+die "Can't load group" unless $group->Id;
+$group->PrincipalObj->GrantRight( Right => $_, Object => $response )
+ for qw/SeeCustomField ModifyCustomField/;
+$group->PrincipalObj->GrantRight( Right => $_, Object => $class )
+ for qw/AdminClass AdminTopics CreateArticle ModifyArticle ModifyArticleTopics SeeClass ShowArticle ShowArticleHistory/;
+
+print "Done.\n";
More information about the Rt-commit
mailing list