DisplayAgentThreadsV2-ShorteningDateColumn

From 40tude Dialog Wiki

Display Threads in Agent-\Xnews-Style (v2) & Shortening the date-column

This script is a merged OnArticleListPaint-Script done by Andreas Oeser, containing the following scripts:


Setup & Installation

You'll have to make the following changes in the header layout.

Header Layout changes:
Change Subject column to %subjectnamechange%
In Name (From) column change to %threadindent%%fromname%


Setup Date-Column:
To modify the date-column, change DATESTR='dd.mm.yy hh:nn'; as your own wish.


Paste the script in Event scripts -> OnArticleListPaint, save, compile and run. The column numbers affected are in the const statement.


Warning

Please read the Painting script warning page before trying out this script.


program OnArticleListPaint;

const
  n_subject_column=4;
  n_from_column=3;
  n_date=5; 
  DATESTR='dd.mm.yy hh:nn';

function IsIndented(PaintString:widestring) : boolean;
var
  c : widestring;
begin
  c := copy(PaintString, 1, 1)
  result := (c = ' ');
end;

function Subject(PaintString:widestring) : widestring;
var
  n:integer;
begin
  n:=pos(' (', PaintString);
  if n > 0 then result := copy(PaintString, 1, n)
  else result := PaintString;
end;

function From(PaintString:widestring) : widestring;
begin
  if IsIndented(PaintString) then result := ''
  else result := PaintString;
end;

function
OnArticleListPaint(PaintString:widestring;ColumnIndex:integer):widestring;
begin
  case ColumnIndex of
    n_subject_column: result := Subject(PaintString);
    n_from_column:    result := From(PaintString);  
    n_date:           result := FormatDateTime(DATESTR, StrToDateTime(PaintString));
    else result := PaintString;
  end;
end;

begin
end.

René Fischer