Resource

Resource Basics

Resource Name After IDImager V5 conversion to Photo Supreme
Resource Version 1.1
Category Catalog
Downloads 883
Release Date 1/17/2016 4:50:17 PM
 

Resource Details

Description This script will perform some extra required tasks that are needed for database that are converted from the older IDimager V5 application to Photo Supreme.

IMPORTANT; RUNNING THIS SCRIPT IS MANDATORY FOR CONVERTED DATABASES. RUNNING PSU WITH A CONVERTED DATABASE WILL GIVE INACCURATE RESULTS
Installation Instructions Download the script to your hard drive
Usage Instructions 1. Start Photo Supreme
2. Select Tools-Scripter
3. Load the downloaded script
4. Run the script by clicking the Run button in the toolbar of the Scripter
Changes in this version n.a.
Special Requirements Photo Supreme V4.0 or up
 

Author Information

Author Name IDimager
 

Script

{
  Author: IDimager
  Version: 1.1

  Changes:
  1.1: Added support for PSU v4
  1.0: Initial version
}

  procedure UpdateCollection(AColl: TImageCollection);
  var
    i: Integer;
  begin
    for i := 0 to AColl.SubFolders.Count - 1 do
    begin
      AColl.SubFolders.Items[i].ParentOrder := i;
      PublicCatalog.UpdateCollection(AColl.SubFolders.Items[i]);
      // recursive call
      UpdateCollection(AColl.SubFolders.Items[i]);
    end;
  end;

  procedure UpdateGallery(AGall: TImageGallery);
  var
    i: Integer;
  begin
    for i := 0 to AGall.Collections.Count - 1 do
    begin
      AGall.Collections.Items[i].ParentOrder := i;
      PublicCatalog.UpdateCollection(AGall.Collections.Items[i]);

      UpdateCollection(AGall.Collections.Items[i]);
    end;
  end;

  procedure UpdatePortfolio(AModel: TImageModel);
  var
    i: Integer;
  begin
    if AModel.Galleries.Count = 0 then exit;

    for i := 0 to AModel.Galleries.Count - 1 do
    begin
      UpdateGallery(AModel.Galleries.Items[i]);

    end;
  end;

  procedure ReorderPortfolios;
  var
    APortfolios: TImageModelItems;
    i: Integer;
  begin
    APortfolios := TImageModelItems.Create(TImageModelItem, '');
    PublicCatalog.EnumModels(APortfolios, True, False, False);
    for i := 0 to APortfolios.Count - 1 do
      UpdatePortfolio(APortfolios.Items[i].Model);
    APortfolios.Free;
  end;

begin
  if not Ask2('Are you sure you want to continue?', 'This script will convert an IDimager database to Photo Supreme. This can take a while to complete, depending on the size of your Catalog.' + CrLf2 + 'PLEASE DO NOT KILL THE APPLICATION WHILE THIS SCRIPT RUNS, EVEN WHEN THE OPERATING SYSTEM INDICATES THAT THE APPLICATION IS NOT RESPONDING.' + CrLf2) then exit;

  ReorderPortfolios;
  PublicCatalog.BuildSearchData;

  Say('Done');
end;