Hi all,
I imported the Forums module through module loader.Now I wanted to add the Forums Subpanel in one of the existing modules eg,Accounts.
So i did the following steps:-
Procedure:-
1)I have created two modules wiki_Container (ACCOUNTS) and wiki_Clauses (FORUMS)using module builder tools.
2)Here I want to show the wiki_Clauses subpanel under the wiki_Containers.
3)In the vardefs.php of wiki_Container
add the following link field:-
'wiki_clauses' =>
array (
'name' => 'wiki_clauses',
'type' => 'link',
'relationship' => 'wiki_containers_wiki_clauses',
'module'=>'wiki_Clauses',
'bean_name'=>'wiki_Clause',
'source'=>'non-db',
'vname'=>'LBL_CLAUSES',
),
4)in /wiki_Containers/language/en_us_lang.php
add
'LBL_CLAUSES'=>'clauses',
5)in /wiki_containers/metadata/subpaneldefs.php
add
$layout_defs['wiki_Containers'] = array(
// list of what Subpanels to show in the DetailView
'subpanel_setup' => array(
'wiki_clauses' => array(
'order' => 30,
'module' => 'wiki_Clauses',
'sort_order' => 'asc',
'sort_by' => 'name',
'subpanel_name' => 'default',
'get_subpanel_data' => 'wiki_clauses',
'add_subpanel_data' => 'wiki_clauses_id',
'title_key' => 'LBL_CLAUSES_SUBPANEL_TITLE',
'top_buttons' => array(
array('widget_class' => 'SubPanelTopButtonQuickCreate'),
array('widget_class' => 'SubPanelTopSelectButton', 'mode'=>'MultiSelect')
),
),
),
);
6)Admin repair tab->quick repair and rebuild wiki_Containers module.
7)Edit the vardefs.php of wiki_Clauses to add the link field and relate field for wiki_Containers.
add
'wiki_containers_id' =>
array (
'required' => false,
'name' => 'wiki_containers_id',
'vname' => '',
'type' => 'id',
'massupdate' => 0,
'comments' => '',
'help' => '',
'duplicate_merge' => 'disabled',
'duplicate_merge_dom_value' => 0,
'audited' => 0,
'reportable' => 0,
'len' => 36,
),
'container_name' =>
array (
'required' => '1',
'source' => 'non-db',
'name' => 'container_name',
'vname' => 'LBL_CONTAINER_NAME',
'type' => 'relate',
'massupdate' => 0,
'comments' => '',
'help' => '',
'duplicate_merge' => 'disabled',
'duplicate_merge_dom_value' => 0,
'audited' => 0,
'reportable' => 0,
'len' => '255',
'id_name' => 'wiki_containers_id',
'ext2' => 'wiki_Containers',
'module' => 'wiki_Containers',
'studio' => 'visible',
),
'wiki_containers' =>
array (
'name' => 'wiki_containers',
'type' => 'link',
'relationship' => 'wiki_containers_wiki_clauses',
'link_type' => 'one',
'source' => 'non-db',
'vname' => 'LBL_CONTAINERS',
'duplicate_merge'=> 'disabled',
),
8)then Admin repair tab->quick repair and rebuild wiki_Clauses module.
and finally Rebult the ralationship.
9)Then finally u need to write the wiki_Containers_wiki_ClausesMetaData.php
make the entry of this file in /modules/TableDictionary.php.
add :include("metadata/wiki_containers_wiki_clausesMetaData.php");
10)contents of wiki_Containers_wiki_ClausesMetaData.php are:-
$dictionary['wiki_containers_wiki_clauses'] = array ( 'table' => 'wiki_containers_wiki_clauses'
, 'fields' => array (
array('name' =>'id', 'type' =>'varchar', 'len'=>'36')
, array('name' =>'wiki_clauses_id', 'type' =>'varchar', 'len'=>'36')
, array('name' =>'wiki_containers_id', 'type' =>'varchar', 'len'=>'36')
, array ('name' => 'date_modified','type' => 'datetime')
, array('name' =>'deleted', 'type' =>'bool', 'len'=>'1', 'required'=>true, 'default'=>'0')
) , 'indices' => array (
array('name' =>'wiki_containers_wiki_clausespk', 'type' =>'primary', 'fields'=>array('id'))
, array('name' => 'idx_wiki_container_wiki_clause', 'type'=>'alternate_key', 'fields'=>array('wiki_containers_id','wiki_clauses _id'))
, array('name' => 'idx_clauid_del_contid', 'type' => 'index', 'fields'=> array('wiki_clauses_id', 'deleted', 'wiki_containers_id'))
)
, 'relationships' => array ('wiki_containers_wiki_clauses' => array('lhs_module'=> 'wiki_Containers', 'lhs_table'=> 'wiki_containers', 'lhs_key' => 'id',
'rhs_module'=> 'wiki_Clauses', 'rhs_table'=> 'wiki_clauses', 'rhs_key' => 'id',
'relationship_type'=>'many-to-many',
'join_table'=> 'wiki_containers_wiki_clauses', 'join_key_lhs'=>'wiki_containers_id', 'join_key_rhs'=>'wiki_clauses_id'))
)
?>
11)admin repair tab->repair database->Rebuild Relationship.
12)finally to show ralated data and to enter data in relationship table wiki_containers_wiki_clauses
add following lines of code in wiki_Clauses_sugar.php
var $rel_account_table = "wiki_containers_wiki_clauses";
var $additional_column_fields = Array('wiki_containers_id');
var $relationship_fields = Array('wiki_containers_id'=> 'wiki_containers');
This will shows Clause related to perticular Container.
But Im unable to do the 12th step bec i cant find wiki_Clauses_sugar.php file also i dont know where to create it.
I can see the forums subpanel in Accounts but it doesnt get saved and cant even see the detail view of it
The following error occurs;
Error retrieving record. This record may be deleted or you may not be authorized to view it.
Ill be really thankful if someone could help me out with this.


LinkBack URL
About LinkBacks



Reply With Quote
Bookmarks