public function get_row(midcom_core_dbaobject $document) { $prefix = midcom_core_context::get()->get_key(MIDCOM_CONTEXT_ANCHORPREFIX); $entry = array(); $entry['id'] = $document->id; $entry['index_title'] = $document->title; $entry['index_filesize'] = 0; $entry['filesize'] = ''; $entry['mimetype'] = ''; $icon = MIDCOM_STATIC_URL . '/stock-icons/mime/gnome-text-blank.png'; $alt = ''; $att = $document->load_attachment(); if ($att) { $icon = midcom_helper_misc::get_mime_icon($att->mimetype); $alt = $att->name; $stats = $att->stat(); $entry['index_filesize'] = $stats[7]; $entry['filesize'] = midcom_helper_misc::filesize_to_string($stats[7]); $entry['mimetype'] = org_openpsa_documents_document_dba::get_file_type($att->mimetype); } $title = '<a class="tab_escape" href="' . $prefix . 'document/' . $document->guid . '/"><img src="' . $icon . '"'; $title .= 'alt="' . $alt . '" style="border: 0px; height: 16px; vertical-align: middle" /> ' . $document->title . '</a>'; $entry['title'] = $title; $entry['created'] = strftime('%Y-%m-%d %X', $document->metadata->created); $entry['index_author'] = ''; $entry['author'] = ''; if ($document->author) { $author = org_openpsa_contacts_person_dba::get_cached($document->author); $entry['index_author'] = $author->rname; $author_card = org_openpsa_widgets_contact::get($author->guid); $entry['author'] = $author_card->show_inline(); } return $entry; }
echo "<cell>" . $level . "</cell>"; echo "<cell>" . $parent . "</cell>"; // leaf = false , expanded = false echo "<cell>false</cell>"; echo "<cell>false</cell>"; echo "</row>\n"; } $icon = MIDCOM_STATIC_URL . '/stock-icons/mime/gnome-text-blank.png'; foreach ($data['documents'] as $document) { $file_size = 0; $download_url = ''; if ($data['datamanager']->autoset_storage($document)) { $attach = array_shift($data['datamanager']->types['document']->attachments_info); if ($attach) { $file_size = $attach['filesize']; $icon = midcom_helper_misc::get_mime_icon($attach['mimetype']); if (!$file_size) { $file_size = 0; } $download_url = $attach['url']; } } echo "<row>"; echo "<cell>" . $document->id . "</cell>"; echo "<cell><![CDATA[" . $document->title . "]]></cell>"; $class = 'document ' . $document->get_class(); $link_html = "<![CDATA["; $link_html .= "<a href='" . $prefix . $path . "document/" . $document->guid . "/' class='" . $class . "'>"; $link_html .= "<img class='document_icon' src='" . $icon . "' />"; $link_html .= "<span>" . $document->title . "</span></a>"; $link_html .= "]]>";
public static function render_fileinfo($object, $field) { $output = ''; $identifiers = explode(',', $object->get_parameter('midcom.helper.datamanager2.type.blobs', 'guids_' . $field)); if (empty($identifiers)) { return $output; } $host_prefix = midcom::get()->get_host_prefix(); foreach ($identifiers as $identifier) { $parts = explode(':', $identifier); if (sizeof($parts) != 2) { continue; } $guid = $parts[1]; try { $attachment = new midcom_db_attachment($guid); $url = $host_prefix . '/midcom-serveattachmentguid-' . $attachment->guid . '/' . $attachment->name; $stat = $attachment->stat(); $filesize = midcom_helper_misc::filesize_to_string($stat[7]); $mimetype = org_openpsa_documents_document_dba::get_file_type($attachment->mimetype); $mimetype_icon = midcom_helper_misc::get_mime_icon($attachment->mimetype); $output .= '<span class="org_openpsa_helpers_fileinfo">'; $output .= '<a href="' . $url . '" class="icon"><img src="' . $mimetype_icon . '" alt="' . $mimetype . '" /></a>'; $output .= '<a href="' . $url . '" class="filename">' . $attachment->name . '</a>'; $output .= '<span class="mimetype">' . $mimetype . '</span>'; $output .= '<span class="filesize">' . $filesize . '</span>'; $output .= "</span>\n"; } catch (midcom_error $e) { $e->log(); continue; } $output .= ''; } return $output; }
<?php if (count($data['files']) > 0) { static $persons = array(); echo "<table class=\"attachments table_widget\" id=\"attachment_table\">\n"; echo " <thead>\n"; echo " <tr>\n"; echo " <th>" . midcom::get('i18n')->get_string('title', 'midcom') . "</th>\n"; echo " <th>" . midcom::get('i18n')->get_string('revised on', 'midgard.admin.asgard') . "</th>\n"; echo " <th>" . midcom::get('i18n')->get_string('revised by', 'midgard.admin.asgard') . "</th>\n"; echo " <th>" . midcom::get('i18n')->get_string('size', 'midgard.admin.asgard') . "</th>\n"; echo " <th>" . midcom::get('i18n')->get_string('actions', 'midgard.admin.asgard') . "</th>\n"; echo " </tr>\n"; echo " </thead>\n"; echo " <tbody>\n"; foreach ($data['files'] as $file) { $mime_icon = midcom_helper_misc::get_mime_icon($file->mimetype); if (!isset($persons[$file->metadata->revisor])) { $persons[$file->metadata->revisor] = midcom::get('auth')->get_user($file->metadata->revisor); } $class = ''; if (isset($data['file']) && $file->name == $data['file']->name) { $class = ' class="selected"'; } $delete_title = sprintf(midcom::get('i18n')->get_string('delete %s %s', 'midgard.admin.asgard'), midcom::get('i18n')->get_string('attachment', 'midgard.admin.asgard'), $file->name); echo "<tr>\n"; echo " <td{$class}>\n"; echo " <a href=\"{$prefix}__mfa/asgard/object/attachments/{$data['object']->guid}/{$file->name}/\">\n"; echo " <img src=\"{$mime_icon}\" width=\"16\" height=\"16\"/>\n"; echo " {$file->name}\n"; echo " </a>\n "; echo " </td>\n";
</fieldset> <?php } ?> <div class="form_toolbar"> <input type="submit" class="save" name="midgard_admin_asgard_save" accesskey="s" value="<?php echo midcom::get('i18n')->get_string('save', 'midcom'); ?> " /> </div> </form> <form class="urlform" method="post" action="&(data['delete_url']:h);"> <?php $file_url = midcom::get()->get_host_prefix() . "midcom-serveattachmentguid-{$data['file']->guid}/{$data['file']->name}"; $mime_icon = midcom_helper_misc::get_mime_icon($data['file']->mimetype); ?> <fieldset> <legend><?php echo midcom::get('i18n')->get_string('file information', 'midgard.admin.asgard'); ?> </legend> <div class="icon"> <a href="&(file_url);"> <img src="&(mime_icon);" /> <?php echo midcom_helper_misc::filesize_to_string($data['file']->metadata->size) . " {$data['file']->mimetype}"; ?> </a> </div>
$prefix = midcom_connection::get_url('self'); $item =& $data['result']; $mime_icon = null; $item_type = "image"; ?> <?php switch ($item->mimetype) { case 'image/x-png': case 'image/png': case 'image/jpeg': case 'image/pjpeg': case 'image/gif': break; default: $item_type = "attachment"; $mime_icon = midcom_helper_misc::get_mime_icon($item->mimetype); ?> <?php } ?> <li title="&(item.guid);" class="midcom_helper_imagepopup_search_result_item" rel="&(item_type);"> <?php if ($item_type == "image") { ?> <a href='&(prefix);midcom-serveattachmentguid-&(item.guid);/&(item.name);'> <img src='&(prefix);midcom-serveattachmentguid-&(item.guid);/&(item.name);' height='54' align='texttop' /> </a> <a href='&(prefix);midcom-serveattachmentguid-&(item.guid);/&(item.name);'> <span title="name">&(item.name);</span> </a>