/*
 * PublishDocServicePage.java
 *
 * Copyright (C) 2009-15 by RStudio, Inc.
 *
 * Unless you have received this program directly from RStudio pursuant
 * to the terms of a commercial license agreement with RStudio, then
 * this program is licensed to you under the terms of version 3 of the
 * GNU Affero General Public License. This program is distributed WITHOUT
 * ANY EXPRESS OR IMPLIED WARRANTY, INCLUDING THOSE OF NON-INFRINGEMENT,
 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Please refer to the
 * AGPL (http://www.gnu.org/licenses/agpl-3.0.txt) for more details.
 *
 */package org.rstudio.studio.client.rsconnect.ui;

import java.util.ArrayList;

import org.rstudio.core.client.widget.WizardNavigationPage;
import org.rstudio.core.client.widget.WizardPage;
import org.rstudio.studio.client.rsconnect.model.RSConnectPublishInput;
import org.rstudio.studio.client.rsconnect.model.RSConnectPublishResult;

import com.google.gwt.resources.client.ImageResource;

public class PublishDocServicePage 
   extends WizardNavigationPage<RSConnectPublishInput, RSConnectPublishResult>
{
   public PublishDocServicePage(String title, String subTitle, 
                                ImageResource icon,
                                RSConnectPublishInput input)
   {
      super(title, subTitle, "Publish To", icon, null, createPages(input));
   }
   
   private static ArrayList<WizardPage<RSConnectPublishInput, 
                                       RSConnectPublishResult>> 
           createPages(RSConnectPublishInput input)
   {
      ArrayList<WizardPage<RSConnectPublishInput, 
                           RSConnectPublishResult>> pages =
                           new ArrayList<WizardPage<RSConnectPublishInput, 
                                                    RSConnectPublishResult>>();
      pages.add(new PublishRPubsPage("RPubs", "RPubs is a free service from " + 
         "RStudio for sharing documents on the web."));
      String rscTitle = "RStudio Connect";
      String rscDesc = 
            "A local service running inside your organization. Publish and " +
            "collaborate privately and securely.";
      if (input.isMultiRmd())
      {
         pages.add(new PublishMultiplePage(rscTitle, rscDesc, 
               RSConnectResources.INSTANCE.localAccountIcon(), input));
      }
      else 
      {
         pages.add(new PublishReportSourcePage(rscTitle, rscDesc, 
               RSConnectResources.INSTANCE.localAccountIcon(), input, 
               false));
      }
      return pages;
   }
}

@@ -768,24 +768,78 @@
 WizardPage;%0A
+import org.rstudio.studio.client.rsconnect.RSConnect;%0A
 import org.r
@@ -2390,32 +2390,495 @@
   else %0A      %7B%0A
+         String ext = input.getSourceRmd().getExtension().toLowerCase();%0A         if (input.getContentType() == RSConnect.CONTENT_TYPE_DOCUMENT &&%0A             (ext == %22.html%22 %7C%7C ext == %22.md%22))%0A         %7B%0A            // static input implies static output%0A            pages.add(new PublishFilesPage(rscTitle, rscDesc,%0A                  RSConnectResources.INSTANCE.localAccountIcon(), input, %0A                  false, true));%0A         %7D%0A         else%0A         %7B%0A   
          pages.a
@@ -2920,32 +2920,35 @@
 itle, rscDesc, %0A
+   
                R
@@ -3013,24 +3013,27 @@
             
+   
 false));%0A   
@@ -3025,24 +3025,35 @@
    false));%0A
+         %7D%0A
       %7D%0A    

make static content imply static output (for single docs)