function fetchAsJavascript($params) { $dfltUrlParams = array('action' => $this->action, 'id' => $this->item->getId()); if (isset($params['bc']) && $params['bc']) { $dfltUrlParams['bc'] = '1'; } $_urlParams = array_merge($dfltUrlParams, $this->extraUrlParams); $url = Docman_View_View::buildActionUrl($params, $_urlParams, true, true); $js = "\n docman.addActionForItem(" . $this->item->getId() . ", {\n href :'" . $url . "',\n classes:'" . $this->classes . "',\n title :'" . addslashes($this->title) . "',\n img :'" . $params['docman_icons']->getActionIcon($this->action) . "',\n other_icons: ["; if (list(, $ic) = each($this->other_icons)) { $js .= "{src:'" . $params['docman_icons']->getIcon($ic . '.png') . "', classe:'" . $ic . "', url:'" . $url . "'}"; while (list(, $ic) = each($this->other_icons)) { $js .= ", {src:'" . $params['docman_icons']->getIcon($ic . '.png') . "', classe:'" . $ic . "', url:'" . $url . "'}"; } } $js .= "]\n });\n "; return $js; }
function _displayItem(&$item, $params) { $li_displayed = false; if ($this->stripFirstNode && !$this->firstNodeStripped) { $this->firstNodeStripped = true; if (isset($this->params['display_description']) && $this->params['display_description']) { $this->html .= '<p>' . $item->getDescription() . '</p>'; } } else { if ($item !== null && $this->_canDisplayItem($item)) { $this->html .= '<li id="item_' . $item->getId() . '" class="' . Docman_View_Browse::getItemClasses($params) . '">'; $params['expanded'] = true; $open = '_open'; if (!isset($this->params['item_to_move']) && user_get_preference(PLUGIN_DOCMAN_EXPAND_FOLDER_PREF . '_' . $item->getGroupId() . '_' . $item->getId()) === false) { $params['expanded'] = false; $open = ''; } $icon_src = $this->params['docman_icons']->getIconForItem($item, $params); $icon = '<img src="' . $icon_src . '" class="docman_item_icon" />'; $this->html .= '<div>'; $action = isset($this->params['item_to_move']) ? false : $item->accept($this->get_action_on_icon, array('view' => &$this->view)); if ($action) { $class = $item->accept($this->get_class_for_link, array('view' => &$this->view)); if ($class) { $class .= $open; } $url = Docman_View_View::buildUrl($this->params['default_url'], array('action' => $action, 'id' => $item->getId())); $this->html .= '<a href="' . $url . '" class="' . $class . '">'; } $this->html .= $icon; if ($action) { $this->html .= '</a>'; } $this->html .= '<span class="docman_item_title">'; if ($action) { $url = Docman_View_View::buildActionUrl($this->params, array('action' => 'show', 'id' => $item->getId()), false, isset($params['popup_doc']) ? true : false); $this->html .= '<a href="' . $url . '" id="docman_item_title_link_' . $item->getId() . '">'; } $this->html .= $this->hp->purify($item->getTitle(), CODENDI_PURIFIER_CONVERT_HTML); if ($action) { $this->html .= '</a>'; } $this->html .= '</span>'; $this->html .= $this->view->getItemMenu($item, $this->params); $this->js .= $this->view->getActionForItem($item); $this->html .= '</div>'; if (trim($item->getDescription()) != '') { $this->html .= '<div class="docman_item_description">' . $this->hp->purify($item->getDescription(), CODENDI_PURIFIER_BASIC, $item->getGroupId()) . '</div>'; } $li_displayed = true; } } return $li_displayed; }