[mapguide-commits] r7905 - in trunk/MgDev: . Doc/samples

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Thu Nov 7 02:41:15 PST 2013


Author: jng
Date: 2013-11-07 02:41:15 -0800 (Thu, 07 Nov 2013)
New Revision: 7905

Added:
   trunk/MgDev/Doc/samples/samples.php
Removed:
   trunk/MgDev/Doc/samples/samples.html
Modified:
   trunk/MgDev/build.bat
Log:
#2343: Make the samples landing page PHP-based, this allows us to only show samples that are actually installed. PHP is guaranteed to be present regardless of installation configuration choices.

Deleted: trunk/MgDev/Doc/samples/samples.html
===================================================================
--- trunk/MgDev/Doc/samples/samples.html	2013-11-07 09:38:08 UTC (rev 7904)
+++ trunk/MgDev/Doc/samples/samples.html	2013-11-07 10:41:15 UTC (rev 7905)
@@ -1,44 +0,0 @@
-<!DOCTYPE html>
-<html>
-    <head>
-        <title>MapGuide Samples Landing Page</title>
-    </head>
-    <body>
-        <h2>MapGuide Samples</h2>
-        <p>Here you will find an assorted list of samples using</p>
-        <ul>
-            <li>AJAX Viewer</li>
-            <li>MapGuide Web Extensions API</li>
-            <li>OpenLayers integration</li>
-        </ul>
-        <p><strong>NOTE: You should download the <a href="http://download.osgeo.org/mapguide/releases/2.0.0/samples/Sheboygan.mgp">Sheboygan Dataset</a> and load this in via the <a href="mapadmin/login.php">MapGuide Site Administrator</a> before running any of these samples</strong></p>
-        <p><strong>NOTE: Some samples may not be available because you did not choose to enable this feature from the Windows installer. If you did not enable samples when installing MapGuide on Windows, none of these samples below will work</strong></p>
-        <p>Click on a link below to go to that particular sample</p>
-        <p>AJAX Viewer (.net)</p>
-        <ul>
-            <li><a href="dotnetsamples/main.aspx">.net Developer's Guide samples</a></li>
-            <li><a href="dotnetviewersample/ajaxviewersample.aspx">.net Viewer Sample</a></li>
-            <li><a href="dotnetviewersample/ajaxtiledviewersample.aspx">.net Tiled Viewer Sample</a></li>
-        </ul>
-        <p>AJAX Viewer (PHP)</p>
-        <ul>
-            <li><a href="phpsamples/main.php">PHP Developer's Guide samples</a></li>
-            <li><a href="phpviewersample/ajaxviewersample.php">PHP Viewer Sample</a></li>
-            <li><a href="phpviewersample/ajaxtiledviewersample.php">PHP Tiled Viewer Sample</a></li>
-        </ul>
-        <p>AJAX Viewer (Java)</p>
-        <ul>
-            <li><a href="javasamples/main.jsp">Java Developer's Guide samples</a></li>
-            <li><a href="javaviewersample/ajaxviewersample.jsp">Java Viewer Sample</a></li>
-            <li><a href="javaviewersample/ajaxtiledviewersample.jsp">Java Tiled Viewer Sample</a></li>
-        </ul>
-        <p>MapGuide with <a href="http://www.openlayers.org">OpenLayers</a></p>
-        <ul>
-            <li><a href="ol2samples/untiled/index.html">Basic Sheboygan un-tiled map example with basic legend</a></li>
-            <li><a href="ol2samples/tiled/index.html">Basic Sheboygan tiled map example</a></li>
-            <li><a href="ol2samples/selection/index.html">Basic Sheboygan un-tiled map example with selection</a></li>
-            <li><a href="ol2samples/mixed/index.html">Basic Sheboygan mixed map (tiled and untiled) example</a></li>
-            <li><a href="ol2samples/commercial/index.html">Sheboygan map with Google/OSM layers</a></li>
-        </ul>
-    </body>
-</html>
\ No newline at end of file

