Porting our custom application to Milan

Discussion about the PHP backend based on Zend-Framework

Porting our custom application to Milan

Postby jrad » Tue May 01, 2012 1:20 pm

We figured out that in our application (CCenter) frontend Json.php, we should change:

Code: Select all
$defaultContainer = Tinebase_Container::getInstance()->getDefaultContainer(Tinebase_Core::getUser()->getId(),$this->_applicationName)->toArray();


to this:

Code: Select all
$defaultContainer = Tinebase_Container::getInstance()->getDefaultContainer($this->_applicationName)->toArray();


since getDefaultContainer declaration is changed in Milan!
Doing this, resolved our server side error, but now application is not rendered at client side and getToolbarFilter JS error is occurred! I've noticed that in our previous tine20 version, there existed a container named "Username's personal CCenter", but now it seems no container exists for our CCenter application!
here is CCenter's Controller.php:

Code: Select all
public function createPersonalFolder($_accountId)
    {
        $translation = Tinebase_Translation::getTranslation('CCenter');

        $account = Tinebase_User::getInstance()->getUserById($_accountId);

        $newContainer = new Tinebase_Model_Container(array(
            'name'              => sprintf($translation->_("%s's personal ccenter"), $account->accountFullName),
            'type'              => Tinebase_Model_Container::TYPE_PERSONAL,
            'owner_id'          => $_accountId,
            'backend'           => 'Sql',
            'application_id'    => Tinebase_Application::getInstance()->getApplicationByName('CCenter')->getId()
        ));

        $personalContainer = Tinebase_Container::getInstance()->addContainer($newContainer);
        $container = new Tinebase_Record_RecordSet('Tinebase_Model_Container', array($personalContainer));

        return $container;
    }

protected function _handleEvent(Tinebase_Event_Abstract $_eventObject)
    {
        if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) Tinebase_Core::getLogger()->trace(__METHOD__ . ' (' . __LINE__ . ') handle event of type ' . get_class($_eventObject));

        switch(get_class($_eventObject)) {
            case 'Admin_Event_AddAccount':
                $this->createPersonalFolder($_eventObject->account);
                break;
            case 'Admin_Event_DeleteAccount':
                #$this->deletePersonalFolder($_eventObject->account);
                break;
        }
    }


We urgently need to upgrade to Milan, so would you please help us resolving this problem!?
jrad
 
Posts: 15
Joined: Sat Mar 03, 2012 4:58 pm

Re: Porting our custom application to Milan

Postby ph_il » Thu May 03, 2012 10:47 am

do you have a default container preference in your application?

this can be passed as third param to the getDefaultContainer() function:

Code: Select all
public function getDefaultContainer($applicationName, $accountId = NULL, $defaultContainerPreferenceName = NULL)
Philipp Schüle
Tine 2.0 Core Developer

Visit http://www.tine20.com (commercial support, consulting and development)
Visit http://www.tine20.net (Tine 2.0 hosting)
User avatar
ph_il
Tine 2.0 Core Developer
 
Posts: 3513
Joined: Fri Mar 07, 2008 11:41 am

Re: Porting our custom application to Milan

Postby jrad » Sat May 05, 2012 1:26 pm

I don't know! what is "default container preference"?
The first code mentioned above was working in alpha2 version.
Would I know when the code in Controller.php is called to create the default container!?
on user creation? or on app setup? Is something stopping it from creating the default container? is it wrong code? or default container is being created but not fetched correctly?
jrad
 
Posts: 15
Joined: Sat Mar 03, 2012 4:58 pm

Re: Porting our custom application to Milan

Postby ph_il » Mon May 07, 2012 11:18 am

jrad wrote:I don't know! what is "default container preference"?


the user can defined a default container for his records. this container is selected by default for new records if no other container is selected. the container id is saved in the preference.

you can have a look in the preferences table if there is one for your app.

which application did you use as template for your app? the ExampleApplication? CRM?
do you use the generic container tree in your app?
Philipp Schüle
Tine 2.0 Core Developer

Visit http://www.tine20.com (commercial support, consulting and development)
Visit http://www.tine20.net (Tine 2.0 hosting)
User avatar
ph_il
Tine 2.0 Core Developer
 
Posts: 3513
Joined: Fri Mar 07, 2008 11:41 am

Re: Porting our custom application to Milan

Postby jrad » Mon May 07, 2012 2:56 pm

Thank you for your support Philipp, we badly need your help.

In the working version, table tine20_preferences is empty, but there exists a container named "Tine 2.0 Admin Account's personal ccenter" for admin account.

We've taken that snippet code from Tasks app Controller.php, but CC app mainly
is inherited from CRM app, and in our application tab, there exists a "CC List"
in the left side bar (like Lead List in Crm) which contains:
-My CC List
-Shared CC List
-Other User CC List
which My CC List contains a "Tine 2.0 Admin Account's personal ccenter" for admin account!

I think, the problem is that in Milan "Tine 2.0 Admin Account's personal ccenter" is not being
created after CC app setup in tine20!
jrad
 
Posts: 15
Joined: Sat Mar 03, 2012 4:58 pm

Re: Porting our custom application to Milan

Postby jrad » Mon May 07, 2012 5:50 pm

Dear Philipp,
I finally solved the problem, and it was related to JS code not the default container, since I figured out from the mysql db that app's default container does exist! and is returned normally after we changed our frontend Json.php's getRegistryData function. (swaped arguments of getDefaultContainer )
So after digging into JS code I found that Tine.widgets.mainscreen.WestPanel's getContainerTreePanel method implementation has changed from
Code: Select all
getContainerTreePanel: function() {
        if (this.hasContainerTreePanel && !this.containerTreePanel) {
            this.containerTreePanel = new Tine[this.app.appName][this.containerTreePanelClassName]({app: this.app});
        }
       
        return this.containerTreePanel;
    },


in alpha 2 to the following in Milan:
Code: Select all
getContainerTreePanel: function() {
        var panelName = this.app.getMainScreen().getActiveContentType() + 'TreePanel';
        if(!this[panelName]) {
            if(Tine[this.app.appName].hasOwnProperty(panelName)) this[panelName] = new Tine[this.app.appName][panelName]({app: this.app});
            else this[panelName] = new Tine.widgets.persistentfilter.PickerPanel({app: this.app});
            this[panelName].on('click', function (node, event) {
                if(node != this.lastClickedNode) {
                    this.lastClickedNode = node;
                    this.fireEvent('selectionchange');
                }
            });
        }

        return this[panelName];

    },


and this was breaking our CC mainscreen to render because app tree panel's name was inconsistent between versions. so, changing the Tine.CCenter.Treepanel to ReportTreePanel fixed the problem in Milan!

Thank you again for your help.
jrad
 
Posts: 15
Joined: Sat Mar 03, 2012 4:58 pm

Re: Porting our custom application to Milan

Postby ph_il » Tue May 08, 2012 11:19 am

ah, ok ... it was a problem of the js client.

jrad wrote:Thank you again for your help.


you are welcome!
Philipp Schüle
Tine 2.0 Core Developer

Visit http://www.tine20.com (commercial support, consulting and development)
Visit http://www.tine20.net (Tine 2.0 hosting)
User avatar
ph_il
Tine 2.0 Core Developer
 
Posts: 3513
Joined: Fri Mar 07, 2008 11:41 am


Return to PHP backend discussion

Who is online

Users browsing this forum: No registered users and 2 guests

Startseite
NewsDemoDownloadForumWikiBlog
Support
Support at first hand!
If the forum does not help anymore ... Professional support is available directly from our Tine2.0 core Developers.

more »