Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Fix JENKINS-18203
Implement support for managed files as templates.
- Loading branch information
Showing
6 changed files
with
165 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
src/main/java/hudson/plugins/emailext/JellyTemplateConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package hudson.plugins.emailext; | ||
|
||
import hudson.Extension; | ||
import org.jenkinsci.lib.configprovider.AbstractConfigProviderImpl; | ||
import org.jenkinsci.lib.configprovider.model.Config; | ||
import org.jenkinsci.lib.configprovider.model.ContentType; | ||
import org.kohsuke.stapler.DataBoundConstructor; | ||
|
||
|
||
public class JellyTemplateConfig extends Config { | ||
|
||
@DataBoundConstructor | ||
public JellyTemplateConfig(String id, String name, String comment, String content) { | ||
super(id, name, comment, content); | ||
} | ||
|
||
@Extension | ||
public static final class JellyTemplateConfigProvider extends AbstractConfigProviderImpl { | ||
|
||
public JellyTemplateConfigProvider() { | ||
//load(); | ||
} | ||
|
||
@Override | ||
public ContentType getContentType() { | ||
return ContentType.DefinedType.XML; | ||
} | ||
|
||
@Override | ||
public String getDisplayName() { | ||
return "Extended Email Publisher Jelly Template "; | ||
} | ||
|
||
@Override | ||
public Config newConfig() { | ||
String id = getProviderId() + System.currentTimeMillis(); | ||
return new JellyTemplateConfig(id, "Jelly Email Template", "", ""); | ||
} | ||
|
||
@Override | ||
protected String getXmlFileName() { | ||
return "email-ext-jelly-config-files.xml"; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
.../plugins/emailext/JellyTemplateConfig/JellyTemplateConfigProvider/newInstanceDetail.jelly
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<!-- | ||
The MIT License | ||
Copyright (c) 2013, Alex Earl | ||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. | ||
--> | ||
|
||
|
||
|
||
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form"> | ||
${%jelly_template_description} | ||
</j:jelly> |
1 change: 1 addition & 0 deletions
1
...ins/emailext/JellyTemplateConfig/JellyTemplateConfigProvider/newInstanceDetail.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
jelly_template_description=A Jelly template used by the Extended Email Publisher plugin to generate emails. |
41 changes: 41 additions & 0 deletions
41
src/main/resources/hudson/plugins/emailext/JellyTemplateConfig/edit-config.jelly
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<!-- | ||
The MIT License | ||
Copyright (c) 2013, Alex Earl | ||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. | ||
--> | ||
|
||
|
||
|
||
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" | ||
xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form"> | ||
<f:entry title="${%ID}" > | ||
<f:textbox readonly="readonly" name="config.id" value="${config.id}" /> | ||
</f:entry> | ||
<f:entry title="${%Name}"> | ||
<f:textbox name="config.name" value="${config.name}" /> | ||
</f:entry> | ||
<f:entry title="${%Comment}"> | ||
<f:textbox name="config.comment" value="${config.comment}" /> | ||
</f:entry> | ||
<f:entry title="${%Content}"> | ||
<f:textarea id="config.content" name="config.content" value="${config.content}" /> | ||
</f:entry> | ||
</j:jelly> |