;+
; PROJECT
;           SolarB EIS
;
; NAME
;           EIS_SAVE_IMPORTED_RASTER
;
; PURPOSE
;           Procedure
;
; CATEGORY
;           EIS Technical Planning
;
; INPUTS
;           block - a bunch of lines of text
;
; WRITTEN
;           John A Rainnie, RAL, Feb-2006
;
; MODIFICATION HISTORY
;           v0.l JAR 10-Feb-2007
;               Removed fix__zdbase and now using eis_open_db
;
;-
;************************************************************************
PRO eis_save_imported_raster , ra , tlbID = tlbID

DEFSYSV , '!PRIV', 2
;
; Check line list title is unique
;
unique = eis_title_unique(ra.title , ra.acronym , /RASTER)
;
; Raster titles don't have to be unique
;
; It'd be a good idea (later) to check if the supplied raster title is
; unique, and then compare/match the supplied raster with those already
; in the database. This will reduce redundancy. However, that's for 
; another day!

;
; Ensure Acronym is unique
;
IF (unique.unique_acron EQ 0) THEN BEGIN

    obj = OBJ_NEW('eis_import_acronym_gui',tlbID=tlbID,ra)
    obj->Realize
    obj->XMANAGER
    obj->getProperty , structure = ra
    RETURN

ENDIF

;
; Generate new ID
;
status = eis_open_db(/RASTER)
n      = db_info('entries')
new_id = n[0] + 1
; Update raster ID
ra.id = new_id

; Finally save the raster
db_save_raster_entry_create , ra , tlbID = tlbID

END
