Issue 102542 - Non-Basic Scripts should run both at user and share level
Summary: Non-Basic Scripts should run both at user and share level
Status: ACCEPTED
Alias: None
Product: General
Classification: Code
Component: scripting (show other issues)
Version: OOo 3.1
Hardware: All All
: P3 Trivial with 3 votes (vote)
Target Milestone: ---
Assignee: AOO issues mailing list
QA Contact:
URL: http://wiki.services.openoffice.org/w...
Keywords:
Depends on:
Blocks:
 
Reported: 2009-06-05 14:11 UTC by bmarcelly
Modified: 2017-05-20 10:55 UTC (History)
6 users (show)

See Also:
Issue Type: FEATURE
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments
This variant is desgned to work for a single user (5.58 KB, application/vnd.openofficeorg.extension)
2009-09-18 09:32 UTC, bmarcelly
no flags Details
This variant is designed to work for all users (5.58 KB, application/vnd.openofficeorg.extension)
2009-09-18 09:33 UTC, bmarcelly
no flags Details

Note You need to log in before you can comment on or make changes to this issue.
Description bmarcelly 2009-06-05 14:11:00 UTC
The current URI specification for running a non-Basic script (JavaScript, BeanShell, 
Java, Python) is :
vnd.sun.star.script:MACROREF?language=Language&location=[user|share|document]

The consequence is that an extension containing a non-Basic script will contain URI's 
where the running level is fixed : either <user> or <shell>. These URI's are hard-
written for example in the AddonUI.xcu file, or in the event tab of a dialog control.
So if the extension designer wants its extension to be installed in user or shared 
levels, he/she must provide and maintain two variants of the same extension.

Minimal request:
Add another location, e.g. <office>, which means : search the script in the <user> 
layer, and if not found search in the <share> layer.

Desirable request: 
If the URI contains <user>, search the script in the <user> layer, and if not found 
search in the <share> layer. This variant has the advantage of enhancing the usage of 
existing extensions. Then there is no need for a new location like <office>.
If the URI contains <share> we could suppose that the intention of the designer is to 
restrict to <share> only.
Comment 1 ab 2009-06-17 09:59:31 UTC
I understand your problem but currently I don't have any capacity
to deal with it. Maybe there's anyone who can have a look at the
implementation and send a patch? STARTED
Comment 2 Mathias_Bauer 2009-09-17 09:56:37 UTC
Can you provide such an extension (please attach) so that one can have a look on
the problem right away?
Comment 3 bmarcelly 2009-09-18 09:31:39 UTC
I will attach two variants of the same simple extension.
Both contain Basic, JavaScript, BeanShell, Python scripts. They all write a little 
text on the current Writer document.

demoShare-1.0.oxt works OK if installed  for "single user".
demoShare-2.0.oxt works OK if installed  for "all users".

Install demoShare-1.0.oxt for ALL users, open a new Writer document.
Run the scripts from Tools > Add-ons > Demo scripts for share/user > ...
Only Basic works. Other scripts display an error "Cannot resolve script location for 
script = xxxx"

Uninstall demoShare-1.0.oxt

Install demoShare-2.0.oxt for a SINGLE user, open a new Writer document.
Run the scripts from Tools > Add-ons > Demo scripts for share/user > ...
Only Basic works. Other scripts display an error "Cannot resolve script location for 
script = xxxx"


The reason is the URI in the file AddonUI.xcu. The same problem would appear from an 
extension toolbar button.
For example for BeanShell we have:
<value>vnd.sun.star.script:bshTest1.HeyWriter.bsh?
language=BeanShell&amp;location=user:uno_packages/demoShare-1.0.oxt</value>
For all users, the term user must be replaced by "share"
<value>vnd.sun.star.script:bshTest1.HeyWriter.bsh?
language=BeanShell&amp;location=share:uno_packages/demoShare-1.0.oxt</value>
 
Conclusion :
Because of the current URI syntax you need to provide separate extensions, one for 
user, one for share.

Related bug : see Issue 105169
Comment 4 bmarcelly 2009-09-18 09:32:49 UTC
Created attachment 64836 [details]
This variant is desgned to work for a single user
Comment 5 bmarcelly 2009-09-18 09:33:21 UTC
Created attachment 64837 [details]
This variant is designed to work for all users
Comment 6 Oliver Brinzing 2010-05-15 09:05:40 UTC
.
Comment 7 Marcus 2017-05-20 10:55:57 UTC
Reset assigne to the default "issues@openoffice.apache.org".