Added: trunk/MgDev/Doc/samples/samples.php
===================================================================
--- trunk/MgDev/Doc/samples/samples.php	                        (rev 0)
+++ trunk/MgDev/Doc/samples/samples.php	2013-11-07 10:41:15 UTC (rev 7905)
@@ -0,0 +1,127 @@
+<?php
+
+function is_installed($feature)
+{
+    return file_exists(dirname(__FILE__)."/".$feature);
+}
+
+$hasDotNetDevGuide = is_installed("dotnetsamples");
+$hasDotNetViewerSample = is_installed("dotnetviewersample");
+$hasPhpDevGuide = is_installed("phpsamples");
+$hasPhpViewerSample = is_installed("phpviewersample");
+$hasJavaDevGuide = is_installed("javasamples");
+$hasJavaViewerSample = is_installed("javaviewersample");
+$hasOL2Samples = is_installed("ol2samples");
+
+$hasDotNet = $hasDotNetDevGuide || $hasDotNetViewerSample;
+$hasPhp = $hasPhpDevGuide || $hasPhpViewerSample;
+$hasJava = $hasJavaDevGuide || $hasJavaViewerSample;
+$hasNothing = !$hasDotNet && !$hasPhp && !$hasJava;
+
+?>
+<!DOCTYPE html>
+<html>
+    <head>
+        <title>MapGuide Samples Landing Page</title>
+        <style type="text/css">
+        html { padding: 0; margin: 0; }
+        body {
+            margin: 0px 0px 0px 0px;
+            color: #000000;
+            font-family: arial,verdana,helvetica,sans-serif;
+            background: #f0f0f0;
+            height: 100%;
+        }
+        .banner {
+            width: 100%;
+            padding: 6px 2px 6px 2px;
+            background: #004282;
+            color: #ffffff;
+            font-family: arial,verdana,helvetica,sans-serif;
+            font-weight: bold;
+            font-size: 20px;
+        }
+        .content-body {
+            padding-left: 20px;
+            font-size: 0.8em;
+        }
+        .sample-header {
+            font-weight: bold;
+            text-decoration: underline;
+        }
+        .error { color: red; }
+        </style>
+    </head>
+    <body>
+        <div class="banner">
+            MapGuide Samples
+        </div>
+        <div class="content-body">
+            <p>Here you will find an assorted list of samples using</p>
+            <ul>
+                <li>AJAX Viewer</li>
+                <li>MapGuide Web Extensions API</li>
+                <? if ($hasOL2Samples) {?>
+                <li>OpenLayers integration</li>
+                <? } ?>
+            </ul>
+            <p>For more code samples, visit the <a href="http://trac.osgeo.org/mapguide/wiki/CodeSamples">Community Code Samples</a> page on the MapGuide Open Source wiki</p>
+            <p><strong>NOTE: You should download the <a href="http://download.osgeo.org/mapguide/releases/2.0.0/samples/Sheboygan.mgp">Sheboygan Dataset</a> and load this in via the <a href="mapadmin/login.php">MapGuide Site Administrator</a> before running any of these samples</strong></p>
+            <p><strong>NOTE: Some samples may not be available because you did not choose to enable this feature from the Windows installer.</strong></p>
+            <? if ($hasOL2Samples) { ?>
+            <p><strong>NOTE: Some OpenLayers integration samples require some sample resources to be loaded. <a href="ol2samples/data/load.php">Click here</a> to load these resources</strong></p>
+            <? } ?>
+            <p>Click on a link below to go to that particular sample</p>
+            <? if ($hasNothing) { ?>
+                <strong class="error">No samples found on this MapGuide installation.</strong>
+            <? } else { ?>
+                <? if ($hasDotNet) { ?>
+                <p class="sample-header">AJAX Viewer (.net)</p>
+                <ul>
+                    <? if ($hasDotNetDevGuide) { ?>
+                    <li><a href="dotnetsamples/main.aspx">.net Developer's Guide samples</a></li>
+                    <? } ?>
+                    <? if ($hasDotNetViewerSample) { ?>
+                    <li><a href="dotnetviewersample/ajaxviewersample.aspx">.net Viewer Sample</a></li>
+                    <li><a href="dotnetviewersample/ajaxtiledviewersample.aspx">.net Tiled Viewer Sample</a></li>
+                    <? } ?>
+                </ul>
+                <? } ?>
+                <? if ($hasPhp) { ?>
+                <p class="sample-header">AJAX Viewer (PHP)</p>
+                <ul>
+                    <? if ($hasPhpDevGuide) { ?>
+                    <li><a href="phpsamples/main.php">PHP Developer's Guide samples</a></li>
+                    <? } ?>
+                    <? if ($hasPhpViewerSample) { ?>
+                    <li><a href="phpviewersample/ajaxviewersample.php">PHP Viewer Sample</a></li>
+                    <li><a href="phpviewersample/ajaxtiledviewersample.php">PHP Tiled Viewer Sample</a></li>
+                    <? } ?>
+                </ul>
+                <? } ?>
+                <? if ($hasJava) { ?>
+                <p class="sample-header">AJAX Viewer (Java)</p>
+                <ul>
+                    <? if ($hasJavaDevGuide) { ?>
+                    <li><a href="javasamples/main.jsp">Java Developer's Guide samples</a></li>
+                    <? } ?>
+                    <? if ($hasJavaViewerSample) { ?>
+                    <li><a href="javaviewersample/ajaxviewersample.jsp">Java Viewer Sample</a></li>
+                    <li><a href="javaviewersample/ajaxtiledviewersample.jsp">Java Tiled Viewer Sample</a></li>
+                    <? } ?>
+                </ul>
+                <? } ?>
+                <? if ($hasOL2Samples) { ?>
+                <p class="sample-header">MapGuide with <a href="http://www.openlayers.org">OpenLayers</a></p>
+                <ul>
+                    <li><a href="ol2samples/untiled/index.html">Basic Sheboygan un-tiled map example with basic legend</a></li>
+                    <li><a href="ol2samples/tiled/index.html">Basic Sheboygan tiled map example</a></li>
+                    <li><a href="ol2samples/selection/index.html">Basic Sheboygan un-tiled map example with selection</a></li>
+                    <li><a href="ol2samples/mixed/index.html">Basic Sheboygan mixed map (tiled and untiled) example</a></li>
+                    <li><a href="ol2samples/commercial/index.html">Sheboygan map with Google/OSM layers</a></li>
+                </ul>
+                <? } ?>
+            <? } ?>
+        </div>
+    </body>
+</html>
\ No newline at end of file

Modified: trunk/MgDev/build.bat
===================================================================
--- trunk/MgDev/build.bat	2013-11-07 09:38:08 UTC (rev 7904)
+++ trunk/MgDev/build.bat	2013-11-07 10:41:15 UTC (rev 7905)
@@ -338,7 +338,7 @@
 echo [install]: OpenLayers Samples
 %XCOPY% "%MG_DOC_DEVGUIDE_SAMPLES%\ol2samples" "%MG_OUTPUT_WEB%\www\ol2samples" /EXCLUDE:%TYPEBUILD%_excludes.txt
 echo [install]: Samples landing page
-copy /Y "%MG_DOC_DEVGUIDE_SAMPLES%\samples.html" "%MG_OUTPUT_WEB%\www"
+copy /Y "%MG_DOC_DEVGUIDE_SAMPLES%\samples.php" "%MG_OUTPUT_WEB%\www"
 echo [install]: Viewer API documentation
 %XCOPY% "%MG_DOC%\viewerapi" "%MG_OUTPUT_WEB%\www\help\viewerapi" /EXCLUDE:%TYPEBUILD%_excludes.txt
 echo [install]: Copy dlls into .net samples



More information about the mapguide-commits mailing list