Wednesday, June 7, 2006

Cubson First Step Guide (3)

I removed some bugs of cubson and updated it. You can get version 0.43 from download page of this site.

Well, let's restart developing myannounce module. We have developed the control panel functions of myannounce module before now. In today's entry, we will complete public functions.

Before that, we should confirm public functions of this module. What feature does myannounce module have?

  • First, only administrators can register messages in the control panel.
  • Second, users can access the list of messages and the content of messages.

Therefore, edit function and delete function are unnecessary in the public side. You should delete files about edit function and delete function because wizard command generates many files that is used by four kinds of actions. Type the following on cubson console:

cubson> wizard message

You shall see the following file tree in your module directory:

Delete the following files from these files.

  • .xml/message_delete.xml
  • .xml/message_edit.xml
  • actions/MessageDeleteAction.class.php
  • actions/MessageEditAction.class.php
  • forms/MessageDeleteForm.class.php
  • forms/MessageEditForm.class.php
  • templates/myannounce_message_delete.html
  • templates/myannounce_message_edit.html

Next, open xoops_vesrion.php that lists up the name of template files you removed, remove those files, and edit subscript numbers. myannounce_message_edit.html and myannounce_message_delete.html are unnecessary. If you don't edit it, the information of this modules continues keeping names of removed files, and triggers troubles sometime. The following is right code:

//
// Templates. You must never change [cubson] chunk to get the help of cubson.
//
//$modversion['templates'][]['file'] = 'myannounce'_xxxxx.html';
//$modversion['templates'][]['description'] = 'myannounce'_xxxxx.html';
##[cubson:templates]
$modversion['templates'][0]['file'] = 'myannounce_message_list.html';
$modversion['templates'][1]['file'] = 'myannounce_message_view.html';
##[/cubson:templates]

Update module in the controll panel to load templates. Finally, you have to rewrite index.php as well as index.php of the controll panel that you modified in yesterday's entry. Open index.php and replace "Default" with "MessageList".

Ok, public functions have just completed. Access to it, and test it. But this is no end. We should continue tuning.

2 comments:

mikhail said...

hi, Minahito! :-) please, where I can find the original myannounce module for download? (google not found)


[]'s!

mik

minahito said...

Old cubson contains myannounce module. And, users can generate myannounce with cubson command. But the latest cubson can not generate sample modules. Sorry...