// This script installs the RSS Feeder application onto your server.
// System requirements:
//   FirstClass Server version 11 or later
//   FirstClass Application Services version 4154 or later (version 4513 or later preferred)

Exit 11000
CharSet 65001

SETBASE ""
SETRELATIVE FROMBASE PATH ""

// Check if FirstClass Application Services is installed.
IF OBJECT "Clustered Services:FCAS Config" MISSING
  WRITE +C RSS Feeder: FCAS not found - installation aborted!
  ENDSCRIPT
ENDIF

// Check if we have a FirstClass Applications folder.
IF OBJECT "FirstClass Applications" MISSING
  WRITE +C RSS Feeder: FirstClass Applications not found - installation aborted!
  ENDSCRIPT
ENDIF

// Check if we are upgrading or installing.
IF OBJECT "Clustered Services:FCAS Config:Online Applications:rssfeeder.fcx" EXISTS
  WRITE +C RSS Feeder: Upgrading...
ELSE
  WRITE +C RSS Feeder: Installing...
ENDIF

// Update or install the actual application.
SETBASE "Clustered Services:FCAS Config:Online Applications"
SETRELATIVE FROMBASE PATH ""

// Remove old versions of the RSS Feeder.
IF OBJECT RELATIVE "rssfeeder.fcx" EXISTS

  WRITE +C RSS Feeder: Removing existing RSS Feeder application file...
  REMOVE RELATIVE "rssfeeder.fcx"

ENDIF

// Upload the RSS Feeder to Online Applications
WRITE +C RSS Feeder: Uploading new RSS Feeder application file...
NEW RELATIVE "" "rssfeeder.fcx" "FCX File" FCF 9630 0 0 -U
UPLOAD previous "rssfeeder.fcx"

SetRelative FromBase Path ""

SetBase "Groups"

SetRelative FromBase Path ""

IF OBJECT RELATIVE "All RSS Feeds" MISSING

WRITE +C RSS Feeder: Creating All RSS Feeds container template...

New Relative "" "All RSS Feeds" "" FormDoc 23015 0 0 88 88 -U
Put Previous 8120 7 -535 8140 0 8141 0 9 ""
Put Previous 1291.0 7 3
Put Item Previous  8094 14 3378300117
Put Item Previous  8082 0 "Administrator"
Put Item Previous  8121 7 88

Put Permissions Model "All RSS Feeds" 1012 7 0 1006 14 0 1004 14 0 2008 7 0 1000 6 0 1002 6 0 1001 6 1 1007 7 0 2009 7 6 2007 6 1 2016 6 0

SetBase FromBase Path "All RSS Feeds"
SetRelative FromBase Path ""

Put Relative ""  900 0 901 50 902 783 903 299 904 1845
Put Relative ""  13200.0 7 9 13200.1 7 1012 13200.2 7 1000 13200.3 7 7 13200.4 7 8 13200.5 7 1007 13200.6 7 1042 13200.7 7 1016 13200.8 7 1017 13200.9 7 1025 13201.0 7 1 13201.1 7 32 13201.2 7 1 13201.6 7 16 13201.7 7 8 13201.8 7 8 13201.9 7 16
Put Relative ""  13202.3 0 "Feed Name" 13202.4 0 "Feed URL" 13202.5 0 "Destination" 13202.6 0 "Last Update" 13202.7 0 "Last Processed" 13202.8 0 "Total Processed" 13202.9 0 "Last Connection" 13204.3 7 63
Put Relative ""  13204.4 7 200 13204.5 7 63 13204.6 7 60 13204.7 7 20 13204.8 7 20 13204.9 7 60 13209.1 7 1 13209.2 7 1 13209.3 7 1 13209.4 7 1 13209.5 7 1 13209.6 7 1 13209.7 7 1 13209.8 7 1 13209.9 7 1 13206.0 7 7016 13206.1 7 15001
Put Relative ""  13206.2 7 2025 13207.0 7 20 13207.1 7 20 13207.2 7 20 13207.3 7 120 13207.4 7 240 13207.5 7 120 13207.6 7 120 13207.7 7 100 13207.8 7 100 13207.9 7 120 13208.0 7 4 13208.1 7 4 13208.2 7 4 13208.7 7 2 13208.8 7 2
Put Relative ""  13000.0 122 000B0009001403F4001403E8001400070078FFFD000E000800F003EF00780412007803F8006403F9006404010078 -S

Put Relative ""  13100.0 122 000A0009001403F4001403E8001400070078000800F003EF00780412007803F8006403F9006404010078 -S

Put Relative ""  13400.0 0 "RSS Feeder.rez" 13401.0 14 -916671718 13015.0 0 "Trebuchet MS" 13315.0 7 1 13900.0 7 22 13901.0 7 442 13903.0 7 150


// Reference: 1012866:7465329
New Model "All RSS Feeds" "" "RSS Feeder Columns" "" FormDoc 23068 188 84 26 26 -U+X
Put Previous 8120 7 -535 8140 0 8141 0 9 ""
Put Previous 20 "Columns" +FS

// Reference: 1012866:7466218
New Model "All RSS Feeds" "" "RSS Feeder.rez" "FirstClass Resource File" FCF 9630 188 100 -U+X
Upload Previous "RSS Feeder.rez"

Compile Model "All RSS Feeds"


SetRelative FromBase Path ""

ENDIF

WRITE +C RSS Feeder: Installation complete
