| 13 | | <please extend or rework if you have some ideas and time> |
| | 13 | == Preferences addition or replacement commands == |
| | 14 | |
| | 15 | Following code adds one more imagery to the list: |
| | 16 | {{{#!xml |
| | 17 | <config> |
| | 18 | <preferences operation="append"> |
| | 19 | <!-- Any preferences.xml fragment can be used here --> |
| | 20 | <tag key="download.autorun" value="true"/> <!-- example of simple preference modification - download.autorun := true --> |
| | 21 | <maps key="imagery.entries"> |
| | 22 | <map> |
| | 23 | <tag key="name" value="ScanEx IRS"/> |
| | 24 | <tag key="type" value="scanex"/> |
| | 25 | <tag key="url" value="IRS"/> |
| | 26 | <tag key="attribution-text" value="IRS"/> |
| | 27 | <tag key="attribution-url" value="http://irs.gis-lab.info/"/> |
| | 28 | </map> |
| | 29 | </maps> |
| | 30 | </preferences> |
| | 31 | </config> |
| | 32 | }}} |
| | 33 | |
| | 34 | If '''<preferences operation="replace">''' will be used instead, all other <map> elements will be __deleted__ from '''imagery.entries''' ! |
| | 35 | |
| | 36 | Another example: |
| | 37 | {{{#!xml |
| | 38 | <config> |
| | 39 | <preferences operation="replace"> <!-- old content of draw.anglesnap.angles will be deleted --> |
| | 40 | <list key="draw.anglesnap.angles"> |
| | 41 | <entry value="30"/> |
| | 42 | <entry value="45"/> |
| | 43 | <entry value="60"/> |
| | 44 | </list> |
| | 45 | </preferences> |
| | 46 | </config> |
| | 47 | }}} |
| | 48 | |
| | 49 | === File oprations - downloading, deleting, unzipping === |
| | 50 | {{{#!xml |
| | 51 | <config> |
| | 52 | <delete path="plugins/tmp"/> |
| | 53 | <!-- delete recursively plugins/tmp from preferences directory --> |
| | 54 | <!-- base = "prefs" - delete from preferences folder base = "plugins" - delete from plugins folder base = "cache" - delete from cache folder --> |
| | 55 | |
| | 56 | <delete path="splug" base="plugins"/> |
| | 57 | <!-- delete recursively splug folder from preferences directory --> |
| | 58 | |
| | 59 | <!--<delete path="." base="cache"/> delete cache folder --> |
| | 60 | |
| | 61 | <download url="http://svn.openstreetmap.org/applications/editors/josm/dist/buildings_tools.jar" path="plugins/tmp/bt.jar" mkdir="true" unzip="true"/> |
| | 62 | <!-- download file from url and place as "path" if mkdir="true", then all necessary directories will be created if unzip="true", then zip/jar file will be exanded and then deleted --> |
| | 63 | |
| | 64 | <download url="http://wiki.openstreetmap.org/w/images/7/79/Public-images-osm_logo.svg" path="1/logo.svg" mkdir="true" base="cache"/> |
| | 65 | |
| | 66 | <download url="file://localhost/e:/a.zip" path="qqq/a.zip" unzip="true" mkdir="true"/> |
| | 67 | <!-- copy from local folder and unzip --> |
| | 68 | </config> |
| | 69 | }}} |