[Building Sakai] Auto-adding a tool to all existing users

Bryan Holladay holladay at longsight.com
Mon Apr 16 06:56:24 PDT 2012


Oh, just realized it's MyWorkspace after I sent this... With the
MyWorkspace sites, you can just deleted all existing My Workspaces and
that will trigger Sakai to create a new one based on the template
(!user) when they log back in.  You can see an example WebService to
do this at: https://source.sakaiproject.org/svn//msub/longsight.com/webservices/webservices-1.0.x/axis/src/webapp/WSLongsight.jws
 (function: deleteAllMyWorkspaceSites)... or you can do it manually in
the DB.

-Bryan

On Mon, Apr 16, 2012 at 9:52 AM, Bryan Holladay <holladay at longsight.com> wrote:
> You can use a DB script like so:
>
> This is a simple script that will backfill a tool into every site
> selected.  This example goes over how to add the Search Tool and
> insert it alphabetically.
> Ensure that you do a find and replace for both the registration
> (sakai.search) and the tool Title ('Search').  There are multiple
> places where these show up in the script.
>
>
> create table TOOL_TMP(
>    PAGE_ID VARCHAR(99),
>    SITE_ID VARCHAR(99)
> )
> Go
>
> create table TOOL_TMP2(
>    PAGE_ID VARCHAR(99),
>    SITE_ID VARCHAR(99),
>    TITLE VARCHAR(99),
>    LAYOUT char(1),
>    SITE_ORDER int(11),
>    POPUP char(1)
> )
> Go
>
> insert into TOOL_TMP
> (
>    select uuid() as PAGE_ID, SITE_ID as SITE_ID
>    from SAKAI_SITE
>    where SITE_ID not in (select SITE_ID from SAKAI_SITE_TOOL where
> REGISTRATION = 'sakai.search')
>    and SITE_ID not like '!%'
>    and  SITE_ID not like '~%'
> )
> Go
>
>
> --This adds the site page in alphabetical order
> insert into TOOL_TMP2
> (
>    select PAGE_ID, SITE_ID, "Search", 0, (select SITE_ORDER + 1 from
> SAKAI_SITE_PAGE ssp where ssp.SITE_ID = tt.SITE_ID and ucase(TITLE) <
> 'SEARCH' Order By Title DESC Limit 1) as toolOrder, 0
>    from TOOL_TMP tt
> )
> Go
>
> --now update any null values since there could be some, just make it
> the last tool in the site
> update TOOL_TMP2 tt
> Set SITE_ORDER = (select count(*) + 1 from SAKAI_SITE_PAGE ssp where
> ssp.SITE_ID = tt.SITE_ID)
> where SITE_ORDER is null
> Go
>
> insert into SAKAI_SITE_PAGE
> (
> select * from TOOL_TMP2
> )
> Go
>
>
> insert into SAKAI_SITE_TOOL
> (select uuid(), PAGE_ID, SITE_ID, 'sakai.search', 1, 'Search', null
> from TOOL_TMP2)
> Go
>
>
> Drop Table TOOL_TMP2
> Go
>
> Drop Table TOOL_TMP
> Go
>
>
> On Mon, Apr 16, 2012 at 9:50 AM, David Wafula <davidwaf at gmail.com> wrote:
>> Forgot to mention that is there a way to do it without coding ?
>>
>> thanks.
>>
>> On Mon, Apr 16, 2012 at 3:49 PM, David Wafula <davidwaf at gmail.com> wrote:
>>> Dear all,
>>> I can make a tool  auto-appear on workspace for new users once they
>>> log in. How do it for existing ones?
>>>
>>> Thanks.
>>> --
>>> David Wafula
>>
>>
>>
>> --
>> David Wafula
>> _______________________________________________
>> sakai-dev mailing list
>> sakai-dev at collab.sakaiproject.org
>> http://collab.sakaiproject.org/mailman/listinfo/sakai-dev
>>
>> TO UNSUBSCRIBE: send email to sakai-dev-unsubscribe at collab.sakaiproject.org with a subject of "unsubscribe"


More information about the sakai-dev mailing list