CMS-MS on Rails Sorta

Talk about writing modules and plugins for CMS Made Simple, or about specific core functionality. This board is for PHP programmers that are contributing to CMSMS not for site developers
Post Reply
brownrl
Forum Members
Forum Members
Posts: 74
Joined: Thu Sep 23, 2004 11:06 am

CMS-MS on Rails Sorta

Post by brownrl »

Looking around the forums I see a number of people are asking for some kind framework, rails, php cake solution in CMS-MS.

I have just completed version .01 of what I call 'rcrud' -> "Robs CRUD"

It is a php class that works off of a adodblite link and a table name. Its basic and works with text and textarea forms fields for now... stay tuned.

The class is not specific to CMS-MS and maybe works in other libs/projects.  CMS-MS is my target.

To Use:

1. Download http://www.hlounge.net/rcrud ( site will improve )

2. Unpack to your module directory, one file rcrud.inc.php ( always will be one file nothing more )

3. require at the top of your module before the class dec:

Code: Select all

require_once( 'rcrud.inc.php' );
4. Create a Crud Object ( inside the default admin action for your module ):

Code: Select all

$co = new rcrud( $this->cms->db , 'module_table_name' );
5. Optional configure: Read the inc file on how to do more. The code is ~clean~ and documented. Documentation and more features in version .02

Code: Select all

$co->fields['news_id']['visible_in_add'] = false;
$co->setVisibleInListAll( false );
$co->fields['news_title']['visibile_in_list'] = true;
...

6. Run the rcrud object

Code: Select all

$co->go();
7. Browse to your admin area and module area and run the function/action that calls the 'go' method.

BAM You now have a primitive table manager Create/Add, Report/Show, Update/Edit, Delete.

I will be using this to make mods in the future and will be updating.

DISCLAIMER: Do not use this on the front end of the site, its insecure for the moment use only in the backend module admin area and make sure that the back end user has some sort of permissions for that module. Rcrud does not do authetication... yet...
User avatar
sjg
Power Poster
Power Poster
Posts: 310
Joined: Thu Jan 27, 2005 5:11 pm
Location: Los Angeles, CA

Re: CMS-MS on Rails Sorta

Post by sjg »

Sounds like a great project! Keep us up to date on your progress!
Many modules available from the http://dev.cmsmadesimple.org
The CMS Made Simple Developer Cookbook is now available from Packt Publishers!
brownrl
Forum Members
Forum Members
Posts: 74
Joined: Thu Sep 23, 2004 11:06 am

Re: CMS-MS on Rails Sorta

Post by brownrl »

Thanks for the comments so far. Its still in the very beginning. However my overall goal is to make a class that will allow web development to occur at a rate even faster than rails or trax or cake. I very much dislike these seperate application server techs like JSP and Rails. Isn't Apache good enough for people to use? Why make a second server and open port that has to be worried about...

Version .02 is here: http://hlounge.net/rcrud

Cleaned up and added the following;

Foreign Key Selector: This makes the field appear as a select drop down based on a key/label pair from another table. This also changes the appearance in the listing for this field. It will then show the label and not just the id value.

Code: Select all

$co->fields['news_category_id']['field_type'] = "select|news_categories|category_id|category_label";

Range Selector: This make the field a select from 0 to 10

Code: Select all

$co->fields['news_rating']['field_type'] = "select|range|0|10";

Radio Maker: This makes the field appear as a radio button group.

Code: Select all

$co->fields['status']['field_type'] = "radio|Published|Unpublished";

let me know if you use this thing, I will be happy to lend a hand if problems occur.

-- Rob
Russ
Power Poster
Power Poster
Posts: 813
Joined: Fri Nov 25, 2005 5:02 pm
Location: North West England

Re: CMS-MS on Rails Sorta

Post by Russ »

Interesting, I've no time this weekend, but I hope to have a proper look next week. I often feel that such framworks live or die on the quality of their documentation and examples, so keep up the good work. Nice to see a different approach ;-)

Russ
brownrl
Forum Members
Forum Members
Posts: 74
Joined: Thu Sep 23, 2004 11:06 am

Re: CMS-MS on Rails Sorta

Post by brownrl »

Thanks for the encouragement. Version .03 is here: http://hlounge.net/rcrud

It should only take a few minutes to see it in action.

Create a module with Module Maker or the Skeleton, make a table with a varchar, text, datetime, and int

To just see the deafult behavior

include the class, create the crud object.

$co = new rcrud( $this->cms->db , "table_name" );

then

$co->go();

To play with more check out the site and the class source. Very small less 700 lines with commenting.


I hate to be a dork about this but I see that this thing really works and creating a plain jane crud modules should be a snap now.

version .04 should have a user side master/view in it.

-- Rob
iNSiPiD

Re: CMS-MS on Rails Sorta

Post by iNSiPiD »

And I hate to sound like a complete non-dork but just exactly what does this framework do? :)

