Skip to content

Commit

Permalink
Item9428: create WikiDrawPlugin
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.foswiki.org/trunk/WikiDrawPlugin@9700 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
SvenDowideit authored and SvenDowideit committed Oct 24, 2010
0 parents commit cd1cd21
Show file tree
Hide file tree
Showing 228 changed files with 43,100 additions and 0 deletions.
18 changes: 18 additions & 0 deletions data/System/VarWIKIDRAW.txt
@@ -0,0 +1,18 @@
%META:TOPICINFO{author="ProjectContributor" date="1231502400" format="1.1" version="$Rev$"}%
%META:TOPICPARENT{name="Macros"}%
#VarENCODE
---+++ WIKIDRAW{"drawing"} -- displays a vector drawing that can be edited in the wiki
* Encode character sequences in ="string"=, by mapping characters (or sequences of characters) to an alternative character (or sequence of characters). This macro can be used to encode strings for use in URLs, to encode to HTML entities, to protect quotes, and for as many other uses as you can imagine.
* Syntax: =%<nop>WIKIDRAW{"string" annotate="image"}%=
| *Parameter* | *Description* | *Default* |
| ="drawing"= | name of the drawing - specifies the location to save to - can be either ="Web.SomeTopic"= or ="drawing"= or (BROKEN "Web.Topic/drawing") \
%BR% where the first form saves the svg to the topic text, and the other saves to an attachment in the current topic, the third an attachment in the specified topic \
%BR% If you specify a drawing file that does not yet exist in your Wiki, the drawing is created the first time you save a drawing. | _must be set_ |
| =annotation="imagename"= | specifies an image that will be used as a background for your annotations \
="Web.SomeTopic"= (picks the first attached image) or ="image.png"= (current topic) or ="Web.Topic/image.jpg"= (an attachemt to the specified topic) \
%BR% it will not be modified, and will not form part of the svg output. | "" |

If you omit either parameter, the Plugin attempts to do the right thing, but for now, this is experimental.


%IF{"'%INCLUDINGTOPIC%'='WikiDrawPlugin'" else=" * Related: %SYSTEMWEB%.WikiDrawPlugin"}%
690 changes: 690 additions & 0 deletions data/System/WikiDrawEditTemplate.txt

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions data/System/WikiDrawForm.txt
@@ -0,0 +1,10 @@
%META:TOPICINFO{author="ProjectContributor" date="1267133207" format="1.1" version="$Rev$"}%

---+ Wiki Draw annotation

---++ Data form for %SYSTEMWEB%.WikiDrawPlugin

|*Name* |*Type* |*Size* |*Values* |*Tooltip message* |*Attributes* |
| <nop>Annotate | text | 40 | | | |
| <nop>CallingTopic | text | 40 | | | |
| <nop>SvgEditorVersion | text | 40 | | | |
86 changes: 86 additions & 0 deletions data/System/WikiDrawPlugin.txt
@@ -0,0 +1,86 @@
%META:TOPICINFO{author="BaseUserMapping_333" date="1287891802" format="1.1" version="2"}%
---+!! !WikiDrawPlugin
<img class="foswikiRight" src="%ATTACHURLPATH%/WikiDrawExample.png" alt="Create Drawings, or add notes to Images" width='340' height='349' />

<!--
One line description, required for extensions repository catalog.
BuildContrib will fill in the SHORTDESCRIPTION with the value of
$SHORTDESCRIPTION from the .pm module, or you can redefine it here if you
prefer.
* Set SHORTDESCRIPTION = %$SHORTDESCRIPTION%
-->
%SHORTDESCRIPTION%



%TOC%

---++ Usage

