Function

TTemplate.Clone

Module

uTemplates

Last Modified

7/15/2014 3:26:44 PM

Comments

Creates a new Template that looks like the old one, but with a new Owner  
 - an example of where this is needed:  when a shared template in a user's 
   personal folder is modified, we need to create a copy of the shared     
   template, make it a personal template, and make the changes to the copy

Visibility

Public

Owner

TTemplate

Declaration

function Clone(Owner: Int64): TTemplate;

Calls Hierarchy


TTemplate.Clone
 ├TTemplate.TrueClone
 │ ├TTemplate.GetChildren
 │ ├TTemplate.Create
 │ │ └TTemplate.ReminderDialogIEN
 │ ├TTemplate.SetBoilerplate
 │ │ ├TTemplate.CanModify
 │ │ │ ├TTemplate.ValidID
 │ │ │ └LockTemplate
 │ │ └TTemplate.ValidID
 │ ├TTemplate.GetBoilerplate
 │ │ └GetTemplateBoilerplate
 │ ├TTemplate.SetDescription
 │ │ ├TTemplate.CanModify...
 │ │ └TTemplate.ValidID
 │ └TTemplate.GetDescription
 │   └LoadTemplateDescription
 ├TTemplate.GetItems
 │ └ExpandTemplate
 │   ├TTemplate.GetChildren
 │   ├GetTemplateChildren
 │   ├AddTemplate
 │   │ ├TTemplate.Create...
 │   │ └TTemplate.AddChild
 │   │   └TTemplate.GetItems...
 │   └TTemplate.ItemIENs
 │     └TTemplate.GetItems...
 └TTemplate.BackupItems
   └TTemplate.ItemIENs...

Called-By Hierarchy


                                 TTemplate.Clone
                      TfrmTemplateEditor.Clone┘ 
              TfrmTemplateEditor.btnNewClick┤   
                             EditTemplates┤ │   
     TfrmDCSumm.popSummMemoTemplateClick┤ │ │   
          TfrmDCSumm.mnuNewTemplateClick┤ │ │   
        TfrmDCSumm.mnuEditTemplatesClick┤ │ │   
  TfrmDCSumm.mnuEditSharedTemplatesClick┤ │ │   
    TfrmDCSumm.mnuNewSharedTemplateClick┤ │ │   
   TfrmConsults.popNoteMemoTemplateClick┤ │ │   
      TfrmConsults.mnuEditTemplatesClick┤ │ │   
        TfrmConsults.mnuNewTemplateClick┤ │ │   
TfrmConsults.mnuEditSharedTemplatesClick┤ │ │   
  TfrmConsults.mnuNewSharedTemplateClick┤ │ │   
       TfrmDrawers.mnuEditTemplatesClick┤ │ │   
         TfrmDrawers.mnuNewTemplateClick┤ │ │   
    TfrmSurgery.popNoteMemoTemplateClick┤ │ │   
       TfrmSurgery.mnuEditTemplatesClick┤ │ │   
         TfrmSurgery.mnuNewTemplateClick┤ │ │   
 TfrmSurgery.mnuEditSharedTemplatesClick┤ │ │   
   TfrmSurgery.mnuNewSharedTemplateClick┤ │ │   
      TfrmNotes.popNoteMemoTemplateClick┤ │ │   
         TfrmNotes.mnuEditTemplatesClick┤ │ │   
           TfrmNotes.mnuNewTemplateClick┤ │ │   
   TfrmNotes.mnuEditSharedTemplatesClick┤ │ │   
     TfrmNotes.mnuNewSharedTemplateClick┘ │ │   
        TfrmTemplateEditor.mnuAutoGenClick┤ │   
 TfrmTemplateEditor.mnuImportTemplateClick┘ │   
         TfrmTemplateEditor.edtNameOldChange┤   
       TfrmTemplateEditor.tvTreeNodeEdited┤ │   
        TfrmTemplateEditor.mnuAutoGenClick┘ │   
            TfrmTemplateEditor.cbActiveClick┤   
           TfrmTemplateEditor.cbExcludeClick┤   
             TfrmTemplateEditor.edtGapChange┤   
            TfrmTemplateEditor.sbMoveUpClick┤   
          TfrmTemplateEditor.sbMoveDownClick┤   
            TfrmTemplateEditor.sbDeleteClick┤   
     TfrmTemplateEditor.mnuNodeDeleteClick┤ │   
          TfrmTemplateEditor.tvTreeKeyDown┘ │   
           TfrmTemplateEditor.tvTreeDragDrop┤   
        TfrmTemplateEditor.sbCopyLeftClick┤ │   
       TfrmTemplateEditor.sbCopyRightClick┤ │   
      TfrmTemplateEditor.mnuNodePasteClick┘ │   
                                   ..(rec)..┤   
             TfrmTemplateEditor.reBoilChange┤   
            TfrmTemplateEditor.reNotesChange┤   
                  TfrmTemplateEditor.cbClick┤   
     TfrmTemplateEditor.cbDisplayOnlyClick┤ │   
       TfrmTemplateEditor.cbFirstLineClick┤ │   
     TfrmTemplateEditor.cbOneItemOnlyClick┤ │   
    TfrmTemplateEditor.cbHideDlgItemsClick┤ │   
       TfrmTemplateEditor.cbHideItemsClick┤ │   
          TfrmTemplateEditor.cbIndentClick┤ │   
            TfrmTemplateEditor.cbLockClick┘ │   
            TfrmTemplateEditor.cbxTypeChange┤   
         TfrmTemplateEditor.cbxRemDlgsChange┘   

Calls

Name Declaration Comments
TTemplate.BackupItems procedure BackupItems; -
TTemplate.GetItems function GetItems: TList; -
TTemplate.TrueClone function TrueClone: TTemplate; -

Called-By

Name Declaration Comments
TfrmTemplateEditor.Clone function Clone(Node: TTreeNode): boolean; -


Source

1981  function TTemplate.Clone(Owner: Int64): TTemplate;
1982  var
1983    i: integer;
1984  
1985  begin
1986    Result := Self;
1987    if(FPersonalOwner <> Owner) and (RealType in [ttDoc, ttGroup, ttClass]) then
1988    begin
1989      Result := TrueClone;
1990      Result.FCloning := TRUE;
1991      try
1992        Result.FID := '0';
1993        GetItems;
1994        Result.FPersonalOwner := Owner;
1995        Result.Expanded := TRUE;
1996        Result.GetItems;
1997        for i := 0 to Items.Count-1 do
1998          Result.Items.Add(Items[i]);
1999        Result.BackupItems;
2000        Templates.AddObject(Result.ID, Result);
2001      finally
2002        Result.FCloning := FALSE;
2003      end;
2004    end;
2005  end;