Cubson First Step Guide (4)

In testing myannounce modules, you might have noticed some problems. Templates generated are too rough. They should be edited.

So let’s start editing from the control panel. In XOOPS Cube Legacy 2.1, the control panel uses templates systems. The template system of the control panel is file base, which you can not use with DB templates. When you change template files, displays are updated in the same time.

See the control panel.

“message” column is unnecessary for us because we view the message with clicking the view icon. Messages don’t need to show up in the list directly.

Open /admin/templates/message_list.html and edit it. At first, delete “message” column. Next, delete the code that displays messsages:

{$obj->getVar(‘message’)}>

 

Reload this page and confirm message’s removing.

Without rest, edit public templates. Clicking the link to edit and delete in public list triggers errors. Delete these link. So the control column is unnecessary. Delete the message column and the control column. And, update this module to reload this template.

We have just finished template works. Still there are some bad things. Look at the message list after you post some messages. Latest messages are added to the last of the list. You might hope that latest messages are in the top. And so, you may edit action filter forms.

I postpone the explanation about action filter form until next step guide. Open /forms/MessageFilterForm.class.php and edit it as such as the following:

// define(‘MESSAGE_SORT_KEY_DEFAULT’, MESSAGE_SORT_KEY_ID);
define(‘MESSAGE_SORT_KEY_DEFAULT’, -MESSAGE_SORT_CREATE_UNIXTIME);

Also open /admin/forms/MessageFilterForm.class.php and edit it. By this work, you have changed the behavior about order.

Conclusion
We have developed the simple module by the simple table. Cubson can generate code by table structure in real database. However, because generated templates are too rough, you should edit them.

Note
This module that we have developed can’t be published because it doesn’t contain SQL file. Therefore, when users who downloaded your module install it, required tables aren’t created in their database. When you publish this module, you have to write sql/mysql.sql.

Advertisements
This entry was posted in XOOPS Cube and tagged . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s