login | register
Thu 20 of Nov, 2008 (20:24 UTC)

bitweaver - Web Application Framework and CMS

Web Application Framework and CMS

Refresh cacheHistoryPrint

PortingTikiWikiPackages

This is documentation of the process used while porting Trackers V2 from TikiWiki 1.9 to bitweaver.

Created by: Stephan Borg, Last modification: Sun 18 of May, 2008 (20:42 UTC) by laetzer

Create the Directories

Well, first thing I'll do is create sub-dirs under my bitweaver install as per Fire's Tutorial_Custom_package.
$ mkdir trackers2
$ mkdir trackers2/admin
$ mkdir trackers2/icons
$ mkdir trackers2/modules
$ mkdir trackers2/plugins
$ mkdir trackers2/templates


Copying the Files

First thing I'll do is copy the trackers library, root php files, modules and templates. I've used the '...' to indicate the previous command but with a different filename for brevity.

Libraries

$ cp ../tw-1.9/lib/trackers/trackerlib.php trackers2

Root files (non-admin)

$ cp ../tw-1.9/tiki-list_trackers.php trackers2
 ...tiki-view_tracker_item.php
 ...tiki-view_tracker_more_info.php
 ...tiki-view_tracker.php

Root files (admin)

$ cp ../tw-1.9/tiki-admin_include_trackers.php trackers2/admin
 ...tiki-admin_tracker_fields.php
 ...tiki-admin_trackers.php

Icons

$ cp ../tw-1.9/img/icons/admin_trackers.png trackers2/icons

Modules

$ cp ../tw-1.9/modules/mod-last_modif_tracker_items.php trackers2/modules
 ...mod-last_tracker_items.php

Templates (modules)

$ cp ../tw-1.9/templates/modules/mod-last_modif_tracker_items.tpl trackers2/modules
 ...mod-last_tracker_items.tpl
 ...mod-usergroup_tracker.tpl

Wiki Plugins

$ cp ../tw-1.9/lib/wiki-plugins/wikiplugin_tracker.php trackers2/plugins
 ...wikiplugin_trackerlist.php

Templates (non-modules)

 cp ../tw-1.9/templates/tiki-admin-include-trackers.tpl trackers2/templates
 ...tiki-admin_tracker_fields.tpl
 ...tiki-admin_trackers.tpl
 ...tiki-list_trackers.tpl
 ...tiki-plugin_trackerlist.tpl
 ...tiki-view_tracker_item.tpl
 ...tiki-view_tracker_more_info.tpl
 ...tiki-view_tracker.tpl

Templates (notifications)

$ cp ../tw-1.9/templates/mail/tracker_changed_notification.tpl trackers2/templates


Renaming files

Its BW practise to remove the tiki- prefix from all PHP and Smarty templates.
cd trakers2
find . | grep tiki- | sed -re "s/^(\S*)tiki\-(\S*)$/mv \1tiki-\2 \1\2/g"  > tmp && sh tmp && rm tmp

Dirty but it works ;-)

index.php

Lets start with an index page. By default, we want list trackers to be the index page. Rather than rename the page, I'd suggest creating a new index.php file, and using a Location header to redirect to your preferred start page.
<?php
header ("location: sheets.php");
die;
?>


bit_setup_inc.php

Okay - all references to tiki-setup.php must be changed to ../bit_setup_inc.php. I've used a PERL command that will find and replace all instances of tiki-setup.php to ../bit_setup_inc.php in all *.php files under trackers2 directory.
$ perl -i -pe 's/tiki-setup.php/..\/bit_setup_inc.php/g' `find trackers2 -type f -name '*.php'`


Now create a bit_setup_inc.php file in the trackers2 directory. I've used the trackers/bit_setup_inc.php file as a template.
<?php
// Initialise global variables
global $gBitSystem, $gBitUser;
 
// Register package with kernel
$gBitSystem->registerPackage( 'Trackers v2', dirname( __FILE__ ).'/' );
 
// If package is installed
if( $gBitSystem->isPackageActive( 'trackers2' ) )
{
    // Register user menu
    $gBitSystem->registerAppMenu( TRACKERS2_PKG_DIR, TRACKERS2_PKG_NAME, TRACKERS2_PKG_URL.'index.php',
    'bitpackage:trackers2/menu_trackers.tpl', true );
}
?>


Libraries

Okay - all references to lib/trackers/trackerlib.php must be changed to TRACKERS2_PKG_PATH.'tracker_lib.php'. Once again, we will use a PERL find and replace.
$ perl -i -pe "s/\'lib\/trackers\//TRACKERS2_PKG_PATH.\'/g" `find trackers2 -type f -name '*.php'`


Field and Variable Names

One standard we have changed from TikiWiki, is the variable naming convention. All fields and variables now use underscores and standard suffixes identifying the data type.
trackerId => tracker_id
lastModif => last_modified
showCreated => show_created
showStatus => show_status
showLastModif => show_last_modified
etc

You can use a PERL find and replace to do mass changes:
$ perl -i -pe "s/trackerId/tracker_id/g" `find trackers2 -type f`

Comments

Related Items

Packages

A list of packages available for installation

Archived Picture Upload with Fisheye under Windows  •  bitweaverFeatures  •  Bitweaver Features  •  bitweaverPackage  •  GatekeeperPackage  •  MessagesPackage  •  MetaPackage  •  PackageVisionBtodoroff  •  phpdoc content status  •  PortingTikiWikiPackages  •  QuotaPackage  •  SmileysPackage  •  StencilsPackage  •  StoragePackage  •  Tutorial_Custom_Package

Documentation » Technical Documentation

Documentation geared towards developers and people who want to learn about the core processes of bitweaver

HEAD ON! Support has been added for Pear::DB!  •  Oracle Reservations for Two  •  ReleaseTwo: Shedding that last bits of our roots, finding the core of our being  •  getContentList  •  How to add a pagination to an object list  •  Moving bw in another directory  •  safe mode on / open_base_dir  •  sequence and auto  •  APIDocumentation  •  Archived Picture Upload with Fisheye under Windows  •  Bitweaver and Browser Cookies  •  bitweaverCVS  •  bitweaverFeatures  •  bitweaverPerformance  •  CodingGuidelines  •  Contribute Code  •  CreatingServices  •  CssSchema  •  InstallbitweaverDoc  •  IntegrationTutorial  •  LibertyFormats  •  LibertyMime  •  LibertyServices  •  MySQL encoding issues  •  phpdoc content status  •  PortingTikiWikiPackages  •  PrototypeAjaxObject  •  PrototypeReference  •  SamplePackage  •  SearchPackageDevNotes  •  TUTORIAL - Displaying Icons ONLY to AUTHORS of the page  •  Tutorial - Liberty Plugins  •  Tutorial - Liberty Plugins II  •  UsersDoc