[Cartoweb-users] PDF export with custom fields
Dirk Jesko
ml.dje at geocontent.de
Thu May 10 09:31:23 EDT 2007
Hello,
hmm. I can't get it to work. Below I copied an excerpt from
exportPdf.ini and the corresponding part from the template. Now, the
initial content defined in the ini file for the blocks "title" and
"note" are displayed in the corresponding form fields, but the fields
for "noteA" and "noteB" are empty. Further, any text typed into the
input fields for "title" or "note" appears on the generated pdf, but the
text typed into the fields "pdfNoteA" and "pdfNoteB" is ignored.
Instead, the generated blocks for noteA and noteB contain the strings
defined in the ini file. If I add {if $pdfNoteA}{/if} resp. {if
$pdfNoteB}{/if} around the corresponding parts of the template, the
input fields aren't displayed at all.
Although, I did some debugging of the ClientExportPdf class, I could not
find out, why the blocks are not handled correctly. My best guess would
be the fact that the two additional fields ('noteA' and 'noteB') are not
added to the $optionalInputs field. The drawUserForm() function on the
other hand only assigns fields that are defined in $optionalInputs to
smarty-variables. Maybe, other functions depend on it too.
Regards,
Dirk
exportPdf.ini:
general.activatedBlocks = ... , title, note, noteA, noteB, ...
blocks.title.type = text
blocks.title.content = "Titel"
blocks.title.parent = info_title
...
blocks.note.type = text
blocks.note.content = "Notiz"
blocks.note.parent = info_title
...
blocks.noteA.type = text
blocks.noteA.content = "Notiz 1"
blocks.noteA.parent = info_title
...
blocks.noteB.type = text
blocks.noteB.content = "Notiz 2"
blocks.noteB.parent = info_title
...
form.tpl:
{if $pdfTitle}
<tr>
<td>{t}Titel:{/t}</td>
<td><input type="text" id="pdfTitle" name="pdfTitle"
value="{$pdfTitle_value}"/></td>
</tr>
{/if}
{if $pdfNote}
<tr>
<td>{t}Notiz:{/t}</td>
<td><input type="text" id="pdfNote" name="pdfNote"
value="{$pdfNote_value}"/></td>
</tr>
{/if}
<tr>
<td>{t}Notiz:{/t}</td>
<td><input type="text" id="pdfNoteA" name="pdfNoteA"
value="{$pdfNoteA_value}"/></td>
</tr>
<tr>
<td></td>
<td><input type="text" id="pdfNoteB" name="pdfNoteB"
value="{$pdfNoteB_value}"/></td>
</tr>
Alexandre Saunier wrote:
> Hello,
>
> add the new inputs into the HTML template just as it's done for
> pdfTitle and pdfNote (see exportPdf/templates/form.tpl).
> The naming convention for the new form inputs is:
> - capitalize the first letter of the field name
> - add the prefix "pdf" in front of it
> For instance:
> title => pdfTitle
> note => pdfNote
> foobar => pdfFoobar
>
> Alexandre
>
> Dirk Jesko wrote:
>> Hello,
>>
>> in addition to the title and note, I would like to add three fields
>> to an exported pdf. The user shall be able to type in the text that
>> shall appear via the GUI. I managed to add the fields to the pdf by
>> adding them to the general.activatedBlocks in exportPdf.ini. But how
>> do I link them to the GUI, i.e. how do I reference them within the
>> template?
>>
>>
>> Kind regards,
>> Dirk
>> _______________________________________________
>> Cartoweb-users mailing list
>> Cartoweb-users at lists.maptools.org
>> http://lists.maptools.org/mailman/listinfo/cartoweb-users
>
More information about the Cartoweb-users
mailing list