Skip to content

Commit

Permalink
Gadgets Initial import as macros
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.xwiki.org/svnroot/xwiki/contrib/sandbox@26981 f329d543-caf0-0310-9063-dda96c69346f
  • Loading branch information
amangobanana committed Feb 12, 2010
1 parent 83ce6ed commit c0bafaf
Show file tree
Hide file tree
Showing 5 changed files with 524 additions and 0 deletions.
37 changes: 37 additions & 0 deletions gadgets/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?>

<!--
*
* See the NOTICE file distributed with this work for additional
* information regarding copyright ownership.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*
-->

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.xwiki.platform.applications</groupId>
<artifactId>xwiki-applications</artifactId>
<version>27-SNAPSHOT</version>
</parent>
<artifactId>xwiki-application-gadgets</artifactId>
<name>XWiki Platform - Applications - Gadgets</name>
<version>1.0-SNAPSHOT</version>
<packaging>xar</packaging>
<description>Gadgets application for XWiki</description>
</project>
182 changes: 182 additions & 0 deletions gadgets/src/main/resources/Macros/GoogleGadgetsImport.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,182 @@
<?xml version="1.0" encoding="UTF-8"?>

<xwikidoc>
<web>Macros</web>
<name>GoogleGadgetsImport</name>
<language></language>
<defaultLanguage>en</defaultLanguage>
<translation>0</translation>
<parent></parent>
<creator>XWiki.Admin</creator>
<author>XWiki.Admin</author>
<customClass></customClass>
<contentAuthor>XWiki.Admin</contentAuthor>
<creationDate>1265967794000</creationDate>
<date>1265971470000</date>
<contentUpdateDate>1265971470000</contentUpdateDate>
<version>22.1</version>
<title></title>
<template></template>
<defaultTemplate></defaultTemplate>
<validationScript></validationScript>
<comment></comment>
<minorEdit>false</minorEdit>
<syntaxId>xwiki/2.0</syntaxId>
<hidden>false</hidden>
<object>
<class>
<name>XWiki.JavaScriptExtension</name>
<customClass></customClass>
<customMapping></customMapping>
<defaultViewSheet></defaultViewSheet>
<defaultEditSheet></defaultEditSheet>
<defaultWeb></defaultWeb>
<nameField></nameField>
<validationScript></validationScript>
<cache>
<cache>0</cache>
<displayType>select</displayType>
<multiSelect>0</multiSelect>
<name>cache</name>
<number>5</number>
<prettyName>Caching policy</prettyName>
<relationalStorage>0</relationalStorage>
<separator> </separator>
<separators> ,|</separators>
<size>1</size>
<unmodifiable>0</unmodifiable>
<values>long|short|default|forbid</values>
<classType>com.xpn.xwiki.objects.classes.StaticListClass</classType>
</cache>
<code>
<name>code</name>
<number>2</number>
<prettyName>Code</prettyName>
<rows>20</rows>
<size>50</size>
<unmodifiable>0</unmodifiable>
<classType>com.xpn.xwiki.objects.classes.TextAreaClass</classType>
</code>
<name>
<name>name</name>
<number>1</number>
<prettyName>Name</prettyName>
<size>30</size>
<unmodifiable>0</unmodifiable>
<classType>com.xpn.xwiki.objects.classes.StringClass</classType>
</name>
<parse>
<displayFormType>select</displayFormType>
<displayType>yesno</displayType>
<name>parse</name>
<number>4</number>
<prettyName>Parse content</prettyName>
<unmodifiable>0</unmodifiable>
<classType>com.xpn.xwiki.objects.classes.BooleanClass</classType>
</parse>
<use>
<cache>0</cache>
<displayType>select</displayType>
<multiSelect>0</multiSelect>
<name>use</name>
<number>3</number>
<prettyName>Use this extension</prettyName>
<relationalStorage>0</relationalStorage>
<separator> </separator>
<separators> ,|</separators>
<size>1</size>
<unmodifiable>0</unmodifiable>
<values>currentPage=Always on this page|onDemand=On demand|always=Always on this wiki</values>
<classType>com.xpn.xwiki.objects.classes.StaticListClass</classType>
</use>
</class>
<name>Macros.GoogleGadgetsImport</name>
<number>0</number>
<className>XWiki.JavaScriptExtension</className>
<guid>45f0a672-ed7a-4d38-b5ff-9a8002f83054</guid>
<property>
<cache></cache>
</property>
<property>
<code>document.observe('dom:loaded', function() {

if($$('input[name=import_google_gadget]')) {
Event.observe($$('input[name=import_google_gadget]')[0], 'click', function(event) {
var gId = $('import_macroIdInput').value;
var gName = $('import_macroNameInput').value;
var gUrl = $('import_macroUrlInput').value;

var url = "$xwiki.getURL('MacrosCode.GoogleGadgetsImport')" + "?id=" + encodeURIComponent(gId) + "&amp;name=" + encodeURIComponent(gName) + "&amp;url=" + encodeURIComponent(gUrl);

window.location = url;
});
}
});</code>
</property>
<property>
<name></name>
</property>
<property>
<parse>1</parse>
</property>
<property>
<use>onDemand</use>
</property>
</object>
<object>
<class>
<name>XWiki.TagClass</name>
<customClass></customClass>
<customMapping></customMapping>
<defaultViewSheet></defaultViewSheet>
<defaultEditSheet></defaultEditSheet>
<defaultWeb></defaultWeb>
<nameField></nameField>
<validationScript></validationScript>
<tags>
<cache>0</cache>
<displayType>input</displayType>
<multiSelect>1</multiSelect>
<name>tags</name>
<number>1</number>
<prettyName>Tags</prettyName>
<relationalStorage>1</relationalStorage>
<separator> </separator>
<separators> ,|</separators>
<size>30</size>
<unmodifiable>0</unmodifiable>
<values></values>
<classType>com.xpn.xwiki.objects.classes.StaticListClass</classType>
</tags>
</class>
<name>Macros.GoogleGadgetsImport</name>
<number>0</number>
<className>XWiki.TagClass</className>
<guid>ef9e037b-0168-4c99-81d6-5ddf8d0506ab</guid>
<property>
<tags/>
</property>
</object>
<content>= Import Google Gadget =

