Beispiel #1
0
    public function formAddAttachments()
    {
        $form =& $this->form;
        $user =& $_SESSION['user'];
        $num_att = 0;
        if (isset($_SESSION['attachments'])) {
            $num_att = count($_SESSION['attachments']);
        }
        $form->addElement('header', null, 'Attachments');
        $tooltip = 'Paper::Attach a postscript, PDF, or other version of the
publication.';
        $form->addElement('static', null, null, '<span class="normal">' . 'The maximum upload file size is ' . ini_get('upload_max_filesize') . '. If you need to attach a file that is larger, please email it ' . 'to <a href="mailto:papersdb@cs.ualberta.ca">papersdb@cs.ualberta.ca</a> ' . 'with the publication title in the subject line.' . '</span>');
        if (isset($_SESSION['paper']) && $_SESSION['paper'] != 'none') {
            $filename = basename($_SESSION['paper'], '.' . $user->login);
            $filename = str_replace('paper_', '', $filename);
            $pos = strpos($_SESSION['paper'], 'uploaded_files');
            $html = '<a href="../' . substr($_SESSION['paper'], $pos) . '">' . $filename . '</a>';
            $form->addGroup(array(HTML_QuickForm::createElement('static', 'assigned_paper', null, $html), HTML_QuickForm::createElement('submit', 'remove_paper', 'Remove Paper')), null, "<span class=\"Tips1\" title=\"{$tooltip}\">Current Paper</span>:", '&nbsp;', false);
        } else {
            $form->setMaxFileSize(10485760);
            $form->addElement('file', 'uploadpaper', "<span class=\"Tips1\" title=\"{$tooltip}\">Paper</span>:", array('size' => 45));
        }
        $form->addElement('hidden', 'num_att', $num_att);
        $tooltip = 'Attachements::Used to attach additional files to the publication entry.';
        for ($i = 0; $i < $num_att; $i++) {
            unset($filename);
            $filename = basename($_SESSION['attachments'][$i], '.' . $user->login);
            $filename = str_replace('additional_', '', $filename);
            $att_type = $_SESSION['att_types'][$i];
            $pos = strpos($_SESSION['attachments'][$i], 'uploaded_files');
            $html = '<a href="../' . substr($_SESSION['attachments'][$i], $pos) . '">' . $filename . '</a>';
            if ($filename != '') {
                $form->addGroup(array(HTML_QuickForm::createElement('static', 'att_type' . $i, null, '[' . $att_type . ']'), HTML_QuickForm::createElement('static', 'attachment' . $i, null, $html), HTML_QuickForm::createElement('submit', 'remove_att' . $i, 'Remove Attachment')), null, "<span class=\"Tips1\" title=\"{$tooltip}\">Attachment " . ($i + 1) . '</span>:', '&nbsp;', false);
            }
        }
        $att_types = pdAttachmentTypesList::create($this->db);
        $form->addGroup(array(HTML_QuickForm::createElement('select', 'new_att_type', null, $att_types), HTML_QuickForm::createElement('file', 'new_att', null, array('size' => 35))), 'new_att_group', "<span class=\"Tips1\" title=\"{$tooltip}\">Attachment " . ($num_att + 1) . '</span>:', '&nbsp;', false);
        $form->addElement('submit', 'add_att', 'Add Attachment');
    }
