\documentclass{article}
\usepackage{ulem}
\usepackage{graphicx}
\usepackage{hyperref}
\pagestyle{headings}
\begin{document}
\part{Creating a Horde Module (App)}
Please follow the instructions below and choose the version for which you'd like to start a new module. Once you have your first module you need to populate it with content. This will be the subject of the next section: <a href="https://wiki.horde.org/PopulatingYourFirstModule">PopulatingYourFirstModule</a>

\section{Horde 5 (current)}
\begin{itemize}
\item Prerequisites:<br />
Generate a horde checkout or get one using the Horde Developer Container<br />
(configure git-tools/config/conf.php first)<br />
/path/to/git-tools/bin/horde-git-tools git clone<br />
Setup an environment<br />
/path/to/git-tools/bin/horde-git-tools dev install<br />
Do basic horde initialization for dev (registry.local.php, conf.php)


\item Create an app template<br />
/path/to/git-tools/bin/horde-git-tools dev new --app-name foo --author "My Name <<a href="https://wiki.horde.org/mailto:my.name@mycompany.com">my.name@mycompany.com</a>>"


\item In /path/to/horde/config/registry.d/ create a file called newmodulename.php. Please note the documentation for available module entry options in horde/config/registry.php, especially the menu parent. If you want your module to go \textbf{anywhere else} in the menue, you will need to change this!


\end{itemize}
This is a "registry.d" example for Horde 5:

<pre><code class="language-php">
<?php
\$this->applications['newmodulename'] = array(
    'name' => \_("New Module"),
    // This is sufficient. More options possible if needed
);
</code></pre>
\begin{itemize}
\item If you wish you can provide your new module with a PNG icon at 20x20. This needs to be placed in the "themes" subdirectory:


\end{itemize}
<pre><code class="language-sh">
mkdir newmodulename/themes/default/graphics
cp newmodulename.png newmodulename/themes/default/graphics/
</code></pre>
This one is an example PNG from the basic horde application

<a href="https://github.com/horde/horde/raw/master/horde/themes/default/graphics/horde.png">https://github.com/horde/horde/raw/master/horde/themes/default/graphics/horde.png</a>

\begin{itemize}
\item To actually run your app boilerplate, you need to re-run the git-tools dev install procedure to create appropriate symlinks


\end{itemize}
\section{Horde 5 (pre git split)}
\begin{itemize}
\item Check out the skeleton module:


\end{itemize}
<pre><code class="language-sh">
 git clone --depth 1 https://github.com/horde/skeleton.git
 cd skelton
</code></pre>
\begin{itemize}
\item Start a new module - based on the Skeleton module - by running the following helper script:


\end{itemize}
<pre><code class="language-sh">
./bin/skeleton-generate-module newmodulename "Me Myself <me@myselfandi.com>"
</code></pre>
The new module will end up in skeleton's parent directory and have the name "newmodulename".

\begin{itemize}
\item Link or copy the new module into your horde installation.


\end{itemize}
<pre><code class="language-sh">
 ln -s `pwd`/../newmodulename /your/install/path/to/horde/
</code></pre>
Linking is the preferred variant as this allows you to work within the git repository and commit any code you write to a local branch. At the same time you have the installation ready for immediate testing of any changes.

\begin{itemize}
\item In /path/to/horde/config/registry.d/ create a file called newmodulename.php. Please note the documentation for available module entry options in horde/config/registry.php, especially the menu parent. If you want your module to go \textbf{anywhere else} in the menue, you will need to change this!


\end{itemize}
This is a "registry.d" example for Horde 5:

<pre><code class="language-php">
<?php
\$this->applications['newmodulename'] = array(
    'name' => \_("New Module"),
    // This is sufficient. More options possible if needed
);
</code></pre>
\begin{itemize}
\item If you wish you can provide your new module with a PNG icon at 20x20. This needs to be placed in the "themes" subdirectory:


\end{itemize}
<pre><code class="language-sh">
mkdir newmodulename/themes/default/graphics
cp newmodulename.png newmodulename/themes/default/graphics/
</code></pre>
This one is an example PNG from the basic horde application

<a href="https://github.com/horde/horde/raw/master/horde/themes/default/graphics/horde.png">https://github.com/horde/horde/raw/master/horde/themes/default/graphics/horde.png</a>

\section{Horde 4}
It is not recommended to use the Horde 4 Skeleton any longer.

\begin{itemize}
\item Check out the skeleton module from horde git


\end{itemize}
<pre><code class="language-sh">
 git clone --depth 1 git://github.com/horde/horde.git
 cd horde
 cp -R skeleton/ /your/install/path/to/horde/
</code></pre>
\begin{itemize}
\item Create the following script as projectrename.php - save it somewhere sensible, like your home directory:


\end{itemize}
<pre><code class="language-php">
\#!/usr/bin/php -q
<?php
function analysedir( \$path\_, \$list\_ )
\{
  // Read dir
  \$handle = opendir(\$path\_);
  while (false !== (\$file = readdir(\$handle)))
  \{
    if( \$file!='.' \&\& \$file!='..')
    \{
        \$file = \$path\_ . DIRECTORY\_SEPARATOR . \$file;
        //echo "\$filen";

        if( !is\_dir( \$file ) )  // If File: Append
        \{
          \$list\_[count(\$list\_)]=\$file;
        \}
        else   // If Folder: scan recursively
        \{
          \$list\_ += analysedir(\$file, \$list\_ );
        \}
   \}
 \}      // While END
 return \$list\_;
\}

function substitute\_skeleton( \$filename, \$modulname )
\{
  \$prjUC=strtoupper(trim(\$modulname));
  \$prjLC=strtolower(\$prjUC);
  \$prjMC=substr(\$prjUC, 0, 1) . substr(\$prjLC, 1, strlen(\$prjLC)-1);

  \$filehandle=fopen(trim(\$filename), 'r');
  \$file=fread(\$filehandle, filesize(\$filename));
  fclose(\$filehandle);
  \$newfile=str\_replace(array('SKELETON', 'Skeleton', 'skeleton'), array(\$prjUC, \$prjMC, \$prjLC), \$file);
  \$filehandle=fopen(trim(\$filename), 'w');
  fwrite(\$filehandle, \$newfile);
  fclose(\$filehandle);
\}

function help()
\{
  echo "projectrename.php </path/to/skeleton-folder/> <modulname>n";
\}

//
// ------------------- Main-Code --------------------
//

if (count(\$\_SERVER['argv'])==3)
\{
  // Preparation
  \$list = array();
  \$path = trim(\$\_SERVER['argv'][1]);
  \$modul = trim(\$\_SERVER['argv'][2]);

  // Fetch Filelist
  \$list = analysedir( \$path, \$list );

  // Modify each File
  foreach( \$list as \$file )
  \{
        //echo \$modul.": ".\$file."n";
        substitute\_skeleton( \$file, \$modul );
  \}
\}
else
  help();
?>
</code></pre>
\begin{itemize}
\item On a unix system, use the following command to replace all skeleton strings with your project name (Not tested on Windows, but should work):


\end{itemize}
<pre><code class="language-sh">
projectrename.php /path/to/skeleton modulname
</code></pre>
3.1:

Edit your Name into all files, for example with this snippet under bash (Unix, Linux or Windows with cygwin):

<pre><code>find ./ -type f -exec sed -i 's/Your Name <you@example.com>/Me Myself <me@myselfandi.com>/g' \{\} \textbackslash\{\};
</code></pre>
3.2 Rename

<pre><code>mv horde/appname/test/Skeleton horde/appname/test/Appname
</code></pre>
and

<pre><code>mv horde/appname/locale/skeleton.pot horde/appname/locale/appname.pot
</code></pre>
and

<pre><code>mv horde/appname/migration/1\_skeleton\_base\_tables.php horde/appname/migration/1\_appname\_base\_tables.php
</code></pre>
\begin{itemize}
\item Perform some file modifications:


\end{itemize}
<pre><code class="language-sh">
mkdir /path/to/modulename/themes/default/graphics
</code></pre>
\begin{itemize}
\item Upload a PNG icon at 16x16 named appname.png for the module to the path created above. This one is an example from the basic horde application:


\end{itemize}
<a href="https://github.com/horde/horde/blob/master/horde/themes/default/graphics/horde.png">https://github.com/horde/horde/blob/master/horde/themes/default/graphics/horde.png</a>

\begin{itemize}
\item In /path/to/horde/config/registry.d/ create a file called modulename.php. Please note the lack of ?> at the end of the php block, and also the menu parent. If you want your object to go *ANYWHERE ELSE* you will need to change this!


\end{itemize}
This is a registry.d example for Horde 4:

<pre><code class="language-php">
<?php
\$this->applications['tickplug'] = array(
        'name' => \_("Tickplug"),
        'provides' => array(
        'Tickets/Import'
        )
        // This is sufficient. More options possible if needed
    );
</code></pre>
\begin{itemize}
\item On the administration - configuration page, configure your app. (It won't display in the sidebar until you do.)


\end{itemize}
\section{Horde 3}
It is not recommended to use the Horde 3 Skeleton from CVS any longer. There is currently no usable version of Skeleton which is tagged FRAMEWORK\_3. An older revision of the CVS HEAD version may work though.

This is a registry.d example for Horde 3:

<pre><code class="language-php">
<?php
\$this->applications['modulename'] = array(
    'fileroot' => dirname(\_\_FILE\_\_) . '/../../modulename',
    'webroot' => \$this->applications['horde']['webroot'] . '/modulename',
    'name' => \_("A description of your module"),
    'status' => 'active',
    'menu\_parent' => 'horde'
);
</code></pre>
\end{document}
