Skip to content

Commit 079bb49

Browse files
author
Nathan McMinn
committed
Additional code to support dependent selects
More code to support the concept of a dependent value select box.
1 parent 7203109 commit 079bb49

File tree

3 files changed

+92
-4
lines changed

3 files changed

+92
-4
lines changed

pdf-toolkit-share/src/main/amp/config/alfresco/web-extension/site-webscripts/org/alfresco/pdftoolkit/components/form/controls/dependentSelect.ftl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
<#include "/org/alfresco/components/form/controls/common/utils.inc.ftl" />
22

3+
<#if field.control.params.showSelectValues??>
4+
<#assign selectValues = field.control.params.showSelectValues?split(",")>
5+
</#if>
6+
37
<#if field.control.params.optionSeparator??>
48
<#assign optionSeparator=field.control.params.optionSeparator>
59
<#else>

pdf-toolkit-share/src/main/resources/META-INF/pdftoolkit/components/doclib/pdftoolkit-doclib-actions.js

Lines changed: 76 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ PDFToolkit.Util = {};
4444
options:
4545
{
4646
/**
47-
* Reference to the signed document
47+
* Reference to the pdf document
4848
*
4949
* @property nodeRef
5050
* @type string
@@ -159,6 +159,81 @@ PDFToolkit.Util = {};
159159
});
160160
})();
161161

162+
(function()
163+
{
164+
/**
165+
* YUI Library aliases
166+
*/
167+
var Dom = YAHOO.util.Dom,
168+
Event = YAHOO.util.Event,
169+
Selector = YAHOO.util.Selector;
170+
171+
/**
172+
* SelectPage constructor.
173+
*
174+
* @param {String} htmlId The HTML id of the parent element
175+
* @return {PDFToolkit.SelectPage} The new component instance
176+
* @constructor
177+
*/
178+
PDFToolkit.DependentSelect = function DependentSelect_constructor(htmlId)
179+
{
180+
PDFToolkit.DependentSelect.superclass.constructor.call(this, "PDFToolkit.DependentSelect", htmlId, []);
181+
return this;
182+
};
183+
184+
YAHOO.extend(PDFToolkit.DependentSelect, Alfresco.component.Base,
185+
{
186+
/**
187+
* Object container for initialization options
188+
*
189+
* @property options
190+
* @type {object} object literal
191+
*/
192+
options:
193+
{
194+
/**
195+
* Reference to the pdf document
196+
*
197+
* @property nodeRef
198+
* @type string
199+
*/
200+
nodeRef: null
201+
},
202+
203+
schemesModule: null,
204+
pagesModule: null,
205+
pageCount: -1,
206+
207+
onReady: function DependentSelect_onReady()
208+
{
209+
this.getPageCount(this.options.nodeRef);
210+
this.getPageSchemes(this.options.nodeRef);
211+
212+
this.schemesModule = new YAHOO.widget.Module(this.id + "-schemeModule");
213+
this.pagesModule = new YAHOO.widget.Module(this.id + "-pageModule");
214+
215+
// default state is schemes enabled, page select hidden
216+
this.pagesModule.hide();
217+
218+
YAHOO.util.Event.addListener([this.id + "-useScheme"], "click", this.toggleSchemes, this);
219+
},
220+
221+
toggleDependentFields: function DependentSelect_toggleSchemes(event, that)
222+
{
223+
if(event.target.checked)
224+
{
225+
that.schemesModule.show();
226+
that.pagesModule.hide();
227+
}
228+
else
229+
{
230+
that.schemesModule.hide();
231+
that.pagesModule.show();
232+
}
233+
}
234+
});
235+
})();
236+
162237
(function()
163238
{
164239
PDFToolkit.Util.HideDependentControls = function(element, htmlIdPrefix)

pdf-toolkit-share/src/main/resources/META-INF/share-config-custom.xml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -395,8 +395,8 @@
395395
</field>
396396
<field id="position">
397397
<control template="/org/alfresco/pdftoolkit/components/form/controls/dependentSelect.ftl">
398-
<control-param name="showSelectValue">manual</control-param>
399-
<control-param name="showWhenSelected">location-x,location-y</control-param>
398+
<control-param name="showSelectValues">manual</control-param>
399+
<control-param name="showWhenSelected-manual">location-x,location-y</control-param>
400400
</control>
401401
</field>
402402
</appearance>
@@ -433,7 +433,16 @@
433433
</control>
434434
</field>
435435
<field id="position">
436-
<control template="/org/alfresco/pdftoolkit/components/form/controls/pagePosition.ftl">
436+
<control template="/org/alfresco/pdftoolkit/components/form/controls/dependentSelect.ftl">
437+
<control-param name="showSelectValues">manual</control-param>
438+
<control-param name="showWhenSelected-manual">location-x,location-y</control-param>
439+
</control>
440+
</field>
441+
<field id="watermark-type">
442+
<control template="/org/alfresco/pdftoolkit/components/form/controls/dependentSelect.ftl">
443+
<control-param name="showSelectValues">text,image</control-param>
444+
<control-param name="showWhenSelected-text">watermark-text,watermark-font,watermark-size</control-param>
445+
<control-param name="showWhenSelected-image">watermark-image</control-param>
437446
</control>
438447
</field>
439448
</appearance>

0 commit comments

Comments
 (0)