The next version of Couch (1.1) is ready for release.
Apart from aggregating the several bug-fixes and patches released so far, this version also introduces some very useful new features.

We invite you to download and test the release candidate -
couchcms-1.1.zip
(1.21 MiB) Downloaded 1107 times


We are in the process of updating the official documentation. For the time being you can use the following rough guide to the new features that have been introduced in version 1.1.

DYNAMIC FOLDERS
Uptil now the only way of creating virtual folders for templates in Couch had been by using the 'folder' tag e.g -
Code: Select all
   <cms:folder name="asia" title="Asian News">
      <cms:folder name="china" title="China News" />
      <cms:folder name="japan" title="Japan News" />
   </cms:folder>

This approach was perfect for templates where the hierarchy of folders was fixed and known beforehand to the designer/developer who placed the tags in the templates.
However for templates, such as blogs, the end-user usually wished to create and manage folders by himself (for example while using the folders as categories for his posts). For such cases, it was not really practical to expect the end-user to edit the templates to tweak the folder hierarchy.

Version 1.1 now allows the end-user to create/manage the folders from within the admin panel.

By default the dynamic folders feature is turned off for all templates.
To turn on this capability for a particular template, the designer needs to add the 'dynamic_folders' attribute to the 'template' tag of this template.
For example -
Code: Select all
   <cms:template clonable='1' title='Blog' dynamic_folders='1'>

Once the dynamic folders feature is activated for a template, Couch will add a new button to the template's admin panel
d0.png
d0.png (6.13 KiB) Viewed 7711 times

The client can now manage the folders from the screen that shows up upon clicking the button shown above.
Apart from the regular attributes of a folder, the dynamic folders support two additional attributes - a description of the folder and an image associated with it.
d1.png
d1.png (35.62 KiB) Viewed 7711 times

These two values associated with a folder are now accessible within your template through the following variables -
'k_folder_desc' and 'k_folder_image' within folder-view.
'k_page_folderdesc' and 'k_page_folderimage' within page-view.

You might well ask at this point that now that we have two different ways of manipulating folders - the 'folder' tag and the admin panel, how will the two interact with other?
The answer is that once the dynamic folders feature is turned on for a template, Couch begins ignoring completely any 'folder' tags that might be present in the template.
Any existing folders that were created by Couch as a result of the 'folder' tags within the template will show up in the folder management screen, however any new changes made to the 'folder' tags will be completely ignored.
So effectively, we'll have only one method of handling folders.

VERY IMPORTANT: Take care NOT to turn off dynamic folders after once activating them. This is why -
Suppose this was the folder hierarchy imposed upon the template by using the 'folder' tags before activating dynamic folders
Code: Select all
   <cms:folder name="asia" title="Asian News">
      <cms:folder name="china" title="China News" />
      <cms:folder name="japan" title="Japan News" />
   </cms:folder>

Under the influence of the code above, this template had three folders. At this point suppose we turn on dynamic folders.
The three existing folders will show up in the folder management screen that is now available but because the dynamic folders are turned on, Couch will now simply begin ignoring the folder tags shown above.

Suppose we now add another couple of folders to the template so the total of folders goes to five.
However, suppose that at this point we were to turn off the dynamic folders (by removing the 'dynamic_folders' attribute or setting it to '0'). Suddenly the hitherto ignored existing folder tags will begin exerting their influence. Couch will adjust the folders to bring them in concord to what is being dictated by the code above. This will result in our two newly added folders getting deleted without warning and the total number of folders getting back to three.

Please keep this behaviour of dynamic folders in mind before turning them off after being activated.


DRAFTS AND PREVIEWS:
The second major feature being introduced by Couch 1.1 is the ability to create drafts of existing pages.

Consider the following scenario -
A client wishes to make changes to some of his already published pages but does not want the changes to become immediately visible to the world. There could be several reasons for this -
a. He is likely to make several tentative changes to the pages before settling for the final versions and does not want to mess up the live pages in the process.
b. He wishes to show the revised pages to someone else before making the changes go live.
c. He wishes to make changes to a bunch of pages and then make the changes go online all at once sometime in the future.

Each of the situation listed above can now easily be handled by creating the draft versions of the pages and modifying the drafts instead of the original live pages.

A draft of any published page can be created by accessing the 'Advanced settings' of the page and then clicking the 'Create Draft' button that now shows up there.
d2.png
d2.png (9.5 KiB) Viewed 7711 times


A draft is actually a separate page in itself that has its data copied over from the original page.
d3.png
d3.png (30.75 KiB) Viewed 7711 times


All the drafts are stored in a separate new section called drafts that shows up only if there are any available drafts in the system.
d4.png
d4.png (18.57 KiB) Viewed 7711 times


The drafts are internally linked to their original pages and can also be accessed from the following link that shows up alongside the original pages that have any drafts available
d5.png
d5.png (16.44 KiB) Viewed 7711 times


The user can safely work on a draft page without disturbing the original page at all. He can save the draft just as he would save any of the regular pages. He can also preview the changes he makes to the draft.
d6.png
d6.png (2.98 KiB) Viewed 7711 times


Once he is satisfied with his changes, he can either choose to update the original page (this will move the data from the draft into the original page and then delete the draft itself)
d7.png
d7.png (16.49 KiB) Viewed 7711 times

