Forum OpenACS Development: portal fixes

Request notifications

Collapse
Posted by Jun Yamog on
Hi,

I can't seem to see portal included as one of the component on the Bug Tracker.  Anyway here is a diff of some simple fixes.

Index: portal//tcl/portal-procs.tcl
===================================================================
RCS file: /home/ctk/cvsroot/ctk/packages/portal/tcl/portal-procs.tcl,v
retrieving revision 1.1
diff -u -r1.1 portal-procs.tcl
--- portal//tcl/portal-procs.tcl    9 Jul 2004 16:18:40 -0000    1.1
+++ portal//tcl/portal-procs.tcl    20 Jul 2004 14:43:30 -0000
@@ -630,7 +630,8 @@
            set master_portal_id [portal::new \
                                      -name "Shared Portal" \
                                      -owner_id 0 \
-                                    -theme_name [parameter::get -parameter DefaultThemeName] \
+                                    -theme_name [parameter::get -parameter DefaultThemeName -package_id $package_id \
+                                                      -default [parameter::get_from_package_key -package_key portal -parameter -DefaultThemeName]] \
                                      -owner_privileges {}]

            # create the admin template
@@ -639,8 +640,11 @@
                                    -name "Portal Administration" \
                                    -owner_id $package_id \
                                    -page_list {{"Portal Administration" 2_column}} \
-                                    -theme_name [parameter::get -parameter DefaultThemeName] \
+                                    -theme_name [parameter::get -parameter DefaultThemeName -package_id $package_id \
+                                                    -default [parameter::get_from_package_key -package_key portal -parameter -DefaultThemeName]] \
                                    -owner_privileges {}]
+
+

            db_foreach select_portal_datasources {} {
                if { $admin_p } {
Index: portal//tcl/theme-procs.tcl
===================================================================
RCS file: /home/ctk/cvsroot/ctk/packages/portal/tcl/theme-procs.tcl,v
retrieving revision 1.1
diff -u -r1.1 theme-procs.tcl
--- portal//tcl/theme-procs.tcl    9 Jul 2004 16:18:40 -0000    1.1
+++ portal//tcl/theme-procs.tcl    20 Jul 2004 14:43:30 -0000
@@ -51,6 +51,8 @@
        @return The theme_id

    } {
+        if {[empty_string_p $name]} { set name [parameter::get_from_package_key -package_key portal -parameter -DefaultThemeName] }
+
        return [db_string select_theme_id {}]
    }

I am also tracking another bug, when you call portal::initialize inside subsite::after_mount it seems it can't see the first page.  Really weird, must be my dev env.  It barfs at portal::page::get_id

Collapse
2: Re: portal fixes (response to 1)
Posted by Don Baccus on
Hey thanks, Jun, I'm back to working portal/.LRN re-integration (i.e. rewriting applets and portlets and upgrade scripts) after being away from it for a couple of weeks, partly relaxing, partly helping a couple of universities with unrelated tasks.

Anyway ... good catch on the above stuff, I missed those when I modified the portal package to be a non-singleton package.

As far as your subsite::after_mount problem, I have no clue, as I've not tried integrating the portal package into subsites automatically at this point (though it would be good to have this capability).

Collapse
3: Re: portal fixes (response to 1)
Posted by Don Baccus on
For the last change I made the "name" parameter optional ...
    ad_proc -public get_id {
        {-name}         
    } {
        Return a theme's id

        @name The name of the theme, defaults to the portal default theme name
        @return The theme_id

    } {
         if { ![info exists name]} { 
             set name [parameter::get_from_package_key \
                          -package_key portal \
                          -parameter -DefaultThemeName]  
         }
        return [db_string select_theme_id {}]
    }

I'm committing these to HEAD...
Collapse
4: Re: portal fixes (response to 1)
Posted by Jun Yamog on
Hi Don,

I think I left the -name required since I though it was more logical.  Deds pointed to me that I can try to use acs-subsite/lib/intall.xml  He back ported it on our project, so I will let you know if it works.  My local install seems to be flaky so it might me my problems are due to my dev env.

Can any one add "portal" component to the Bug Tracker?  Thanks.

Collapse
5: Re: portal fixes (response to 1)
Posted by Jun Yamog on
I have finally traced down why I can't call portal::initialize under subsite::after_mount.  Bug and patch here:

http://openacs.org/bugtracker/openacs/bug?bug%5fnumber=2034

While doing this, I also notice maybe it is better to have portal::page::get_id to create a new page in case it doesn't find one.  Or atleast generate a good error?  Failure of db_string get_page_id_select {} is a bit vague.

I also noticed it was bit hard to trace under subsite::after_mount.  I am unsure where was the error coming from so it took some "error" and ns_log to find it.

Are you guys kind enough to tell it is still redirecting to portal/www/admin/configure when in fact I have configured it already and initialized?  Thanks.

Collapse
6: Re: portal fixes (response to 1)
Posted by Jun Yamog on
Ok answering myself why I still need to configure where in fact I already have called portal::initialize.  Found 1 more bug, its very near the bug i posted so using the same bug and just uploading a better patch.
Collapse
7: Re: portal fixes (response to 1)
Posted by Don Baccus on
My local copy of portal::element::get_id returns an intelligent error message if there's no portlet or more than one portlet that matches the search criteria.  I'll be committing this soon.

As far as having get_id create a portlet if one doesn't exist, that's what the old new-portal code did.  As it happens, .LRN depends on it heavily because various applet operations are called at times with no portlet created and at other times with the portlet created.

Personally I think that's gross, and rather than writing get_id to magically create portlets as a side-effect, I intend to make .LRN always create needed portlets before calling the related applet routines rather than do so sometimes and not others.

Collapse
8: Re: portal fixes (response to 1)
Posted by Jun Yamog on
Hi Don,

I am looking at portal::page::get_id and not portal::element::get_id :)  So its either we put a nice error or we create a new page.  I am more for maybe the error or returns something like 0 or something it case it does get a page id.