[Erp5-report] r8954 - in /erp5/trunk/utils: ./ content/ content/erp5admin/
nobody at svn.erp5.org
nobody at svn.erp5.org
Tue Aug 1 13:54:30 CEST 2006
Author: bartek
Date: Tue Aug 1 13:54:21 2006
New Revision: 8954
URL: http://svn.erp5.org?rev=8954&view=rev
Log:
Initial import
Added:
erp5/trunk/utils/CHANGELOG
erp5/trunk/utils/INSTALL
erp5/trunk/utils/Makefile
erp5/trunk/utils/README
erp5/trunk/utils/chrome.manifest
erp5/trunk/utils/content/
erp5/trunk/utils/content/erp5admin/
erp5/trunk/utils/content/erp5admin/contents.rdf
erp5/trunk/utils/content/erp5admin/erp5admin.js
erp5/trunk/utils/content/erp5admin/erp5admin.xul
erp5/trunk/utils/install.rdf
Added: erp5/trunk/utils/CHANGELOG
URL: http://svn.erp5.org/erp5/trunk/utils/CHANGELOG?rev=8954&view=auto
==============================================================================
--- erp5/trunk/utils/CHANGELOG (added)
+++ erp5/trunk/utils/CHANGELOG Tue Aug 1 13:54:21 2006
@@ -1,0 +1,23 @@
+2006-07-27
+Bugfix
+Some more object actions (reindex and local roles)
+2006-07-19
+Bugfix - show dict did not always worked properly
+2006-07-17
+Jump-by-highlight works now in framesets, in all form controls, and on plain page content - basically, everywhere :)
+Regexp matching allows for overselecting names
+2006-07-01
+A cool new feature - you can highlight a name in ZMI script edit textarea, right-click and jump straigh to editing the selected object (for now, it works only if you are in manage_main).
+Trapped failure in openning new tab (not very useful, since in most cases ERP5 does not send a proper notification to the browser).
+2006-06-24
+Added lots of new links, arranged in menus (among others: option to jump straigh to editing custom/test_py script, and an option to immediately run test_py in context of current object).
+2006-06-13
+Fixed a bug in Base_viewDict display
+2006-06-06
+Added an option to check portal_type of current object
+Added an option to open context tools in same or new tab
+Some tidying up of menus and code
+2006-06-01
+Fixed a bug which caused "Show toolbar" option in the menu to fall out of sync with toobar state.
+2006-05-30
+Added toolbar and a menu option to hide/show toolbar.
Added: erp5/trunk/utils/INSTALL
URL: http://svn.erp5.org/erp5/trunk/utils/INSTALL?rev=8954&view=auto
==============================================================================
--- erp5/trunk/utils/INSTALL (added)
+++ erp5/trunk/utils/INSTALL Tue Aug 1 13:54:21 2006
@@ -1,0 +1,5 @@
+Open the file erp5admin.xpi in Firefox (File->Open).
+Restart Firefox.
+Done.
+
+If you want to customize menu, edit /content/erp5admin/erp5admin.xul file to your liking; then run "make" and repeat the above procedure.
Added: erp5/trunk/utils/Makefile
URL: http://svn.erp5.org/erp5/trunk/utils/Makefile?rev=8954&view=auto
==============================================================================
--- erp5/trunk/utils/Makefile (added)
+++ erp5/trunk/utils/Makefile Tue Aug 1 13:54:21 2006
@@ -1,0 +1,6 @@
+
+all:
+ rm -f chrome/erp5admin.jar
+ rm -f erp5admin.xpi
+ zip chrome/erp5admin.jar content/erp5admin/*.rdf content/erp5admin/*.xul content/erp5admin/*.js
+ zip -r erp5admin.xpi chrome chrome.manifest install.rdf
Added: erp5/trunk/utils/README
URL: http://svn.erp5.org/erp5/trunk/utils/README?rev=8954&view=auto
==============================================================================
--- erp5/trunk/utils/README (added)
+++ erp5/trunk/utils/README Tue Aug 1 13:54:21 2006
@@ -1,0 +1,9 @@
+A small extension to Firefox - adds a submenu to the "Tools" menu with links to some of the management tools of ERP5 instance you are currently working on. Easily customiseable.
+
+Tested on Firefox 1.0.6 and 1.5.0.3 (Linux).
+
+Author: Bart³omiej Górny, RedPoint Consulting (bartek at redpoint.mn.pl).
+
+License: GPL
+
+Version: 0.21
Added: erp5/trunk/utils/chrome.manifest
URL: http://svn.erp5.org/erp5/trunk/utils/chrome.manifest?rev=8954&view=auto
==============================================================================
--- erp5/trunk/utils/chrome.manifest (added)
+++ erp5/trunk/utils/chrome.manifest Tue Aug 1 13:54:21 2006
@@ -1,0 +1,2 @@
+content erp5admin jar:chrome/erp5admin.jar!/content/erp5admin/
+overlay chrome://browser/content/browser.xul chrome://erp5admin/content/erp5admin.xul
Added: erp5/trunk/utils/content/erp5admin/contents.rdf
URL: http://svn.erp5.org/erp5/trunk/utils/content/erp5admin/contents.rdf?rev=8954&view=auto
==============================================================================
--- erp5/trunk/utils/content/erp5admin/contents.rdf (added)
+++ erp5/trunk/utils/content/erp5admin/contents.rdf Tue Aug 1 13:54:21 2006
@@ -1,0 +1,27 @@
+<?xml version="1.0"?>
+<RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:chrome="http://www.mozilla.org/rdf/chrome#">
+
+ <RDF:Seq about="urn:mozilla:package:root">
+ <RDF:li resource="urn:mozilla:package:erp5admin"/>
+ </RDF:Seq>
+
+ <RDF:Description about="urn:mozilla:package:erp5admin"
+ chrome:displayName="ERP5 Admin"
+ chrome:author="Bartek Górny"
+ chrome:authorURL="http://www.redpoint.mn.pl"
+ chrome:name="erp5admin"
+ chrome:extension="true"
+ chrome:description="A tool to ease life of erp5 admin/developer.">
+ </RDF:Description>
+
+<RDF:Seq about="urn:mozilla:overlays">
+<RDF:li resource="chrome://browser/content/browser.xul"/>
+</RDF:Seq>
+
+<RDF:Seq about="chrome://browser/content/browser.xul">
+<RDF:li>chrome://erp5admin/content/erp5admin.xul</RDF:li>
+</RDF:Seq>
+
+</RDF:RDF>
+
Added: erp5/trunk/utils/content/erp5admin/erp5admin.js
URL: http://svn.erp5.org/erp5/trunk/utils/content/erp5admin/erp5admin.js?rev=8954&view=auto
==============================================================================
--- erp5/trunk/utils/content/erp5admin/erp5admin.js (added)
+++ erp5/trunk/utils/content/erp5admin/erp5admin.js Tue Aug 1 13:54:21 2006
@@ -1,0 +1,223 @@
+
+function erp5admin_cutName(text){
+ res=text.match(/\.([A-Za-z0-9_]+)\(/);
+ if(res){
+ return res[1];
+ }
+ res=text.match(/'([A-Za-z0-9_]+)'/);
+ if(res){
+ return res[1];
+ }
+ res=text.match(/"([A-Za-z0-9_]+)"/);
+ if(res){
+ return res[1];
+ }
+ res=text.match(/([A-Z][A-Za-z0-9_]+)\s/);
+ if(res){
+ return res[1];
+ }
+ res=text.match(/([A-Z][A-Za-z0-9_]+)$/);
+ if(res){
+ return res[1];
+ }
+ // last resort - simple match
+ res=text.match(/([A-Z][A-Za-z0-9_]+)/);
+ if(res){
+ return res[1];
+ }
+ return null;
+}
+
+function erp5admin_findSelectionInControl(ctr){
+ if((ctr.type!='text' && ctr.type!='textarea')){
+ return;
+ }
+ if(ctr.value=="") return;
+ start=ctr.selectionStart;
+ end=ctr.selectionEnd;
+ if(start==end){
+ return;
+ }
+ text=ctr.value.substring(start,end);
+ return text;
+}
+
+function erp5admin_findSelectionInDocument(doc){
+ if(doc.forms.length>0){
+ a=doc.getElementsByName('body:text');
+ if(a.length==1){
+ text=erp5admin_findSelectionInControl(a[0]);
+ if(text!=null){
+ return text;
+ }
+ }else{
+ for(var j=0;j<doc.forms.length;j++){
+ els=doc.forms[j].elements;
+ for(var i=0;i<els.length;i++){
+ text=erp5admin_findSelectionInControl(els[i]);
+ if(text!=null){
+ return text;
+ }
+ }
+ }
+ }
+ }
+ // if no selection in the form, or no forms, we look at the document
+ return doc.getSelection()
+}
+
+function erp5admin_inspectFromString(newtab){
+ /* TODO
+ * make it usable in /manage frameset - done
+ * make it work in plain page - done
+ * make it work in all forms (like builder) - done
+ * search script name using regexp - allow for wide overselection - done
+ */
+ newtab=true;
+ if(window.content.frames.length==3){
+ fr=window.content.frames[2];
+ doc=fr.document;
+ }else{
+ doc=window.content.document;
+ }
+ text=erp5admin_findSelectionInDocument(doc);
+ name=erp5admin_cutName(text);
+ if(name==null){
+ alert('name not found in selection');
+ return;
+ }
+ erp5_goto(name,'manage_main',newtab,true);
+ return;
+}
+
+function erp5_goto(tool,tab,newtab,gotonewtab){
+ if(tab==undefined) tab='manage_main';
+ if(newtab==undefined) newtab=false;
+ if(gotonewtab==undefined) gotonewtab=false;
+ loc=window.content.document.location;
+ path=loc.pathname;
+ p=path.split('/');
+ newpath=p[1]+'/'+tool+'/'+tab;
+ newurl=loc.href.replace(path,'/'+newpath);
+ br=getBrowser();
+ if(newtab){
+ oldtab=br.selectedTab
+ try{
+ newt=br.addTab(newurl);
+ }catch(e){
+ alert('Can not open url: '+newurl);
+ try{
+ tabcont=br.mTabContainer;
+ tabs=tabcont.childNodes;
+ br.removeTab(tabs[tabs.length-1])
+ }catch(e){
+ alert(e);
+ }
+ return;
+ }
+ if(gotonewtab){
+ br.selectedTab=newt;
+ }else{
+ br.selectedTab=oldtab;
+ }
+ }else{
+ loc.pathname=newpath;
+ }
+ return;
+}
+
+function erp5admin_toggleToolbar(){
+ var toolbar = document.getElementById("erp5admin-toolbar");
+ toolbar.collapsed = !toolbar.collapsed;
+ document.persist("erp5admin-toolbar", "collapsed");
+}
+
+function erp5admin_updateShowToolbar(){
+ var toolbar = document.getElementById("erp5admin-toolbar");
+ var menuoption=document.getElementById('erp5admin-show-toolbar');
+ menuoption.setAttribute('checked',!toolbar.collapsed)
+ return;
+}
+
+
+function manage_func(loc,func){
+ /* we try to figure out where we are by looking for 'view' command
+ * or for a string beginning with a capital letter and ending either with ? or with end
+ * otherwise we assume the location to be an object's path
+ */
+ res=loc.search('/manage');
+ if(res==-1){
+ res=loc.search(/\/view$/);
+ }
+ if(res==-1){
+ res=loc.search(/\/view\?/);
+ }
+ if(res==-1){
+ res=loc.search(/\/[A-Z]\w+$/);
+ }
+ if(res==-1){
+ res=loc.search(/\/[A-Z]\w+\?/);
+ }
+ if(res==-1){
+ res=loc.length-1;
+ }
+ return loc.substring(0,res)+'/'+func;
+}
+
+function manage_form(loc){
+ /*
+ * here we can not take view - we need a form to manage */
+ // look for a patter ending the line
+ res=loc.search(/\/[A-Z]\w+\?/);
+ if(res>1){
+ res=loc.search(/\?/);
+ }
+ if(res<1){
+ res=loc.search(/\/[A-Z]\w+$/);
+ if(res>1){
+ res=loc.length;
+ }
+ }
+ if(res<1) return false;
+ return loc.substring(0,res)+'/manage_main';
+}
+
+function gotoManage(what,newtab) {
+ if(newtab==undefined) newtab=false;
+ try{
+ loc=window.content.document.location.href;
+ switch(what){
+ case 'object':
+ manage=manage_func(loc,'manage_main');
+ break;
+ case 'form':
+ manage=manage_form(loc);
+ break;
+ case 'dict':
+ manage=manage_func(loc,'Base_viewDict');
+ break;
+ case 'type':
+ manage=manage_func(loc,'getPortalType');
+ break;
+ case 'test':
+ manage=manage_func(loc,'test_py');
+ break;
+ default:
+ manage=manage_func(loc,what)
+ break;
+ }
+ if(manage){
+ if(newtab){
+ getBrowser().selectedTab=getBrowser().addTab(manage);
+ }else{
+ window.content.document.location.pathname=manage;
+ }
+ }else{
+ alert('could not figure out what to do');
+ }
+ }catch(err){
+ alert(err);
+ }
+ return;
+}
+
Added: erp5/trunk/utils/content/erp5admin/erp5admin.xul
URL: http://svn.erp5.org/erp5/trunk/utils/content/erp5admin/erp5admin.xul?rev=8954&view=auto
==============================================================================
--- erp5/trunk/utils/content/erp5admin/erp5admin.xul (added)
+++ erp5/trunk/utils/content/erp5admin/erp5admin.xul Tue Aug 1 13:54:21 2006
@@ -1,0 +1,102 @@
+<?xml version="1.0"?>
+
+<overlay id="erp5admin" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+
+ <script type="application/x-javascript" src="chrome://erp5admin/content/erp5admin.js"/>
+
+ <broadcasterset id="vBroadcasters">
+ <broadcaster id="erp5admin-view-toolbar-command" checked="true" oncommand="erp5admin_toggleToolbar()"/>
+ </broadcasterset>
+
+ <menupopup id="view_toolbars_popup">
+ <!-- to nie dziala - nie pokazuje sie w menu show toolbar-->
+ <menuitem label="ERP5 Admin" type="checkbox" oncommand="erp5admin_toggleToolbar();" checked="true"/>
+ </menupopup>
+
+ <menupopup id="menu_ToolsPopup">
+ <menu id="erp5adminmenu" label="ERP5 Admin" position="1">
+ <menupopup onpopupshowing="erp5admin_updateShowToolbar();">
+ <!-- arguments to gotoManage:
+ where to go - a set predefined in the gotoManage function (form, object, dict, type)
+ open in new tab?
+ -->
+ <menuitem label="manage form" oncommand="gotoManage('form',true);"/>
+ <menuitem label="manage object" oncommand="gotoManage('object',true);"/>
+ <menuitem label="view dict" oncommand="gotoManage('dict',true);"/>
+ <menuitem label="check portal type" oncommand="gotoManage('type',false);"/>
+ <menuseparator/>
+ <!-- arguments to erp5_goto:
+ tool (where to go)
+ tab to open (default is manage_main)
+ open in new tab?
+ go to new tab?
+ -->
+ <menuitem label="activities" oncommand="erp5_goto('portal_activities','manageActivities',true,true);"/>
+ <menuitem label="catalog" oncommand="erp5_goto('portal_catalog/erp5_mysql','manage_main',true,true);"/>
+ <menuitem label="classes" oncommand="erp5_goto('portal_classes','manage_main',true,true);"/>
+ <menuitem label="simulation" oncommand="erp5_goto('portal_simulation','manage_main',true,true);"/>
+ <menuitem label="skins" oncommand="erp5_goto('portal_skins','manage_main',true,true);"/>
+ <menuitem label="types" oncommand="erp5_goto('portal_types','manage_main',true,true);"/>
+ <menuitem label="workflow" oncommand="erp5_goto('portal_workflow','manage_main',true,true);"/>
+ <menuseparator/>
+ <menuitem id="erp5admin-show-toolbar" label="show toolbar" type="checkbox" oncommand="erp5admin_toggleToolbar();"/>
+ </menupopup>
+ </menu>
+ </menupopup>
+
+ <toolbox id="navigator-toolbox">
+ <toolbar id="erp5admin-toolbar" class="chromeclass-toolbar" collapsed="false" iconsize="small" mode="full" inherits="collapsed,hidden" hidden="false" persist="collapsed,hidden" >
+ <button label="form" id="manage-form-button" tooltiptext="Manage form" oncommand="gotoManage('form',true)"/>
+ <button label="dict" id="manage-dict-button" tooltiptext="" oncommand="gotoManage('dict',true)"/>
+ <button label="object" id="manage-object-button" tooltiptext="" oncommand="gotoManage('object',true)"/>
+ <menu id="toolbar_object" label="object" position="1">
+ <menupopup>
+ <menuitem label="form" id="manage-form-button" tooltiptext="Manage form" oncommand="gotoManage('form',true)"/>
+ <menuitem label="dict" id="manage-dict-item" tooltiptext="" oncommand="gotoManage('dict',true)"/>
+ <menuitem label="object" id="manage-object-item" tooltiptext="" oncommand="gotoManage('object',true)"/>
+ <menuitem label="type" id="manage-type-item" tooltiptext="" oncommand="gotoManage('type',false)"/>
+ <menuitem label="run test_py" id="manage-test-item" tooltiptext="" oncommand="gotoManage('test',false)"/>
+ <menuitem label="recursiveReindex" id="manage-reindex-item" tooltiptext="" oncommand="gotoManage('recursiveReindexObject',false)"/>
+ <menuitem label="local roles" id="manage-localroles-item" tooltiptext="" oncommand="gotoManage('manage_listLocalRoles',true)"/>
+ </menupopup>
+ </menu>
+ <menu id="toolbar_tools" label="tools">
+ <menupopup>
+ <menuitem label="activities" id="manage-activities-button" tooltiptext="" oncommand="erp5_goto('portal_activities','manageActivities',true,true);"/>
+ <menuitem label="deliveries" id="manage-deliveries-button" tooltiptext="" oncommand="erp5_goto('portal_deliveries','view',true,true);"/>
+ <menuitem label="rules" id="manage-rules-button" tooltiptext="" oncommand="erp5_goto('portal_rules','view',true,true);"/>
+ <menuitem label="simulation" id="manage-simulation-button" tooltiptext="" oncommand="erp5_goto('portal_simulation','manage_main',true,true);"/>
+ </menupopup>
+ </menu>
+ <menu id="toolbar_devel" label="devel">
+ <menupopup>
+ <menuitem label="catalog" id="manage-catalog-button" tooltiptext="" oncommand="erp5_goto('portal_catalog/erp5_mysql','manage_main',true,true);"/>
+ <menuitem label="classes" id="manage-classes-button" tooltiptext="" oncommand="erp5_goto('portal_classes','manage_main',true,true);"/>
+ <menuitem label="types" id="manage-types-button" tooltiptext="" oncommand="erp5_goto('portal_types','manage_main',true,true);"/>
+ <menuitem label="workflow" id="manage-workflow-button" tooltiptext="" oncommand="erp5_goto('portal_workflow','manage_main',true,true);"/>
+ </menupopup>
+ </menu>
+ <menu id="toolbar_skins" label="skins">
+ <menupopup>
+ <menuitem label="skins" id="manage-skins-button" tooltiptext="" oncommand="erp5_goto('portal_skins','manage_main',true,true);"/>
+ <menuitem label="custom" id="manage-skins-button" tooltiptext="" oncommand="erp5_goto('portal_skins/custom','manage_main',true,true);"/>
+ <menuitem label="test_py" id="manage-skins-button" tooltiptext="" oncommand="erp5_goto('portal_skins/custom/test_py','manage_main',true,true);"/>
+ </menupopup>
+ </menu>
+ </toolbar>
+ </toolbox>
+
+
+ <popup id="contentAreaContextMenu">
+ <menuseparator id="erp5admin-context-separator"/>
+ <menuitem label="Inspect selected" id= "erp5admin-inspect" oncommand="erp5admin_inspectFromString()"/>
+ </popup>
+
+
+<!--<menu label="&webdeveloper.name;" accesskey="&webdeveloper.context.key;" id="webdeveloper-context">
+<menupopup>
+<menu label="&webdeveloper.disable.label;" accesskey="&webdeveloper.disable.key;">
+ <menupopup onpopupshowing="webdeveloper_updateDisableMenu('context')">-->
+
+</overlay>
+
Added: erp5/trunk/utils/install.rdf
URL: http://svn.erp5.org/erp5/trunk/utils/install.rdf?rev=8954&view=auto
==============================================================================
--- erp5/trunk/utils/install.rdf (added)
+++ erp5/trunk/utils/install.rdf Tue Aug 1 13:54:21 2006
@@ -1,0 +1,28 @@
+<?xml version="1.0"?>
+
+<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:em="http://www.mozilla.org/2004/em-rdf#">
+
+ <Description about="urn:mozilla:install-manifest">
+
+ <em:name>ERP5 Admin</em:name>
+ <em:id>{12a1584b-2123-473d-8752-e82e74e3cb1b}</em:id>
+ <em:version>1.0rc2</em:version>
+
+ <em:targetApplication>
+ <Description>
+ <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
+ <em:minVersion>0.9</em:minVersion>
+ <em:maxVersion>1.6</em:maxVersion>
+ </Description>
+ </em:targetApplication>
+
+ <em:file>
+ <Description about="urn:mozilla:extension:file:erp5admin.jar">
+ <em:package>content/erp5admin/</em:package>
+ </Description>
+ </em:file>
+
+ </Description>
+
+ </RDF>
More information about the Erp5-report
mailing list