Adding new field to an asset


(Jamesmoey) #1

Hi all,


I got some problem with creating a new field on an asset. I follow the Tutorials "Creating An Asset" and complete it successfully. There is current a "better_user" asset listed on the Asset Tree and and creating a new instantiate of "better_user" work fine. The next thing I want to do is create an additional field in that asset.



I add the field into edit_interface_screen_details.xml file, lang_screen_details.xml file and better_user_management.inc, then I ran the follwing command:

php install/step_03.php . --package=cms

php install/compile_locale.php .



I can see that the field is created in the database. But it is just not showing up in the interface. Any idea why is that?



James


(Greg Sherwood) #2

Sounds like you did everything correctly. Someone may be able to see something if you post those files.


(Jamesmoey) #3

lang_screen_details.xml
<contents>

<section name="User Details">

<field attribute="username">

<display_name>Username</display_name>

<note>Unique system wide login name</note>

</field>

<field attribute="password">

<display_name>Password</display_name>

<note />

</field>

<field attribute="pass_again">

<display_name>Password Again</display_name>

<note>Enter once to confirm</note>

</field>


<field attribute="first_name">

<display_name>First Name</display_name>

<note />

</field>

<field attribute="last_name">

<display_name>Last Name</display_name>

<note />

</field>

<field attribute="email">

<display_name>Email</display_name>

<note />

</field>

</section>

</contents>



better_user_management.inc

<?php

require_once SQ_INCLUDE_PATH.'/asset_management.inc';

class Better_User_Management extends Asset_Management {



function Better_User_Management(&$pm)

{

$this->Asset_Management($pm);

$this->vars = Array(

'pass_again'=> Array(

'added' => '0.3',

'type' => 'text',

'default' => '',

'description' => 'A new attribute.'
)

);

}//end constructor





}//end class



?>



edit_interface_screen_details.xml

<contents>

<section name="User Details" read_access="write:" write_access="write:attributes" limbo_access="1">

<field attribute="username">

<text width="8" height="1" />

</field>

<field attribute="password">

<password width="8" min_length="6" />

</field>

<field attribute="first_name">

<text width="40" height="1" />

</field>

<field attribute="pass_again">

<text width="8" min_length="6" />

</field>


<field attribute="last_name">

<text width="40" height="1" />

</field>

<field attribute="email">

<email width="25" />

</field>

</section>

</contents>


(Rafal Zrobecki) #4

Where do you want to your field be visible? If you want your field on 'create asset' screen, then you missed one of the screens in your code…


(Jamesmoey) #5

ah… that just click.


thank you very much. I know what to do now.