[Rt-commit] rt branch, 4.6/lifecycle-ui-dev, repushed

Craig Kaiser craig at bestpractical.com
Mon Dec 16 13:14:10 EST 2019


The branch 4.6/lifecycle-ui-dev was deleted and repushed:
       was 2c4ce14695d6cf578016521620b02a4f0b7237d5
       now 30bf4681d0470dfd958bbac4dda35f5b0b6f4b9a

1: 2c4ce14695 ! 1: 30bf4681d0 Lifecycle-UI
    @@ -1,119 +1,6 @@
     Author: Craig Kaiser <craig at bestpractical.com>
     
    -    Core Lifecycle-UI
    -
    -diff --git a/etc/acl.Pg b/etc/acl.Pg
    ---- a/etc/acl.Pg
    -+++ b/etc/acl.Pg
    -@@
    -         CustomRoles
    -         objectcustomroles_id_seq
    -         ObjectCustomRoles
    -+        databasesettings_id_seq
    -+        DatabaseSettings
    -     );
    - 
    -     my $db_user = RT->Config->Get('DatabaseUser');
    -
    -diff --git a/etc/schema.Oracle b/etc/schema.Oracle
    ---- a/etc/schema.Oracle
    -+++ b/etc/schema.Oracle
    -@@
    -         LastUpdated     DATE
    - );
    - CREATE UNIQUE INDEX ObjectCustomRoles1 ON ObjectCustomRoles (ObjectId, CustomRole);
    -+
    -+CREATE SEQUENCE DatabaseSettings_seq;
    -+CREATE TABLE DatabaseSettings (
    -+    id              NUMBER(11,0)    CONSTRAINT DatabaseSettings_key PRIMARY KEY,
    -+    Name            VARCHAR2(255) CONSTRAINT DatabaseSettings_Name_Unique unique  NOT NULL,
    -+    Content         CLOB,
    -+    ContentType     VARCHAR2(80),
    -+    Disabled        NUMBER(11,0) DEFAULT 0 NOT NULL,
    -+    Creator         NUMBER(11,0)    DEFAULT 0 NOT NULL,
    -+    Created         DATE,
    -+    LastUpdatedBy   NUMBER(11,0)    DEFAULT 0 NOT NULL,
    -+    LastUpdated     DATE
    -+);
    -+
    -+CREATE UNIQUE INDEX DatabaseSettings1 ON DatabaseSettings (LOWER(Name));
    -+CREATE INDEX DatabaseSettings2 ON DatabaseSettings (Disabled);
    -+
    -
    -diff --git a/etc/schema.Pg b/etc/schema.Pg
    ---- a/etc/schema.Pg
    -+++ b/etc/schema.Pg
    -@@
    - );
    - 
    - CREATE UNIQUE INDEX ObjectCustomRoles1 ON ObjectCustomRoles (ObjectId, CustomRole);
    -+
    -+CREATE SEQUENCE databasesettings_id_seq;
    -+CREATE TABLE DatabaseSettings (
    -+    id                integer         DEFAULT nextval('databasesettings_id_seq'),
    -+    Name              varchar(255)    NOT NULL,
    -+    Content           text            NULL,
    -+    ContentType       varchar(80)     NULL,
    -+    Disabled          integer         NOT NULL DEFAULT 0 ,
    -+    Creator           integer         NOT NULL DEFAULT 0,
    -+    Created           timestamp                DEFAULT NULL,
    -+    LastUpdatedBy     integer         NOT NULL DEFAULT 0,
    -+    LastUpdated       timestamp                DEFAULT NULL,
    -+    PRIMARY KEY (id)
    -+);
    -+
    -+CREATE UNIQUE INDEX DatabaseSettings1 ON DatabaseSettings (LOWER(Name));
    -+CREATE INDEX DatabaseSettings2 ON DatabaseSettings (Disabled);
    -+
    -
    -diff --git a/etc/schema.SQLite b/etc/schema.SQLite
    ---- a/etc/schema.SQLite
    -+++ b/etc/schema.SQLite
    -@@
    -   PRIMARY KEY (id)
    - );
    - CREATE UNIQUE INDEX ObjectCustomRoles1 ON ObjectCustomRoles (ObjectId, CustomRole);
    -+
    -+CREATE TABLE DatabaseSettings (
    -+    id                INTEGER PRIMARY KEY,
    -+    Name              varchar(255)    collate NOCASE NOT NULL,
    -+    Content           longtext        collate NOCASE NULL,
    -+    ContentType       varchar(80)     collate NOCASE NULL,
    -+    Disabled          int2            NOT NULL DEFAULT 0,
    -+    Creator           int(11)         NOT NULL DEFAULT 0,
    -+    Created           timestamp                DEFAULT NULL,
    -+    LastUpdatedBy     int(11)         NOT NULL DEFAULT 0,
    -+    LastUpdated       timestamp                DEFAULT NULL
    -+);
    -+
    -+CREATE UNIQUE INDEX DatabaseSettings1 ON DatabaseSettings (Name);
    -+CREATE INDEX DatabaseSettings2 ON DatabaseSettings (Disabled);
    -+
    -
    -diff --git a/etc/schema.mysql b/etc/schema.mysql
    ---- a/etc/schema.mysql
    -+++ b/etc/schema.mysql
    -@@
    - ) ENGINE=InnoDB CHARACTER SET utf8;
    - 
    - CREATE UNIQUE INDEX ObjectCustomRoles1 ON ObjectCustomRoles (ObjectId, CustomRole);
    -+
    -+CREATE TABLE DatabaseSettings (
    -+    id                int(11)         NOT NULL AUTO_INCREMENT,
    -+    Name              varchar(255)    NOT NULL,
    -+    Content           longblob        NULL,
    -+    ContentType       varchar(80)     CHARACTER SET ascii NULL,
    -+    Disabled          int2            NOT NULL DEFAULT 0,
    -+    Creator           int(11)         NOT NULL DEFAULT 0,
    -+    Created           datetime                 DEFAULT NULL,
    -+    LastUpdatedBy     int(11)         NOT NULL DEFAULT 0,
    -+    LastUpdated       datetime                 DEFAULT NULL,
    -+    PRIMARY KEY (id)
    -+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
    -+
    -+CREATE UNIQUE INDEX DatabaseSettings1 ON DatabaseSettings (Name);
    -+CREATE UNIQUE INDEX DatabaseSettings2 ON DatabaseSettings (Disabled);
    -+
    +    Lifecycle-UI
     
     diff --git a/lib/RT/Interface/Web.pm b/lib/RT/Interface/Web.pm
     --- a/lib/RT/Interface/Web.pm
    @@ -180,14 +67,6 @@
     --- a/lib/RT/Lifecycle.pm
     +++ b/lib/RT/Lifecycle.pm
     @@
    - 
    - use strict;
    - use warnings;
    -+use Storable ();
    - 
    - 
    - package RT::Lifecycle;
    -@@
      our %LIFECYCLES_CACHE;
      our %LIFECYCLES_TYPES;
      
    @@ -210,12 +89,6 @@
              @_,
          );
     +    $args{'Type'} = $args{'Type'} // 'ticket';
    -+
    -+    my $needs_update = RT->System->LifecycleCacheNeedsUpdate;
    -+    if ($needs_update > $lifecycle_cache_time) {
    -+        $self->FillCache();
    -+        $lifecycle_cache_time = $needs_update;
    -+    }
      
     -    if (defined $args{Name} and exists $LIFECYCLES_CACHE{ $args{Name} }) {
     -        $self->{'name'} = $args{Name};
    @@ -229,6 +102,12 @@
     -        $self->{'type'} = $args{Type};
     -    } else {
     -        return undef;
    ++    my $needs_update = RT->System->LifecycleCacheNeedsUpdate;
    ++    if ($needs_update > $lifecycle_cache_time) {
    ++        $self->FillCache();
    ++        $lifecycle_cache_time = $needs_update;
    ++    }
    ++
     +    my $load_class = sub {
     +        if (defined $args{Name} and exists $LIFECYCLES_CACHE{ $args{Name} }) {
     +            $self->{'name'} = $args{Name};
    @@ -342,7 +221,6 @@
     +        );
     +        return ($ok, $msg) if !$ok;
     +    }
    -+
     +    RT->System->LifecycleCacheNeedsUpdate(1);
     +
     +    return 1;
    @@ -510,59 +388,6 @@
     +}
     +
      1;
    -
    -diff --git a/lib/RT/System.pm b/lib/RT/System.pm
    ---- a/lib/RT/System.pm
    -+++ b/lib/RT/System.pm
    -@@
    -     }
    - }
    - 
    -+=head2 ConfigCacheNeedsUpdate ( 1 )
    -+
    -+Attribute to decide when we need to flush the database settings
    -+and re-register any changes.  Set when settings are created, enabled/disabled, etc.
    -+
    -+If passed a true value, will update the attribute to be the current time.
    -+
    -+=cut
    -+
    -+sub ConfigCacheNeedsUpdate {
    -+    my $self = shift;
    -+    my $time = shift;
    -+
    -+    if ($time) {
    -+        return $self->SetAttribute(Name => 'ConfigCacheNeedsUpdate', Content => $time);
    -+    } else {
    -+        my $cache = $self->FirstAttribute('ConfigCacheNeedsUpdate');
    -+        return (defined $cache ? $cache->Content : 0 );
    -+    }
    -+}
    -+
    -+=head2 LifecycleCacheNeedsUpdate ( 1 )
    -+
    -+Attribute to decide when we need to flush the list of lifecycles
    -+and re-register any changes. This is needed for the lifecycle UI editor.
    -+
    -+If passed a true value, will update the attribute to be the current time.
    -+
    -+=cut
    -+
    -+sub LifecycleCacheNeedsUpdate {
    -+    my $self   = shift;
    -+    my $update = shift;
    -+
    -+    if ($update) {
    -+        return $self->SetAttribute(Name => 'LifecycleCacheNeedsUpdate', Content => time);
    -+    } else {
    -+        my $cache = $self->FirstAttribute('LifecycleCacheNeedsUpdate');
    -+        return (defined $cache ? $cache->Content : 0 );
    -+    }
    -+}
    -+
    - =head2 AddUpgradeHistory package, data
    - 
    - Adds an entry to the upgrade history database. The package can be either C<RT>
     
     diff --git a/share/html/Admin/Lifecycles/Create.html b/share/html/Admin/Lifecycles/Create.html
     new file mode 100644
    @@ -1122,9 +947,9 @@
     +          </div>
     +          <div class="col-md-9 value">
     +            <select class="selectpicker form-control" id="type" name="type">
    -+              <option value="initial">initial</option>
    -+              <option value="active">active</option>
    -+              <option value="inactive">inactive</option>
    ++              <option value="initial">Initial</option>
    ++              <option value="active">Active</option>
    ++              <option value="inactive">Inactive</option>
     +            </select>
     +          </div>
     +        </div>
    @@ -1428,123 +1253,6 @@
              ($can_modify ? (title_href => RT->Config->Get('WebPath')."/Ticket/ModifyDates.html?id=".$Ticket->Id) : ()),
              class => 'ticket-info-dates',
     
    -diff --git a/share/html/Ticket/Elements/ShowSummary.orig b/share/html/Ticket/Elements/ShowSummary.orig
    -new file mode 100644
    ---- /dev/null
    -+++ b/share/html/Ticket/Elements/ShowSummary.orig
    -@@
    -+%# BEGIN BPS TAGGED BLOCK {{{
    -+%#
    -+%# COPYRIGHT:
    -+%#
    -+%# This software is Copyright (c) 1996-2019 Best Practical Solutions, LLC
    -+%#                                          <sales at bestpractical.com>
    -+%#
    -+%# (Except where explicitly superseded by other copyright notices)
    -+%#
    -+%#
    -+%# LICENSE:
    -+%#
    -+%# This work is made available to you under the terms of Version 2 of
    -+%# the GNU General Public License. A copy of that license should have
    -+%# been provided with this software, but in any event can be snarfed
    -+%# from www.gnu.org.
    -+%#
    -+%# This work 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
    -+%# General Public License for more details.
    -+%#
    -+%# You should have received a copy of the GNU General Public License
    -+%# along with this program; if not, write to the Free Software
    -+%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    -+%# 02110-1301 or visit their web page on the internet at
    -+%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
    -+%#
    -+%#
    -+%# CONTRIBUTION SUBMISSION POLICY:
    -+%#
    -+%# (The following paragraph is not intended to limit the rights granted
    -+%# to you to modify and distribute this software under the terms of
    -+%# the GNU General Public License and is only of importance to you if
    -+%# you choose to contribute your changes and enhancements to the
    -+%# community by submitting them to Best Practical Solutions, LLC.)
    -+%#
    -+%# By intentionally submitting any modifications, corrections or
    -+%# derivatives to this work, or any other work intended for use with
    -+%# Request Tracker, to Best Practical Solutions, LLC, you confirm that
    -+%# you are the copyright holder for those contributions and you grant
    -+%# Best Practical Solutions,  LLC a nonexclusive, worldwide, irrevocable,
    -+%# royalty-free, perpetual, license to use, copy, create derivative
    -+%# works based on those contributions, and sublicense and distribute
    -+%# those contributions and any derivatives thereof.
    -+%#
    -+%# END BPS TAGGED BLOCK }}}
    -+<div class="row ticket-summary">
    -+  <div class="boxcontainer col-md-6">
    -+% $m->callback( %ARGS, CallbackName => 'LeftColumnTop' );
    -+    <&| /Widgets/TitleBox, title => loc('The Basics'),
    -+        (($can_modify || $can_modify_cf) ? (title_href => RT->Config->Get('WebPath')."/Ticket/Modify.html?id=".$Ticket->Id) : ()),
    -+        class => 'ticket-info-basics',
    -+    &><& /Ticket/Elements/ShowBasics, Ticket => $Ticket &></&>
    -+% $m->callback( %ARGS, CallbackName => 'AfterBasics' );
    -+    <& /Elements/ShowCustomFieldCustomGroupings,
    -+        Object       => $Ticket,
    -+        title_href   => ($can_modify || $can_modify_cf) ? RT->Config->Get('WebPath')."/Ticket/Modify.html" : "",
    -+        &>
    -+
    -+    <&| /Widgets/TitleBox, title => loc('People'),
    -+        (($can_modify || $can_modify_owner || $can_modify_people) ? (title_href => RT->Config->Get('WebPath')."/Ticket/ModifyPeople.html?id=".$Ticket->Id) : ()),
    -+        class => 'ticket-info-people',
    -+    &><& /Ticket/Elements/ShowPeople, Ticket => $Ticket &></&>
    -+% $m->callback( %ARGS, CallbackName => 'AfterPeople' );
    -+    <& /Ticket/Elements/ShowAttachments, Ticket => $Ticket, Attachments => $Attachments, Count => RT->Config->Get('AttachmentListCount') &>
    -+% $m->callback( %ARGS, CallbackName => 'AfterAttachments' );
    -+    <& /Ticket/Elements/ShowRequestor, Ticket => $Ticket &>
    -+% $m->callback( %ARGS, CallbackName => 'LeftColumn' );
    -+  </div>
    -+  <div class="boxcontainer col-md-6">
    -+% $m->callback( %ARGS, CallbackName => 'RightColumnTop' );
    -+% if ( RT->Config->Get('EnableReminders') ) {
    -+    <&|/Widgets/TitleBox, title => loc("Reminders"),
    -+        title_href => RT->Config->Get('WebPath')."/Ticket/Reminders.html?id=".$Ticket->Id,
    -+        class => 'ticket-info-reminders fullwidth',
    -+    &>
    -+        <form action="<%RT->Config->Get('WebPath')%>/Ticket/Display.html" name="UpdateReminders" id="UpdateReminders" method="post">
    -+            <& /Ticket/Elements/Reminders, Ticket => $Ticket, ShowCompleted => 0 &>
    -+        </form>
    -+    </&>
    -+% }
    -+% $m->callback( %ARGS, CallbackName => 'AfterReminders' );
    -+    <&| /Widgets/TitleBox, title => loc("Dates"),
    -+        ($can_modify ? (title_href => RT->Config->Get('WebPath')."/Ticket/ModifyDates.html?id=".$Ticket->Id) : ()),
    -+        class => 'ticket-info-dates',
    -+    &><& /Ticket/Elements/ShowDates, Ticket => $Ticket &></&>
    -+% $m->callback( %ARGS, CallbackName => 'AfterDates' );
    -+% my (@extra);
    -+% push @extra, titleright_raw => '<a href="'. RT->Config->Get('WebPath'). '/Ticket/Graphs/index.html?id='.$Ticket->id.'">'.loc('Graph').'</a>' unless RT->Config->Get('DisableGraphViz');
    -+<& /Ticket/Elements/ShowAssets, Ticket => $Ticket &>
    -+% $m->callback( %ARGS, CallbackName => 'LinksExtra', extra => \@extra );
    -+    <&| /Widgets/TitleBox, title => loc('Links'),
    -+        ($can_modify ? (title_href => RT->Config->Get('WebPath')."/Ticket/ModifyLinks.html?id=".$Ticket->Id) : ()),
    -+        class => 'ticket-info-links',
    -+        @extra,
    -+    &><& /Elements/ShowLinks, Object => $Ticket &></&>
    -+% $m->callback( %ARGS, CallbackName => 'RightColumn' );
    -+  </div>
    -+</div>
    -+<%ARGS>
    -+$Ticket => undef
    -+$Attachments => undef
    -+</%ARGS>
    -+<%INIT>
    -+my $can_modify = $Ticket->CurrentUserHasRight('ModifyTicket');
    -+my $can_modify_cf = $Ticket->CurrentUserHasRight('ModifyCustomField');
    -+my $can_modify_owner = $Ticket->CurrentUserCanSetOwner();
    -+my $can_modify_people = $Ticket->CurrentUserHasRight('Watch')
    -+                     || $Ticket->CurrentUserHasRight('WatchAsAdminCc');
    -+</%INIT>
    -
     diff --git a/share/static/css/elevator-light/lifecycleui.css b/share/static/css/elevator-light/lifecycleui.css
     new file mode 100644
     --- /dev/null
    @@ -1989,26 +1697,26 @@
     +        UpdateNode(element) {
     +            var self = this;
     +            const nodeInput = jQuery("#lifeycycle-ui-edit-node");
    -+            nodeInput.css( {position:"absolute", top:event.pageY - 275, left: event.pageX + 15});
    ++
    ++            var posX = event.pageX;
    ++            var posY =  event.pageY;
    ++
    ++            if ( posX + nodeInput.width() > self.width ) posX = self.width - nodeInput.width();
    ++            if ( posY + nodeInput.height() > self.height ) posY = self.height - nodeInput.height();
    ++
    ++            nodeInput.css( {position:"absolute", top:posY - self.node_radius, left: posX - self.node_radius});
     +
     +            var list = document.getElementById('lifeycycle-ui-edit-node').querySelectorAll('input, select');
     +
     +            if ( element ) {
     +                for (let item of list) {
     +                    jQuery(item).val(element[item.name]);
    -+                    // Can we make this check for the select bootstrap class instead of hard coding the known fields?
    -+                    if ( item.name === 'type' ) {
    -+                        var type = jQuery(".bootstrap-select .filter-option");
    -+                        if ( type ) {
    -+                            type.text(element[item.name]);
    -+                        }
    -+                    }
     +                }
     +                self.editing_node = element;
     +            }
     +            else {
     +                var name = document.getElementsByName('name')[0].value;
    -+                if ( self.nodes.findIndex(x => x.name == name ) >= 2 || name === '' ) {
    ++                if ( self.nodes.reduce((n, x) => n + (x.name === name), 0) > 1 || name === '' ) {
     +                    var form  = jQuery('#lifeycycle-ui-edit-node');
     +                    var field = jQuery('<div class="alert alert-warning removing">Name invalid</div>');
     +                    form.prepend(field);



More information about the rt-commit mailing list