71 $this->_startField(
$field);
75 $ids = displayFieldAsList($attachments,
"attachment_id");
77 <div
class=
'photo_attachment_handler'>
78 <input type=
"hidden" value=
"<?echo $ids?>" name=
"<?echo $field?>" id=
"<?echo $this->parent->id?>_<?echo $field?>"/>
79 <ul
id=
"<?echo $this->parent->id?>_<?echo $field?>_list" class=
"<?echo $this->cssClass?>" style=
'display: table-cell'>
84 ?> <li
id=
'attachment_<?echo $attachment->attachment_id?>' class=
'<?echo $this->cssClass?>'><span>
89 <a href=
"#" onclick=
'new PhotoAttachmentUploader().deleteAttachment("<?echo $attachment->filename?>", <?echo $attachment->attachment_id?>); return false' title=
'Delete this Attachment'><img src=
'<?echo $this->deleteIcon?>' style=
'display:inline-block; vertical-align: middle' alt=
'Delete this Attachment'/></a>
95 <p
id=
"attachmentDialogMessage"></p>
96 <a href=
"#" onclick=
"new PhotoAttachmentUploader().capturePhoto(); return false" class=
"button"> Take a Photo </a>&
nbsp;&
nbsp;
97 <a href=
"#" onclick=
"new PhotoAttachmentUploader().choosePhoto(); return false" class=
"button">Upload a Photo</a>
99 <script type=
"text/javascript">
100 window.addEvent(
'domready',
function()
102 new PhotoAttachmentUploader().setup(
'<?echo $this->parent->id?>_<?echo $this->field?>_list',
'<?echo $this->parent->id?>_<?echo $this->field?>',
'<?echo $this->cssClass?>',
'<?echo $this->deleteIcon?>');
115 if(count($attachments) < 2) $this->
colspan = 1;
118 $this->_printLabel(
$field);
120 if ($this->parent->valueCSS) echo
" class='{$this->parent->valueCSS}'";
124 if(count($attachments) == 1)
128 elseif(count($attachments) > 0)
131 <ul
id=
"<?echo $this->parent->id?>_<?echo $field?>_list" class=
"<?echo $this->cssClass?>">
135 ?> <li
id=
'attachment_<?echo $attachment->attachment_id?>' class=
'<?echo $this->cssClass?>'><span>
153 $pkv = $this->parent->data->get(
$pk);
157 $attachments = query(
Attachment,
"WHERE attachment_id in (select attachment_id from {$xref->table} where $pk=$pkv) ORDER BY attachment_id");
161 $attachments = array();
171 <img src=
"<?echo $icon?>" alt=
"Icon" style=
"display:inline-block;vertical-align:middle"/>&
nbsp;
172 <a href=
'/action/attachment/download?attachment_id=<?echo $attachment->attachment_id?>'><?echo
$attachment->filename?></a>&
nbsp;
179 trace(
"AttachmentFieldRenderer postProcess field $field value ".
$_POST[
$field], 3);
180 if ($this->parent->readOnlyForm || $this->parent->isReadOnly(
$field) || array_key_exists(
$field, $this->parent->hidden))
return "";
186 $obj = $this->parent->data;
192 $xref->delete(
"WHERE {$pk}=".
$obj->get(
$pk));
196 trace(
"AttachmentFieldRenderer postProcess _POST attachment field is ".
$_POST[
$field], 3);
203 $xref->set(
"attachment_id",
$id);
209 trace(
"AttachmentFieldRenderer postProcess _POST attachment field is empty", 3);
if(! $attachment_id) $attachment
getMatchingPK($xref, $obj)
AttachmentFieldRenderer(&$form, $field, $xrefClass)
static using()
Import the datamodels, views and manifest for the specified component(s).
static create($form, $field, $xrefClass)
drawOneAttachment($attachment)
renderReadOnly($field="")
PhotoAttachmentFieldRenderer($form, $field, $xrefClass)