Index: htdocs/css/wiki.css
===================================================================
--- htdocs/css/wiki.css	(revision 3868)
+++ htdocs/css/wiki.css	(working copy)
@@ -16,6 +16,7 @@
  margin: 1em 0 2em;
  overflow: auto;
 }
+#template {vertical-align: middle; padding-top: 1em;}
 
 /* Diff view */
 #overview .multi { color: #999 }
Index: trac/wiki/web_ui.py
===================================================================
--- trac/wiki/web_ui.py	(revision 3868)
+++ trac/wiki/web_ui.py	(working copy)
@@ -316,6 +316,11 @@
 
         if 'text' in req.args:
             page.text = req.args.get('text')
+        elif 'template' in req.args:
+            template = req.args.get('template')
+            template_page = WikiPage(self.env, template, db=db)
+            if template_page.exists:
+                page.text = template_page.text
         if action == 'preview':
             page.readonly = 'readonly' in req.args
 
@@ -404,6 +409,9 @@
         if req.perm.has_permission('WIKI_MODIFY'):
             attach_href = req.href.attachment('wiki', page.name)
 
+
+        templates = [t for t in WikiPage.select_names(self.env,
+                                                      'PageTemplates/%', db)]
         data.update({'action': 'view',
                      'page_html': page_html,
                      'comment_html': comment_html,
@@ -412,7 +420,7 @@
                      'attach_href': attach_href,
                      # Ask web spiders to not index old versions
                      'norobots': bool(version),
-                     })
+                     'templates': templates})
         return 'wiki_view.html', data, None
 
     # ITimelineEventProvider methods
Index: trac/wiki/model.py
===================================================================
--- trac/wiki/model.py	(revision 3868)
+++ trac/wiki/model.py	(working copy)
@@ -155,3 +155,18 @@
                        "ORDER BY version DESC", (self.name, self.version))
         for version,time,author,comment,ipnr in cursor:
             yield version,time,author,comment,ipnr
+
+    def select_names(cls, env, prefix=None, db=None):
+        if not db:
+            db = env.get_db_cnx()
+        cursor = db.cursor()
+        if prefix:
+            cursor.execute("SELECT name FROM wiki WHERE name LIKE %s"
+                           " ORDER BY name", (prefix,))
+        else:
+            cursor.execute("SELECT name FROM wiki ORDER BY name")
+        for name, in cursor:
+            yield name
+
+    select_names = classmethod(select_names)
+
Index: templates/wiki_edit.html
===================================================================
--- templates/wiki_edit.html	(revision 3868)
+++ templates/wiki_edit.html	(working copy)
@@ -62,8 +62,7 @@
             </select>
           </div>
           <p><textarea id="text" class="wikitext" name="text" cols="80" rows="$edit_rows">
-$page.text
-            </textarea>
+$page.text</textarea>
           </p>
           <script type="text/javascript">
             var scrollBarPos = document.getElementById("scroll_bar_pos");
Index: templates/wiki_view.html
===================================================================
--- templates/wiki_view.html	(revision 3868)
+++ templates/wiki_view.html	(working copy)
@@ -19,13 +19,13 @@
         <li><a href="${href.wiki('RecentChanges')}">Index by Date</a></li>
         <li class="last">
           <a href="${req.href.wiki(page.name, action='diff', version=page.version)}">Last Change</a>
-        </li> 
+        </li>
       </ul>
       <hr />
     </div>
 
     <div id="content" class="wiki">
-      
+
       <py:if test="comment_html">
         <table id="info" summary="Revision info">
           <tbody>
@@ -50,7 +50,21 @@
               <form method="get" action="${href.wiki(page.name)}">
                 <div>
                   <input type="hidden" name="action" value="edit" />
-                  <input type="submit" value="${page.exists and 'Edit' or 'Create'} this page" accesskey="e" />
+                  <py:choose>
+                    <py:when test="page.exists">
+                      <input type="submit" value="Edit this page" accesskey="e" />
+                    </py:when>
+                    <py:otherwise>
+                      <input type="submit" value="Create this page" accesskey="e" />
+                      <div py:if="templates" id="template">
+                        <label for="template">Using the template:</label>
+                        <select name="template">
+                          <option selected="${not 'PageTemplates/Default' in templates and 'selected' or None}" value="">(blank page)</option>
+                          <option py:for="t in templates" py:attrs="form_attrs(selected=t=='PageTemplates/Default')">$t</option>
+                        </select>
+                      </div>
+                    </py:otherwise>
+                  </py:choose>
                 </div>
               </form>
               <py:if test="page.exists">