or discard the draft

More than one draft may be created out of a single page. This comes in handy when the user wishes to create several different versions of the same page and then finally choose one of them to go live.

EASY MIGRATION OF SITE FROM DEVELOPER'S SERVER TO THE DEPLOYMENT SERVER
There are actually two additions to Couch 1.1 that have been made to ease the task of a designer who develops a client's site on his own (usually local) machine and then finally deploys it onto his client's host.

1. The first change that has been made is that the editable regions of type 'image', 'thumbnail' and 'file' no longer store the full path of their contents. As an example, suppose the designer sets up a page and uploads an image to show up on it. Prior to version 1.1, Couch would have stored the full path of the image in the database. Since the machine the designer is working on is his local one, this path also references his local machine. It is not difficult to see that after he migrates this site to the deployment server, these paths will still continue to point to his local machine and he'll be required to rectify them all manually.
With version 1.1, Couch internally stores all the paths relative to the server it is executing from. This completely solves the issue outlined above.

2. As a part of developing a client's site, apart from setting up the templates, a designer usually also creates several pages and inputs data within them.
While deploying the site at the client's server, there was no simple way of recreating the same pages at the new location except doing so manually or using phpMyAdmin.

Couch 1.1 now ships with a small utility named 'gen_dump.php' within the 'couch' folder (akin to the 'gen_htaccess.php' that are already familiar with).
Once the local site is complete and you are ready to move it, execute this utility (while being logged in as the super-admin of course). It will create a dump of the local data in a file named 'install_ex.php' and prompt you save it somewhere on your machine.
Download it and save it within your 'couch' folder (or whatever it has been renamed to).
Now copy your entire local site (along with the 'couch' folder and the 'install_ex.php' within it) to the deployment server.

Now proceed with the usual way of installing Couch -
Make changes to the 'config.php' to reflect the new database information.
Access the 'couch' folder on the new machine in a browser.
Couch will sense that installation is required and will prompt you for the admin name etc. (the usual stuff) and will initiate installation.
The installation routine will detect the presence of the dump file 'install_ex.php' and will use it to recreate the data from your local machine at the new location.
Login into the installation and you should find it to be an exact copy of what you configured on your local machine.

To recap, the only new step is to use 'gen_dump.php' to create the dump file named 'install_ex.php' and store it within the 'couch' folder for the installation routine to find.

SECURING THE ADMIN PANEL
The 'couch' folder placed within your site is the sole entry into the admin panel.
Understandably, access to the 'couch' folder should be restricted to dissuade malicious users from trying to break into it (although there are steps in place to prevent this from happening).

Prior to version 1.1, one way of doing so was renaming the 'couch' folder to anything else.
The idea is to make it difficult for non-welcome users to figure out the entry into the admin panel.
This method is still valid, and you are strongly recommended to do so, but unfortunately is not bullet-proof. The problem is that there are some URLs that have the admin folder's name contained within them and hence inadvertently 'leak' the changed name out. Thus someone who knows what he is looking for can find it out.

Strictly speaking it is not the 'couch' folder that is the sole gateway to the admin panel. It is in fact the 'index.php' that is present within it.
Couch 1.1 advances the method one step ahead and allows you to change the name of the 'index.php' to anything else.

It is a powerful way of securing your Couch installation from unwanted access and you are strongly exhorted to do so by taking the following steps -

1. Rename 'index.php' to whatever you wish (retaining the php extension of course). For our example, let us suppose that we rename it to 'prada78.php'

2. Open up 'config.php' and find the following lines
Code: Select all
   // 1b.
   // For security purpose, the 'index.php' file of Couch can be renamed to anything else.
   // If you do so, uncomment the following line and enter the new name.
   //define( 'K_ADMIN_PAGE', 'kachua.php' )

Uncomment the 'define' after adding our new name to it. Thus it will now become
Code: Select all
   // 1b.
   // For security purpose, the 'index.php' file of Couch can be renamed to anything else.
   // If you do so, uncomment the following line and enter the new name.
   define( 'K_ADMIN_PAGE', 'prada78.php' )   

(notice how we have removed the two slashes from the beginning of the 'define').

From now on, your admin panel will be accessible only through http://www.yoursite.com/couch/prada78.php

3. The two steps given above should be enough but anyone accessing http://www.yoursite.com/couch/ will be shown a 'File not found' error.
This is not bad at all but will give a clue to someone looking for gaining entry that the index file has been renamed.
To make our defense complete, you'll find a file named '_index.php' (that is an underscore before the 'index'). Make a copy of it and rename the copy to 'index.php' (i.e remove the underscore). Upon accessing http://www.yoursite.com/couch/ the usual login box will be shown, however this 'index.php' is a specially crafted one and will NEVER allow a login to be successful. So any one trying to get in can try for as long as he wishes but will never be able to get it in.
This completes the illusion and will make someone trying to get in to bark up a different tree altogether (but be sure to remember yourself that the admin panel is now accessed through http://www.yoursite.com/couch/prada78.php and not http://www.yoursite.com/couch/ lest you find yourself wondering why you are unable to login).

As always, we welcome your comments/criticism pertaining to the new version.