Does it allow editing of module tables through the admin?
brownrl
Forum Members
Forum Members
Posts: 74
Joined: Thu Sep 23, 2004 11:06 am

Re: CMS-MS on Rails Sorta

Post by brownrl »

Its a php class that you can include in your CMS MS module.

What it will do is give you basic CRUD for handling a table(s) in your module admin section.

From there you can customize it further by setting member variable flags.

ex,
$co->fields['news_id']['visible_in_add'] = false;

Will set that the news_id ( probably and auto incremement number ) is not shown in the INSERT form.

Create, Report, Update, Delete

Combined with module maker you can make a basic table based modules in less than 20 minutes.

try it out on the news module, create a new dummy module that has one admin action, create a rcrud object, then run it.

require_once('rcrud.inc.php');
$co = new rcrud( $this->cms->db, "cms_module_news" );
$co->go();


more documentation is on the site and will be expanding, http://hlounge.net/rcrud

No one sounds like a dork or nerd on a forum for a web based content management system... ;) we all do... :D

Rob
brownrl
Forum Members
Forum Members
Posts: 74
Joined: Thu Sep 23, 2004 11:06 am

Re: CMS-MS on Rails Sorta

Post by brownrl »

Sorry to keep bumping this topic up but this is the last post I'll do here for rcrud.

RCRUD Version .04 is good to go

http://hlounge.net/rcrud

The site now has on online demo so that you can see what this does plus alot of documentation.

The code that runs the demo is 15 lines and it is placed inside of a user defined tag. Will also work in a module obviously. Demo took 10 minutes to make including the time to make the database tables.

You can see that I am using some of the CMS MS CSS to present the demo better, hope no one minds if so I will change.

Give it a try, I would love to read what people are thinking.

-- Rob
Russ
Power Poster
Power Poster
Posts: 813
Joined: Fri Nov 25, 2005 5:02 pm
Location: North West England

Re: CMS-MS on Rails Sorta

Post by Russ »

Sorry Rob, I'm having a bit of a week from hell here, so I've no had chance to get a proper look. Just as well as you already have a new version out ;-) I will get round to a proper look I promise...

I did however have a play with your demo, very nice indeed apart from the obvious bit about if you delete a 'Demo Categories' the 'Demo' table category field reverts to another category?? Not sure why this is happening, perhaps just the demo, I would have thought you shouldn't be able to delete a parent if a child with it exists? Perhaps it should raise an error if they are linked. Which perhaps begs the question about table relationships? I take it this is not present in the current version, is this coming in version 0.5 as mentioned with 'master-client' views? Perhaps also some deletion confirmation would be good.? Check boxes and delete checked would be good for mass deletion.

Second the obvious bit from the demo is record locking - how will it cope in a multi user environment. I guess time-stamps for all tables and then some sort of automatic check on update with appropriate warning if something has changed?

Third, and I suspect has more to do with the demo than anything else, is that it doesn't quite meet the old XHTML transitional validation and within CMS we do try to aim for XHTML 1.0 Strict if we can. Shouldn't be too much trouble to fix, as it all about unescaped '&' or unknown entity "&&rcrud_table=demo, &rcrud_id" etc.

On re-reading this it seems a bit negative, this is definitely not my intention, indeed quite the opposite. It looks really good and I think I really want to use something like this in an up and coming project, probably inside a CMS module. For this reason I'd like to iron out any little problems ;-)

If I can be of anymore help, let me know. I'll ty and get a proper look early next week....

Russ
Last edited by Russ on Fri Jul 21, 2006 10:05 am, edited 1 time in total.
brownrl
Forum Members
Forum Members
Posts: 74
Joined: Thu Sep 23, 2004 11:06 am

Re: CMS-MS on Rails Sorta

Post by brownrl »

Russ,

Thanks for the look this wasn't negative you were right on.

The scope of rcrud isn't exactly a full scale application builder. The idea that I had from the start was to make a table CRUD.

You are correct in that if you delete a category then children of the category should delete as well. However, I am not at that point yet but I do have a plan for it. Ideally a linked field would be something like a state or country where the admin user wouldn't be deleting or editing. rcrud < 800 lines at the moment.

I put the demo_category in the demo to show that rcrud can run on two tables at the same time.

I make sites for clients with small budgets and what I wanted to do is speed up making the back end manager for simple things like a jobs module or a trainings module. The news module almost handles this. I could have a news category called 'Jobs' and the articles would be the open jobs in the company. However, there are things like: which office? Who to contact? or simular that the news module doesn't cover and rightfully shouldn't.

Right now rcrud should be used in the back end / admin section of a module wrapped around authentication control. Don't want to re-invent authentication control that most CMS systems already have.

Again thanks for the review and I will be putting in your suggestions for delete confirmation and mass delete and foreign key cascade delete in versions to come. xhtml will be in .05.

-- rob
Post Reply

Return to “Developers Discussion”