Can we open an HTML document from DFII?

Discussion in 'Cadence' started by Manju Arasaiah, Oct 22, 2004.

  1. I want to add a view called "html-description" to my cell where
    I can give lot of hyper-linked info about the cell or library
    to the user who is viewing the cell from DFII.

    Can we start a web-browser when he selects this particular view from
    lib-manager? first of all is it possible? I know we can start an ipc process
    to bring up the required page, can we link ipc to lib-manager action?

    Thanks, Manju
     
    Manju Arasaiah, Oct 22, 2004
    #1
  2. Manju Arasaiah

    S. Badel Guest

    S. Badel, Oct 25, 2004
    #2
  3. Manju Arasaiah

    Erik Wanta Guest

    Manju:
    We store all kinds of documents in dfII. It would be nice if Cadence
    had this working right out of the box.

    1. data.reg Information
    http://sourcelink.cadence.com/docs/files/Release_Info/tvm10/caiuser/chap6.html
    2. deRegApp Information
    http://sourcelink.cadence.com/docs/files/Release_Info/ic446/skdfref/chap3.html
    3. How do I create a viewtype and a cellview associated with it?
    http://sourcelink.cadence.com/docs/db/kdb/1993/Oct/1808091.html
    4. How to install FrameMaker files in DM?
    http://sourcelink.cadence.com/docs/db/kdb/1995/Nov/1808566.html
    5. How to add a new viewtype in the dfII environment?
    http://sourcelink.cadence.com/docs/db/kdb/1999/Nov/1836295.html
    6. Design Framework II Help - Registering a Function to Create
    FrameMaker Files as Cellviews
    http://sourcelink.cadence.com/docs/files/Release_Info/ic446/dfhelp/regViewtype.html
    7. Using SKILL to Integrate an External Tool
    http://sourcelink.cadence.com/docs/files/Application_Notes/Framework_Application_Notes/U
    sing_SKILL_to_Integrate_an_External_Tool.html

    data.reg
    DataFormat HTML { Pattern = *.html; Default_Editor = netscapeComposer;
    Co_Managed = *.html master.tag *.htm *.jpeg *.jpg *.gif *.pdf; } Tool
    netscapeComposer {}
    DataFormat FM { Pattern = *.fm; Default_Editor = adobeFrameMaker;
    Co_Managed = *.fm master.tag; } Tool adobeFrameMaker {}
    DataFormat DOC { Pattern = *.doc; Default_Editor = microsoftWord;
    Co_Managed = *.doc master.tag; } Tool microsoftWord {}
    DataFormat PDF { Pattern = *.pdf; Default_Editor = adobeAcrobatReader;
    Co_Managed = *.pdf master.tag; } Tool adobeAcrobatReader {}
    DataFormat PPT { Pattern = *.ppt; Default_Editor =
    microsoftPowerPoint; Co_Managed = *.ppt master.tag; } Tool
    microsoftPowerPoint {}
    DataFormat XLS { Pattern = *.xls; Default_Editor = microsoftExcel;
    Co_Managed = *.xls master.tag; } Tool microsoftExcel {}
    DataFormat SXW { Pattern = *.sxw; Default_Editor = openofficeSwriter;
    Co_Managed = *.sxw master.tag; } Tool openofficeSwriter {}
    DataFormat SXI { Pattern = *.sxi;
    ....

    ;--- adobeAcrobatReader

    ;dummy app trigger to avoid the following error:
    ;*Error* Root class viewType (PDF) must define data/app triggers!
    procedure(PDFAppTrig(argL) t )

    ;dummy enable trigger to avoid the following:
    ;abobeAcrobatReader is not enabled for "a" access. Changing access to
    "read".
    procedure(PDFEnableTrig(@optional argL) t )

    ;register the PDF data trigger if not previously registered
    unless(deViewTypeIsRegistered("PDF")

    ;register the PDF data trigger
    deRegApp(
    ?viewType "PDF"
    ?appName "adobeAcrobatReader"
    ?dataTrigger 'fileDataTrig
    ?appTrigger 'PDFAppTrig
    ?enableTrigger 'PDFEnableTrig
    ?widgetType "none"
    )

    ) ; unless

    ;--- adobeFrameMaker

    ;dummy app trigger to avoid the following error:
    ;*Error* Root class viewType (FM) must define data/app triggers!
    procedure(FMAppTrig(argL) t )

    ;dummy enable trigger to avoid the following:
    ;adobeFrameMaker is not enabled for "a" access. Changing access to
    "read".
    procedure(FMEnableTrig(@optional argL) t )

    ;register the FM data trigger if not previously registered
    unless(deViewTypeIsRegistered("FM")

    ;register the FM data trigger
    deRegApp(
    ?viewType "FM"
    ?appName "adobeFrameMaker"
    ?dataTrigger 'fileDataTrig
    ?appTrigger 'FMAppTrig
    ?enableTrigger 'FMEnableTrig
    ?widgetType "none"
    )

    ) ; unless

    ;--- microsoftExcel

    ;dummy app trigger to avoid the following error:
    ;*Error* Root class viewType (XLS) must define data/app triggers!
    procedure(XLSAppTrig(argL) t )

    ;dummy enable trigger to avoid the following:
    ;msExcel is not enabled for "a" access. Changing access to "read".
    procedure(XLSEnableTrig(@optional argL) t )

    ;register the XLS data trigger if not previously registered
    unless(deViewTypeIsRegistered("XLS")

    ;register the XLS data trigger
    deRegApp(
    ?viewType "XLS"
    ?appName "microsoftExcel"
    ?dataTrigger 'fileDataTrig
    ?appTrigger 'XLSAppTrig
    ?enableTrigger 'XLSEnableTrig
    ?widgetType "none"
    )

    ) ; unless

    ;--- microsoftPowerPoint

    ;dummy app trigger to avoid the following error:
    ;*Error* Root class viewType (PPT) must define data/app triggers!
    procedure(PPTAppTrig(argL) t )

    ;dummy enable trigger to avoid the following:
    ;simpress is not enabled for "a" access. Changing access to "read".
    procedure(PPTEnableTrig(@optional argL) t )

    ;register the PPT data trigger if not previously registered
    unless(deViewTypeIsRegistered("PPT")

    ;register the PPT data trigger
    deRegApp(
    ?viewType "PPT"
    ?appName "microsoftPowerPoint"
    ?dataTrigger 'fileDataTrig
    ?appTrigger 'PPTAppTrig
    ?enableTrigger 'PPTEnableTrig
    ?widgetType "none"
    )

    ) ; unless

    ;--- microsoftWord

    ;dummy app trigger to avoid the following error:
    ;*Error* Root class viewType (DOC) must define data/app triggers!
    procedure(DOCAppTrig(argL) t )

    ;dummy enable trigger to avoid the following:
    ;msWord is not enabled for "a" access. Changing access to "read".
    procedure(DOCEnableTrig(@optional argL) t )

    ;register the DOC data trigger if not previously registered
    unless(deViewTypeIsRegistered("DOC")

    ;register the DOC data trigger
    deRegApp(
    ?viewType "DOC"
    ?appName "microsoftWord"
    ?dataTrigger 'fileDataTrig
    ?appTrigger 'DOCAppTrig
    ?enableTrigger 'DOCEnableTrig
    ?widgetType "none"
    )

    ) ; unless

    ;--- netscapeComposer

    ;dummy app trigger to avoid the following error:
    ;*Error* Root class viewType (HTML) must define data/app triggers!
    procedure(HTMLAppTrig(argL) t )

    ;dummy enable trigger to avoid the following:
    ;netscapeComposer is not enabled for "a" access. Changing access to
    "read".
    procedure(HTMLEnableTrig(@optional argL) t )

    ;register the HTML data trigger if not previously registered
    unless(deViewTypeIsRegistered("HTML")

    ;register the HTML data trigger
    deRegApp(
    ?viewType "HTML"
    ?appName "netscapeComposer"
    ?dataTrigger 'fileDataTrig
    ?appTrigger 'HTMLAppTrig
    ?enableTrigger 'HTMLEnableTrig
    ?widgetType "none"
    )

    ) ; unless

    ;--- openofficeScalc

    ;dummy app trigger to avoid the following error:
    ;*Error* Root class viewType (SXC) must define data/app triggers!
    procedure(SXCAppTrig(argL) t )

    ;dummy enable trigger
    procedure(SXCEnableTrig(@optional argL) t )

    ;register the SXC data trigger if not previously registered
    unless(deViewTypeIsRegistered("SXC")

    ;register the SXC data trigger
    deRegApp(
    ?viewType "SXC"
    ?appName "openofficeScalc"
    ?dataTrigger 'fileDataTrig
    ?appTrigger 'SXCAppTrig
    ?enableTrigger 'SXCEnableTrig
    ?widgetType "none"
    )

    ) ; unless

    ;--- openofficeSimpress

    ;dummy app trigger to avoid the following error:
    ;*Error* Root class viewType (SXI) must define data/app triggers!
    procedure(SXIAppTrig(argL) t )

    ;dummy enable trigger
    procedure(SXIEnableTrig(@optional argL) t )

    ;register the SXI data trigger if not previously registered
    unless(deViewTypeIsRegistered("SXI")

    ;register the SXI data trigger
    deRegApp(
    ?viewType "SXI"
    ?appName "openofficeSimpress"
    ?dataTrigger 'fileDataTrig
    ?appTrigger 'SXIAppTrig
    ?enableTrigger 'SXIEnableTrig
    ?widgetType "none"
    )

    ) ; unless

    ;--- openofficeSwriter

    ;dummy app trigger to avoid the following error:
    ;*Error* Root class viewType (SXW) must define data/app triggers!
    procedure(SXWAppTrig(argL) t )

    ;dummy enable trigger
    procedure(SXWEnableTrig(@optional argL) t )

    ;register the SXW data trigger if not previously registered
    unless(deViewTypeIsRegistered("SXW")

    ;register the SXW data trigger
    deRegApp(
    ?viewType "SXW"
    ?appName "openofficeSwriter"
    ?dataTrigger 'fileDataTrig
    ?appTrigger 'SXWAppTrig
    ?enableTrigger 'SXWEnableTrig
    ?widgetType "none"
    )

    ) ; unless

    ;create object
    ;This function creates the cell view object and
    ;copies the file into it.
    ;It returns the object id.
    procedure(create_object(libName cellName viewName file_path file)
    prog((objId cmd dfII_file_path)
    ;get object Id
    objId = ddGetObj(libName cellName viewName)

    unless(objId~>isWritable
    ;checkout call
    ddAutoCheckout(objId)
    )

    ;checkout failed, error out
    unless(objId~>isWritable
    error("View could not be opened for edit.")
    ) ; unless

    ;delete object
    cmd=sprintf(nil "\\rm -rf %s" objId~>writePath)
    unless(system(cmd)
    error(" ERROR - command failed: %s \n" cmd)
    ) ; unless

    ;create object
    objId = ddGetObj(libName cellName viewName file nil "w" )

    ;get file path
    dfII_file_path = ddGetObjWritePath(objId)

    ;copy the file to the cell view location
    cmd=sprintf(nil "\\cp %s %s" file_path dfII_file_path)
    unless(system(cmd)
    error(" ERROR - command failed: %s \n" cmd)
    ) ; unless

    system(sprintf(nil "chmod +w %s" dfII_file_path))

    ;return the new object id
    return(objId)

    ) ; prog
    ) ; procedure

    ;use existing
    ;This fuction allows the user to select an existing file.
    ;The new cell view object is created and the selected
    ;file is copied.
    ;It returns the object id.
    procedure(use_existing(libName cellName viewName)
    prog((filter file program_file_extension file_extension file_path
    retdia warnText cmd objId dfII_file_path)
    ;get the filter from the data.reg file (returns the Pattern
    (example "*.pdf"))
    filter = ddMapGetViewTypeFileName(viewType)

    ;set the program file extension
    program_file_extension=car(last(parseString(filter ".")))

    ;initialize
    file_path=""
    retdia=t

    ;display path input form until a correct file path is entered or
    the user gives up
    while(!isFile(file_path) || (file_extension !=
    program_file_extension)

    ;display file selection form
    file_path=createFileSelectionForm(filter)

    ;selected file doesn't exist
    if(!isFile(file_path) then
    warnText = sprintf(nil "%L doesn't exist:\nPress YES to try
    again" file_path)
    ;display warning box
    retdia = hiDisplayAppDBox(?name 'xx
    ?dboxBanner " "
    ?dboxText warnText
    ?buttonLayout 'YesNo
    )

    ;file exists, but extension doesn't match program_file_extension
    else
    ;get file
    file = car(last(parseString(file_path "/")))

    ;get file extension
    file_extension = car(last(parseString(file ".")))

    if(program_file_extension != file_extension then
    warnText = sprintf(nil "%s is not a %s file:\nPress YES to
    try again" file viewType)
    ;display warning box
    retdia = hiDisplayAppDBox(?name 'xx
    ?dboxBanner " "
    ?dboxText warnText
    ?buttonLayout 'YesNo
    )
    ) ; if
    ) ; if

    ;user gives up, so exit
    when( !retdia

    ;if open for read, it exists
    objId=ddGetObj(libName cellName viewName filter nil "r")

    if(!objId then

    ;get object Id
    objId = ddGetObj(libName cellName viewName)

    ;delete object
    cmd=sprintf(nil "\\rm -Rf %s" objId~>writePath)
    unless(system(cmd)
    error(" ERROR - command failed: %s \n" cmd)
    ) ; unless
    ) ; if

    ;exit
    return(nil)
    ) ; when
    ) ; while

    ;return the object id
    return(create_object(libName cellName viewName file_path file))

    ) ; prog
    ) ; procedure
     
    Erik Wanta, Oct 29, 2004
    #3
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.