{{velocity}}
$xwiki.jsx.use('Macros.GoogleGadgetsImport')
{{html}}
&lt;div&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;label for="id"&gt;Macro id:&lt;/label&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;input type="text" size="30" value="" name="id" id="import_macroIdInput"&gt;&lt;/dd&gt;

&lt;dt&gt;&lt;label for="name"&gt;Macro name:&lt;/label&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;input type="text" size="30" value="" name="name" id="import_macroNameInput"&gt;&lt;/dd&gt;

&lt;dt&gt;&lt;label for="url"&gt;Gadget URL:&lt;/label&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;input type="text" size="30" value="" name="url" id="import_macroUrlInput"&gt;&lt;/dd&gt;
&lt;/dl&gt;
&lt;span class="buttonwrapper"&gt;
&lt;input type="button" value="Import Google Gadget" name="import_google_gadget" class="button" /&gt;
&lt;/span&gt;
&lt;/div&gt;
{{/html}}
{{/velocity}}
</content></xwikidoc>
80 changes: 80 additions & 0 deletions gadgets/src/main/resources/Macros/WebHome.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
<?xml version="1.0" encoding="UTF-8"?>

<xwikidoc>
<web>Macros</web>
<name>WebHome</name>
<language></language>
<defaultLanguage>en</defaultLanguage>
<translation>0</translation>
<parent></parent>
<creator>XWiki.Admin</creator>
<author>XWiki.Admin</author>
<customClass></customClass>
<contentAuthor>XWiki.Admin</contentAuthor>
<creationDate>1265888160000</creationDate>
<date>1265967955000</date>
<contentUpdateDate>1265967955000</contentUpdateDate>
<version>16.1</version>
<title></title>
<template></template>
<defaultTemplate></defaultTemplate>
<validationScript></validationScript>
<comment></comment>
<minorEdit>false</minorEdit>
<syntaxId>xwiki/2.0</syntaxId>
<hidden>false</hidden>
<object>
<class>
<name>XWiki.TagClass</name>
<customClass></customClass>
<customMapping></customMapping>
<defaultViewSheet></defaultViewSheet>
<defaultEditSheet></defaultEditSheet>
<defaultWeb></defaultWeb>
<nameField></nameField>
<validationScript></validationScript>
<tags>
<cache>0</cache>
<displayType>input</displayType>
<multiSelect>1</multiSelect>
<name>tags</name>
<number>1</number>
<prettyName>Tags</prettyName>
<relationalStorage>1</relationalStorage>
<separator> </separator>
<separators> ,|</separators>
<size>30</size>
<unmodifiable>0</unmodifiable>
<values></values>
<classType>com.xpn.xwiki.objects.classes.StaticListClass</classType>
</tags>
</class>
<name>Macros.WebHome</name>
<number>0</number>
<className>XWiki.TagClass</className>
<guid>b155eb3b-2205-487a-8f11-098ee920ce1d</guid>
<property>
<tags/>
</property>
</object>
<content>{{velocity}}
= Macro Directory =

[[Import Google Gadget&gt;&gt;Macros.GoogleGadgetsImport]]

#set($macroDescrs = $macros.macroDescriptors)
#foreach($m in $macroDescrs)
#set($hql = "select doc.fullName from XWikiDocument doc, BaseObject obj, StringProperty prop where doc.fullName=obj.name and obj.className='XWiki.WikiMacroClass' and prop.id.id=obj.id and prop.name='id' and prop.value='${m.id}'")
#set($results = $xwiki.search($hql))

#if($results.size() &gt; 0)
#set($macroDoc = $results.get(0))
**[[${m.name}&gt;&gt;${macroDoc}]]**
#else
**$m.name**
#end
$m.description
//Default Category: $!{m.defaultCategory}//
#end
{{/velocity}}
</content></xwikidoc>
Loading

0 comments on commit c0bafaf

Please sign in to comment.