    <script type="text/javascript" src="../lib/yui/yahoo-min.js"></script>
    <script type="text/javascript" src="../lib/yui/dom-min.js"></script>
    <script type="text/javascript" src="../lib/yui/event-min.js"></script>
    <script type="text/javascript" src="../lib/yui/connection-min.js"></script>
    <script type="text/javascript" src="../lib/yui/animation-min.js"></script>
    <script type="text/javascript" src="../lib/yui/autocomplete-min.js"></script>
    <script type="text/javascript" src="../lib/javascript/AutoComplete.js"></script>

    <?php if (isset($templateData['error'])): ?>
    <div class="error">
      <h2>
	<?php print _('Errors occurred. Please see messages below.') ?>
      </h2>
    </div>
    <?php endif; ?>

    <h1><?php print _("Storage Setup") ?></h1>

    <p>
      <?php printf(_("Gallery needs a directory to store your images. The directory we chose for you will work, but its location or current name does not provide maximum security. Either select a new directory outside of the %sdocument root%s directory or add a random string to the end of the directory name (e.g. %s)."),
		   '<a href="http://codex.gallery2.org/index.php/Gallery2:Security#What_does_web-accessible_mean_.2F_what_is_the_document_root.3F" target="_blank">',
		   '</a>', $templateData['suggested_obfuscated_g2data_name']); ?>
    </p>

  <form method="post" action="<?php generateUrl(sprintf('%s?step=%s', INDEX_PHP, $stepNumber)) ?>">
    <div class="warning" style="padding-top: 0.8em; padding-bottom: 0.9em">
      <?php printf(_('For maximum security you should pick a directory that is not %sweb accessible%s. If this is not possible, specify a randomized name for this directory.'),
		   '<a href="http://codex.gallery2.org/index.php/Gallery2:Security#What_does_web-accessible_mean_.2F_what_is_the_document_root.3F" target="_blank">',
		   '</a>'); ?>
      <?php if (isset($templateData['error']['web_accessible_dir']) ||
		    isset($templateData['error']['possibly_web_accessible_dir'])): ?>
      <p>
	<?php print _('If you choose a randomized name or prefer to stick with the specified directory, please confirm your choice.'); ?>
      </p>
      <?php print _('Yes, please omit the security check:'); ?>
      <input type="checkbox" name="i_acknowledge_the_risk"/>
      <?php endif; ?>
    </div>

    <?php if (isset($templateData['isMultisite']) && $templateData['isMultisite']): ?>
    <p class="warning">
      <?php print _("This is a multisite installation. Remember that each multisite requires its own storage directory."); ?>
    </p>
    <?php endif; ?>

    <p>
      <?php print _("If you're using a modern browser, we'll try to autocomplete any path you enter here.  So if you're having trouble finding the right path to your g2data directory, try experimenting with paths in the text box below and see what completions it provides for you."); ?>
    </p>

    <?php if (isset($templateData['error'])): ?>
      <div class="error">
	    <?php if (isset($templateData['error']['missing_value'])): ?>
	    <?php print _('You must enter a directory'); ?>
	    <?php endif; ?>
	    <?php if (isset($templateData['error']['missing_dir'])): ?>
	    <?php print _('The directory you entered does not exist'); ?>
	    <?php endif; ?>
	    <?php if (isset($templateData['error']['inaccessible_dir'])): ?>
	    <?php print _('The directory you entered is not accessible.  Change the permissions so that the webserver can read this directory.'); ?>
	    <?php endif; ?>
	    <?php if (isset($templateData['error']['readonly_dir'])): ?>
	    <?php print _('The directory you entered is read only'); ?>
	    <?php endif; ?>
	    <?php if (isset($templateData['error']['creation_error'])): ?>
	    <?php print _('There was an error creating the directory structure within the storage directory.'); ?>
	    <?php endif; ?>
	    <?php if (isset($templateData['error']['web_accessible_dir'])): ?>
	    <?php printf(_('Your storage directory is %sweb accessible%s.'),
			 '<a href="http://codex.gallery2.org/index.php/Gallery2:Security#What_does_web-accessible_mean_.2F_what_is_the_document_root.3F" target="_blank">',
			 '</a>'); ?>
	    <?php endif; ?>
	    <?php if (isset($templateData['error']['possibly_web_accessible_dir'])): ?>
	    <?php printf(_('Unable to verify that the storage directory is not %sweb accessible%s.'),
			 '<a href="http://codex.gallery2.org/index.php/Gallery2:Security#What_does_web-accessible_mean_.2F_what_is_the_document_root.3F" target="_blank">',
			 '</a>'); ?>
	    <?php endif; ?>
      </div>
    <?php endif; ?>

    <span class="label"><?php print _('Directory path:') ?></span>
    <input id="dir" name="dir" type="text" size="50"
	   value="<?php print $templateData['dir'] ?>" autocomplete="off"/>
    <input type="hidden" name="action" value="save"/>
    <script type="text/javascript">
	// <![CDATA[
	YAHOO.util.Event.addListener(
		this, 'load',
		function(e, data) { autoCompleteAttach(data[0], data[1]); },
		['dir', '<?php generateUrl(sprintf('%s?step=%s&%s=%s', INDEX_PHP,
		  $currentStep->getStepNumber(), session_name(), session_id())) ?>&doAutoComplete=1&path=__VALUE__']);
	// ]]>
    </script>
  </form>

    <p>
      <?php print _("Your webserver needs to be able to write to this directory. To get it working, you can follow these examples.") ?>
      <br/>
      <i>
	<?php print _("Note: these are only examples!  You may find that they don't work quite right on your system.") ?>
      </i>
    </p>

    <?php if ($templateData['OS'] == 'unix'): ?>
    <div class="example">
      <h2> <?php print _("Unix (with shell access)"); ?> </h2>
      <pre> $ <b>mkdir <?php print $templateData['dir'] ?></b><br/> $ <b>chmod 777 <?php print $templateData['dir'] ?></b></pre>
    </div>

    <div class="example">
      <h2> <?php print _("Unix (with ftp access)"); ?> </h2>
      <i> <?php print _("Note that ftp servers and clients vary so these instructions may not work for you. Consult the manual for your FTP client or talk to a system administrator for help with this if you have problems.") ?> </i> <br/>
      <pre> ftp&gt; <b>cd <?php print dirname($templateData['dir']) ?></b><br/> ftp&gt; <b>mkdir <?php print basename($templateData['dir']) ?></b><br/> ftp&gt; <b>chmod 777 <?php print basename($templateData['dir']) ?></b></pre>
    </div>

    <?php else: ?>

    <div class="example">
      <h2> Windows </h2>
      <pre> C:\&gt; <b>mkdir <?php print $templateData['dir'] ?></b></pre>
    </div>
    <?php endif; ?>

    <?php if (isset($templateData['error']['missing_dir'])): ?>
    <p>
      <?php print _('In some web hosting environments, the paths that you see in the shell or via FTP are not the same paths that PHP sees.  In order to find out the real path to your data directory, you can try creating a PHP script called <b>dir.php</b> containing the following code in it and put it into your data directory.') ?>
    </p>
    <div class="example">
      <pre> &lt;?php print system("pwd"); ?&gt; </pre>
    </div>
    <p>
      <?php printf(_('then figure out the URL to dir.php and open it in your web browser (eg, %s).  This will tell you the exact path to enter here.'), '<b>http://your.server.com/g2data/dir.php</b>'); ?>
    </p>
    <p>
      <?php print _('<b>Note</b>: This requires that your data directory is web accessible, which we don\'t recommend because it circumvents our image firewall.  Once you figure out the path this way, we recommend that you move your data directory outside of your web accessible area and then update the path here accordingly.'); ?>
    </p>
    <p>
      <?php print _('<b>Note</b>: Don\'t forget to delete dir.php when you\'re done!'); ?>
    </p>
    <?php endif; ?>

    <div class="warning">
      <?php printf(_("For information on how to secure your Gallery storage directory, please read the %sSecurity Guide%s."), '<a href="http://codex.gallery2.org/index.php/Gallery2:Security" target="_blank">', '</a>') ?>
    </div>

    <div class="go">
	  <div class="btn btn-continue"><div><div><div><div><div><div><div><div>
	  <a href="javascript:document.forms[0].submit()"><?php print _('Save') ?></a>
	  </div></div></div></div></div></div></div></div></div>
    </div>
