Home arrow FAQ arrow Remository general arrow Hacking Remository
Hacking Remository
Oct 31, 2007 at 12:01 PM

If you want to make modifications to Remository, it is relatively easy to find your way around the code, especially in recent versions. Some code is in the basic Remository user side directory, .../components/com_remository/

The overall control of the logic of the user side is in remository.php and you should be careful about modifying this. Some important display code is in remository.html.php including the code to do with file lists. Since file lists are needed in more than one place, this code is common to different Remository functions. It is reasonably safe to make changes here, provided you keep track of what you have done so as to be able to backtrack, and test as you go. In particular, it is easy to alter the fields that are displayed in lists of files.

Below the main user side directory are some subdirectories:

  • c-classes
  • c-admin-classes
  • p-classes
  • v-classes
  • v-admin-classes
  • images
  • languages

The c-classes directory contains one controller class for each function available from Remository on the user side. You will see that the names of the classes tie up with the names you see in the browser URI bar. Take care changing any of the controller classes. The v-classes directory contains one view class for each user side function and should be relatively easy to modify.

There is basic code in the admin side directory .../administrator/components/com_remository/ that mostly should not need changing. Most of the specific code is within the sub-directories listed above. Similar to the user side, there is a controller for each Remository admin function, to be found in c-admin-classes. Some very simple functions have no controller, only a viewer class. There is a view class that creates the browser display, one for each function, in the v-admin-classes directory.

The images directory stores images, with file and folder icons in their own subdirectories. There are many languages supported for Remository, and the definitions are stored in the languages sub-directory. The correct language file should be loaded automatically, although this may have stopped working with the latest versions of Mambo. In this case, check what is the value of the language in the configuration and alter the appropriate language file to match. You are free to modify the language file, but I recommend adding your own definitions to the beginning of the file. Since the standard definitions are coded conditionally, they are not effective if the relevant symbol is already defined - so your modifications take precedence. Keeping them all at the start of the file will make it easier to handle upgrades.

Adding a new function

If you want to add a completely new function, you can leverage the Remository despatching logic. Without SEF, any Remository URI will contain in the query string func=xxxxx. (If it isn't there, it is equivalent to func=select). Choose a new function that is not already used. You can find what is already used by looking in the ../com_remository/c-classes directory for all the file names of the form remository_xxxx_Controller, plus the extra names that are listed in remository.php in the $alternatives array.

Then create your new links using the newly invented function code. Write some PHP in a module called remository_mynewfunction_Controller.php and add it to the c-classes directory just mentioned. If you want to have a viewer module to complement the controller, put it in v-classes. The controller should contain a class with the name remository_mynewfunction_Controller, and it should be subclassed from remositoryUserControllers. Remository will autoload the new class.

Last Updated ( Apr 02, 2010 at 03:01 PM )
<Previous   Next>

Login

Subscribe to Premium Support

Get priority support for Remository and Glossary, sign up now for a Premium Support monthly subscription:

Your Remository user name

Or purchase a year's support:

Your Remository user name

Recommended SEF

SEF Advance

Who is Online

Remository welcomes guests and visitors

We have 10 guest online