Beispiel #2
0
 private function showPublication(&$pub)
 {
     $content = "<h2>" . $pub->title;
     if ($this->access_level > 0) {
         $content .= getPubIcons($this->db, $pub, 0xc);
     }
     $content .= "</h2>\n" . $pub->authorsToHtml();
     if (isset($pub->paper) && strtolower($pub->paper) != 'no paper' && basename($pub->paper) != 'paper_') {
         if ($pub->paperExists()) {
             $content .= 'Full Text: <a href="' . $pub->paperAttGetUrl() . '">';
             $name = split('paper_', $pub->paper);
             if ($name[1] != '') {
                 $content .= $name[1];
             }
             $content .= '</a>&nbsp;';
             $content .= getPubIcons($this->db, $pub, 0x1) . "<br/>\n";
         }
     }
     // Show Additional Materials
     $att_types = pdAttachmentTypesList::create($this->db);
     if (count($pub->additional_info) > 0) {
         $table = new HTML_Table(array('width' => '350', 'border' => '0', 'cellpadding' => '6', 'cellspacing' => '0'));
         $heading = 'Other Attachments:';
         $add_count = 1;
         foreach ($pub->additional_info as $att) {
             $cell = '';
             if ($pub->attExists($att)) {
                 $name = split('additional_', $att->location);
                 $cell .= '<a href="' . $pub->attachmentGetUrl($add_count - 1) . '">';
                 if ($name[1] != '') {
                     $cell .= $name[1];
                 }
                 $cell .= '</a>';
                 if (in_array($att->type, $att_types)) {
                     $cell .= '&nbsp;[' . $att->type . ']';
                 }
                 $cell .= '&nbsp;<a href="' . $pub->attachmentGetUrl($add_count - 1) . '">' . $this->getPubAddAttIcons($att) . '</a>';
                 $add_count++;
             }
             $table->addRow(array($heading, $cell));
             $heading = '';
         }
         $content .= $table->toHtml();
     }
     $content .= '<p/>' . stripslashes($pub->abstract) . '<p/>' . '<h3>Citation</h3>' . $pub->getCitationHtml() . '<p/>';
     $table = new HTML_Table(array('width' => '600', 'border' => '0', 'cellpadding' => '6', 'cellspacing' => '0'));
     $category = '';
     if (isset($pub->category) && isset($pub->category->category)) {
         $category = $pub->category->category;
     }
     $table->addRow(array('Keywords:', $pub->keywordsGet()));
     $table->addRow(array('Category:', $category));
     if (isset($_SESSION['user']) && $_SESSION['user']->showInternalInfo()) {
         $table->addRow(array('Ranking:', $pub->ranking));
         if (is_array($pub->collaborations) && count($pub->collaborations) > 0) {
             $col_desciptions = $pub->collaborationsGet($this->db);
             foreach ($pub->collaborations as $col_id) {
                 $values[] = $col_desciptions[$col_id];
             }
             $table->addRow(array('Collaboration:', implode(', ', $values)));
         }
         $table->addRow(array('Extra Info:', $pub->extraInfoGet()));
     }
     if (isset($_SESSION['user']) && $_SESSION['user']->showUserInfo()) {
         $table->addRow(array('User Info:', $pub->user));
     }
     $web_links = $pub->getWebLinks();
     if (count($web_links) > 0) {
         $c = 0;
         foreach ($web_links as $name => $url) {
             if ($c == 0) {
                 $label = 'Web Links:';
             } else {
                 $label = '';
             }
             $table->addRow(array($label, '<a href="' . $url . '" ' . 'target="_blank">' . $name . '</a>'));
             $c++;
         }
     }
     if (count($pub->relatedPubsGet()) > 0) {
         $c = 0;
         foreach ($pub->relatedPubsGet() as $related_pub_id) {
             if ($c == 0) {
                 $label = 'Related Publication(s):';
             } else {
                 $label = '';
             }
             $rel_pub = new pdPublication();
             $rel_pub->dbLoad($this->db, $related_pub_id);
             $table->addRow(array($label, '<a href="view_publication.php?' . 'pub_id=' . $rel_pub->pub_id . '" ' . ' target="_blank">' . $rel_pub->title . '</a>'));
             $c++;
         }
     }
     $table->updateColAttributes(0, array('class' => 'emph', 'width' => '25%'));
     $content .= $table->toHtml();
     $bibtex = $pub->getBibtex();
     if ($bibtex !== false) {
         $content .= '<h3>BibTeX</h3><pre class="bibtex">' . $bibtex . '</pre><p/>';
     }
     $updateStr = $this->lastUpdateGet($pub);
     if ($updateStr != '') {
         $updateStr = 'Last Updated: ' . $updateStr . '<br/>';
     }
     $updateStr .= 'Submitted by ' . $pub->submit;
     echo $content, '<span class="small">', $updateStr, '</span>';
 }