Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Challenges of developing a Web Application
Message
From
26/03/2018 10:06:58
 
 
To
26/03/2018 09:10:43
General information
Forum:
Visual FoxPro
Category:
FoxInCloud
Miscellaneous
Thread ID:
01658961
Message ID:
01658995
Views:
64
Hi Christian,

>Can you give me an example how to code features only for web or desktop?

from http://foxincloud.com/tutotest/bs/report.tuto (simplified)
if thisForm.wlWeb && APPLICATION RUNS IN WEB MODE (ELSE is desktop mode)

  && {en} Manual FIC adaptation: report to PDF in Web mode using a PDF generator
  && {fr} Adaptation manuelle FiC : générer un état PDF avec un générateur

  lcPDFout = Textmerge([<<Addbs(Sys(2023))>>customer_<<Trim(m.customerID)>>_<<m.lcPDFengine>>.pdf]) && PDF > VFP temp folder

  try

      local oXFRXlistener as XFRXlistener of xfrx.app

      oXFRXlistener = Evaluate("xfrx('XFRX#LISTENER')")
      success = Vartype(m.oXFRXlistener) == 'O'
      if m.success

        result = m.oXFRXlistener.setParams(; && doc: https://eqeuscom.atlassian.net/wiki/display/DOC/Properties+and+methods+common+in+XFRXListener+and+XFRXSession+classes
            m.lcPDFout; && tcOutputName - name of the document to create.
          , ; && tcTempDirectory - [optional] directory where temporary files will be created. If blank, the temporary files will be created in the current directory
          , .T.; && tlNotOpenViewer - [optional] if set to .T., documents won't be opened after the generation
          , ; && tcCodePage - [optional] codepage of the generated document. If you don't specify this parameter, cpcurrent() is used
          , .T.; && tlSilent - [optional] if set to .T., no messages will be printed. This option is useful if your application is not in English and/or you would like to handle the Processing... message and error messages in your code.
          , ; && tlNewSession - [optional] This option is not used for PDF targets. If set to .T., the document will always be open in a new Word session. By default, word document will be open in the current Word session, if exists.
          , 'PDF'; && tcTarget - The output type to be generated. One of the values listed at XFRX Output Target Types.
          )
        success = Empty(m.result)
        if m.success

          * --------------------------------
          REPORT FORM customer;
            for customer_ID = m.customerID;
            object m.oXFRXlistener
          * --------------------------------

        else
          result = m.oXFRXlistener.ErrorMessage(m.result)
        endif
      else
        result = [could not instantiate XFRX report listener]
      endif

  catch to m.result
    success = .F.
    result = cException (m.result)
  endtry
  
  * {en} Now display generated PDF to the User
  * {fr} Afficher le PDF généré à l'utilisateur
     thisForm.wForm(;
       'reportChild.scx';
      , .F.; && modeless
      , m.lcPDFout;
      )

    && {en} as we no longer use the 'DO FORM' command,
    && {en} project manager is no longer able to figure out that the 'reportChild.scx' form
    && {en} should be added/included into the project; this instructions works around this.
    && {fr} comme nous n'utilisons plus la commande 'DO FORM',
    && {fr} le gestionnaire de projet n'a plus moyen de savoir que l'écran 'reportChild.scx'
    && {fr} doit être ajouté/inclus au projet. Cette instruction comble cette lacune.
    external form reportChild

  
  thisForm.wMessageBox(Iif(m.success;
    , Textmerge('';
      + [FoxInCloud generated an order report for customer '<<m.company>>'] + ' ';
      + [using the '<<m.lcPDFengine>>' PDF generator,] + ' ';
      + [and displayed it into a ];
      + ICase(;
        thisForm.opgInto.Value = 1,;
          [child form within the same browser Tab],;
        thisForm.opgInto.Value = 2,;
          [new browser Tab],;
        thisForm.opgInto.Value = 3,;
          [new browser Window],;
          [];
          ) + [, ];
      + [all in <<cSeconds(m.nSeconds)>>]; && modify command abDate
      );
    , m.result;
    ))
  
  && {en} at this point, in Web mode, if 'output into a window' was chosen above,
  && {en} FoxInCloud Application Server displays 2 new windows inside the browser
  && {fr} ici, en mode Web, si l'utilisateur a choisi la sortie dans une fenêtre,
  && {fr} Le Serveur d'Application FoxInCloud affiche 2 fenêtres dans le navigateur

else && APPLICATION RUNS IN LAN/DESKTOP MODE

  report form customer for customer_ID = m.customerID preview && {en} runs in a private datasession

endif
>I am still struggling with the idea to have either a separate code base for Desktop and Web, or to try putting it together in one.

One code base for both, with code variants here and there (very few in fact)


>For the fun of it I ran Payroll Pro on the Adaption Assistant and it came up with over 5000 manual adaptations.

  1. you can adapt your app progressively, eg. by blocks of forms and/or target users -- your LAN and Web apps can share the same database
  2. the same adaptations repeat over and over, you get a favourable learning curve -- eg. you can adjust the unit adaptation time and get a reliable estimate of how long project will take.
  3. 5,000 adaptation are probably around 2% of your code base; imagine if you had to rewrite 100%!
Thierry Nivelet
FoxinCloud
Give your VFP application a second life, web-based, in YOUR cloud
http://foxincloud.com/
Never explain, never complain (Queen Elizabeth II)
Previous
Reply
Map
View

Click here to load this message in the networking platform