!WikiDrawPlugin uses [[http://code.google.com/p/svg-edit/][SVG-edit]] (trunk svn from 29/09/2010 - pre2.6) to provide quick and easy drawing or annotation of images.

__WARNING: editing not compatible with InternetExplorer - but viewing of the drawings works correctly__

---+++ Syntax Rules
%INCLUDE{%SYSTEMWEB%.VarWIKIDRAW}%
---++++ save drawing as attachment to current topic
<verbatim>
%WIKIDRAW{
"drawing"
annotate="http://somewhere.onthenet.com/some_image.png"
}%
</verbatim>

---++++ save drawing to a 'WikiDrawForm' topic
!WikiDraw also can save the svg source for the drawing as the text of a topic - allowing searching and hand editing of that source, while continuing to provide the wysiwyg editing facility.
<verbatim>
%WIKIDRAW{
"Sandbox.WikiDrawing"
annotate="Sandbox.SomeImage/some_image.png"
}%
</verbatim>

---+++ Extra Plugin support.
If Foswiki:Extensions.ImagePlugin is installed and enabled, the default skin template will automatically use it to lay out the image and drawing.

---++ Technical details
This plugin adds a ext-foswiki.js extension that over-rides the built in 'Save Image' SVG menu item with a save to foswiki handler,
which generates a png version of the overlay, and sends that, and the svg source to foswiki.

The transparent overlay png is displayed in view mode, and the annotated image (if any) will be put behind it using the css background.

---++ Known issues:
1 it really doesn't like using svg dimensions other than 640x480 (I'e reported an [[http://code.google.com/p/svg-edit/issues/detail?id=727][issue] for this, as its really painful when creating a drawing)
6 hide the edit buttons for ie..
1 _DEFAULT="Web.Topic/something" is very broken
6 =strikeone= support
7 comment support..
8 wow. subtle bug. - using =%!WIKIDRAW{Sandbox.SomeTopic}%=, _will_ find the first image attached to BASETOPIC, which might be a tad surprising.
---+++ features to be added?
5 can we diff the svg's ?


---++ Installation Instructions

%$INSTALL_INSTRUCTIONS%

---++ Info

Many thanks to the following sponsors for supporting this work:
* TRIN, The Taxonomic Information Network for Australian National Biodiversity Research

| Author(s): | Foswiki:Main.SvenDowideit |
| Copyright: | &copy; 2010 SvenDowideit@fosiki.com and SVG-edit contributors and David Belais (pngIE) |
| License: | [[http://www.gnu.org/licenses/gpl.html][GPL (Gnu General Public License)]] and Apache License 2.0 for SVG-edit |
| Release: | %$RELEASE% |
| Version: | %$VERSION% |
| Change History: | <!-- versions below in reverse order -->&nbsp; |
| 21 October 2010: | initial public release |
| Dependencies: | %$DEPENDENCIES% |
| Home page: | http://foswiki.org/bin/view/Extensions/WikiDrawPlugin |
| Support: | http://foswiki.org/bin/view/Support/WikiDrawPlugin |

<!-- Do _not_ attempt to edit this topic; it is auto-generated. -->


%META:FILEATTACHMENT{name="WikiDrawExample.png" attachment="WikiDrawExample.png" attr="h" comment="Create Drawings, or add notes to Images" date="1287891802" path="WikiDrawExample.png" size="175453" user="BaseUserMapping_333" version="1"}%
17 changes: 17 additions & 0 deletions data/System/WikiDrawViewTemplate.txt
@@ -0,0 +1,17 @@
%META:TOPICINFO{author="ProjectContributor" date="1231502400" format="1.1" version="1.1"}%
%TMPL:INCLUDE{"view"}%

%TMPL:DEF{"content"}%<div class="foswikiTopicText">
---++ Image Annotation %QUERY{CallingTopic}%
This is %QUERY{CallingTopic}%'s annotation of the image =%QUERY{Annotate}%=
%WIKIDRAW{
"%WEB%.%TOPIC%"
annotate="%QUERY{Annotate}%"
}%
#TopicEnd
</div>%TMPL:END%

%TMPL:DEF{"attachments"}%%TMPL:END%
%TMPL:DEF{"form"}%%TMPL:END%

%META:PREFERENCE{name="VIEW_TEMPLATE" title="VIEW_TEMPLATE" type="Set" value="SkinTemplateView"}%

0 comments on commit cd1cd21

Please sign in to comment.