/** * */ function _getReportTableContent($reportIter, $isAdmin, &$altRowClass) { $hp = Codendi_HTMLPurifier::instance(); $html = ''; $reportIter->rewind(); while ($reportIter->valid()) { $r = $reportIter->current(); $trclass = html_get_alt_row_color($altRowClass++); $html .= '<tr class="' . $trclass . '">'; // Name $rUrl = $this->defaultUrl . '&action=report_settings&report_id=' . $r->getId(); $rName = '<a href="' . $rUrl . '">' . $hp->purify($r->getName(), CODENDI_PURIFIER_CONVERT_HTML) . '</a>'; $html .= '<td align="left">' . $rName . '</td>'; // Scope $scopeName = $GLOBALS['Language']->getText('plugin_docman', 'report_scope_' . $r->getScope()); $html .= '<td align="center">' . $scopeName . '</td>'; // Delete $trashLink = $this->defaultUrl . '&action=report_del&report_id=' . $r->getId(); $trashWarn = $GLOBALS['Language']->getText('plugin_docman', 'report_settings_delete', $hp->purify(addslashes($r->getName()), CODENDI_PURIFIER_CONVERT_HTML)); $trashAlt = $GLOBALS['Language']->getText('plugin_docman', 'report_settings_delete_alt', $hp->purify($r->getName(), CODENDI_PURIFIER_CONVERT_HTML)); $delUrl = $this->defaultUrl . '&action=report_del&report_id=' . $r->getId(); $delName = html_trash_link($trashLink, $trashWarn, $trashAlt); $html .= '<td align="center">' . $delName . '</td>'; $html .= "</tr>\n"; $reportIter->next(); } return $html; }
/** * List the available metadata */ function getMetadataTable($mdIter, $groupId, $defaultUrl) { $content = ''; $mdFactory = new Docman_MetadataFactory($groupId); $content .= '<h3>' . $GLOBALS['Language']->getText('plugin_docman', 'admin_metadata_list_title') . '</h3>' . "\n"; $content .= $GLOBALS['Language']->getText('plugin_docman', 'admin_metadata_instructions') . "\n"; $content .= html_build_list_table_top(array($GLOBALS['Language']->getText('plugin_docman', 'admin_metadata_list_name'), $GLOBALS['Language']->getText('plugin_docman', 'admin_metadata_list_descr'), $GLOBALS['Language']->getText('plugin_docman', 'admin_metadata_list_status'), $GLOBALS['Language']->getText('plugin_docman', 'admin_metadata_list_delete'))); $altRowClass = 0; $mdIter->rewind(); while ($mdIter->valid()) { $md =& $mdIter->current(); $canDelete = false; if ($mdFactory->isRealMetadata($md->getLabel())) { $canDelete = true; } $trclass = html_get_alt_row_color($altRowClass++); $content .= '<tr class="' . $trclass . '">'; $nameUrl = $this->buildUrl($defaultUrl, array('action' => 'admin_md_details', 'md' => $md->getLabel())); $nameHref = '<a href="' . $nameUrl . '">' . $this->hp->purify($md->getName()) . '</a>'; $content .= '<td>' . $nameHref . '</td>'; $content .= '<td>' . $this->hp->purify($md->getDescription()) . '</td>'; $content .= '<td>'; if ($md->isRequired()) { $content .= "-"; } else { if ($md->isUsed()) { $content .= "Used"; } else { $content .= "Unused"; } } $content .= '</td>'; $trash = '-'; if ($canDelete) { $link = $this->buildUrl($defaultUrl, array('action' => 'admin_delete_metadata', 'md' => $md->getLabel())); $warn = $GLOBALS['Language']->getText('plugin_docman', 'admin_metadata_list_delete_warn', $this->hp->purify($md->getName())); $alt = $GLOBALS['Language']->getText('plugin_docman', 'admin_metadata_list_delete_alt', $this->hp->purify($md->getName())); $trash = html_trash_link($link, $warn, $alt); } $content .= '<td>' . $trash . '</td>'; $content .= '</tr>' . "\n"; $mdIter->next(); } $content .= '</table>' . "\n"; return $content; }
function toHtml($formName, $trashLinkBase) { $trashLink = ''; if ($trashLinkBase) { $trashLink = $trashLinkBase . $this->filter->md->getLabel(); $trashWarn = $this->hp->purify($GLOBALS['Language']->getText('plugin_docman', 'report_remove_filter_warn')); $trashAlt = $this->hp->purify($GLOBALS['Language']->getText('plugin_docman', 'report_remove_filter_alt')); $trashLink = html_trash_link($trashLink, $trashWarn, $trashAlt); } $html = '<tr>'; $html .= '<td>'; $html .= $trashLink; $html .= ' '; $html .= $this->_fieldName(); $html .= ': '; $html .= '</td>'; $html .= '<td>'; $html .= $this->_valueSelectorHtml($formName); $html .= '</td>'; $html .= '</tr>'; $html .= "\n"; return $html; }
ksort($ugroupRow); format_html_row($ugroupRow, $row_num); } } if ($group_id != 100) { $result = db_query("SELECT * FROM ugroup WHERE group_id={$group_id} ORDER BY name"); if (db_numrows($result) > 0) { while ($row = db_fetch_array($result)) { $ugroupRow[100] = '<a href="/project/admin/editugroup.php?group_id=' . $group_id . '&ugroup_id=' . $row['ugroup_id'] . '&func=edit">' . util_translate_name_ugroup($row['name']); $ugroupRow[200] = util_translate_desc_ugroup($row['description']); $res2 = db_query("SELECT count(*) FROM ugroup_user WHERE ugroup_id=" . $row['ugroup_id']); $nb_members = db_result($res2, 0, 0); if ($nb_members) { $ugroupRow[300] = array('value' => $nb_members, 'html_attrs' => 'align="center"'); } else { $ugroupRow[300] = array('value' => 0, 'html_attrs' => 'align="center"'); } $token = $csrf->getTokenName() . '=' . $csrf->getToken(); $link = '?group_id=' . $group_id . '&ugroup_id=' . $row['ugroup_id'] . '&func=delete&' . $token; $warn = $Language->getText('project_admin_ugroup', 'del_ug'); $alt = $Language->getText('project_admin_servicebar', 'del'); $ugroupRow[400] = html_trash_link($link, $warn, $alt); $em->processEvent('ugroup_table_row', array('row' => $row, 'html_array' => &$ugroupRow)); ksort($ugroupRow); format_html_row($ugroupRow, $row_num); } } } echo "</table>\n"; echo "<p>" . $Language->getText('project_admin_ugroup', 'predef_g') . "</p>\n"; project_admin_footer(array());
function getContent() { $html = ''; $display_privacy = ForgeConfig::get('sys_display_project_privacy_in_service_bar'); $user = UserManager::instance()->getCurrentUser(); $order = 'groups.group_name'; if ($display_privacy) { $order = 'access, groups.group_name'; } $result = db_query("SELECT groups.group_id, groups.group_name, groups.unix_group_name, groups.status, groups.access, user_group.admin_flags" . " FROM groups" . " JOIN user_group USING (group_id)" . " WHERE user_group.user_id = " . $user->getId() . " AND groups.status = 'A'" . " ORDER BY {$order}"); $rows = db_numrows($result); if (!$result || $rows < 1) { $html .= $GLOBALS['Language']->getText('my_index', 'not_member'); } else { $html .= '<table cellspacing="0" class="widget_my_projects">'; $i = 0; $prevIsPublic = -1; $token = new CSRFSynchronizerToken('massmail_to_project_members.php'); while ($row = db_fetch_array($result)) { $tdClass = ''; if ($display_privacy && $prevIsPublic == 0 && $row['access'] != Project::ACCESS_PRIVATE) { $tdClass .= ' widget_my_projects_first_public'; } $html .= '<tr class="' . util_get_alt_row_color($i++) . '" >'; // Privacy if ($display_privacy) { if ($row['access'] === Project::ACCESS_PRIVATE) { $privacy = Project::ACCESS_PRIVATE; } else { $privacy = Project::ACCESS_PUBLIC; } $html .= '<td class="widget_my_projects_privacy' . $tdClass . '"><span class="project_privacy_' . $privacy . '">'; $html .= ' '; $html .= '</span></td>'; } // Project name $html .= '<td class="widget_my_projects_project_name' . $tdClass . '"><a href="/projects/' . $row['unix_group_name'] . '/">' . $row['group_name'] . '</a></td>'; // Admin link $html .= '<td class="widget_my_projects_actions' . $tdClass . '">'; if ($row['admin_flags'] == 'A') { $html .= '<a href="/project/admin/?group_id=' . $row['group_id'] . '">[' . $GLOBALS['Language']->getText('my_index', 'admin_link') . ']</a>'; } else { $html .= ' '; } $html .= '</td>'; // Mailing tool $html .= '<td class="' . $tdClass . '">'; $html .= '<a class="massmail-project-member-link" href="#massmail-project-members" data-project-id="' . $row['group_id'] . '" title="' . $GLOBALS['Language']->getText('my_index', 'send_mail', $row['group_name']) . '" data-toggle="modal"><span class="icon-envelope-alt"></span></a>'; $html .= '</td>'; // Remove from project $html .= '<td class="widget_my_projects_remove' . $tdClass . '">'; if ($row['admin_flags'] != 'A') { $html .= html_trash_link('rmproject.php?group_id=' . $row['group_id'], $GLOBALS['Language']->getText('my_index', 'quit_proj'), $GLOBALS['Language']->getText('my_index', 'quit_proj')); } else { $html .= ' '; } $html .= '</td>'; $html .= '</tr>'; $prevIsPublic = $row['access'] !== Project::ACCESS_PRIVATE; } if ($display_privacy) { // Legend $html .= '<tr>'; $html .= '<td colspan="5" class="widget_my_projects_legend">'; $html .= '<span class="widget_my_projects_legend_title">' . $GLOBALS['Language']->getText('my_index', 'my_projects_legend') . '</span>'; $html .= '<span class="project_privacy_private"> ' . $GLOBALS['Language']->getText('project_privacy', 'private') . '</span>'; $html .= '<span class="project_privacy_public"> ' . $GLOBALS['Language']->getText('project_privacy', 'public') . '</span>'; $html .= '</td>'; $html .= '</tr>'; } $html .= '</table>'; $html .= $this->fetchMassMailForm($token); } return $html; }
/** * Display the project linked by the current projet to update or delete them * * @param Integer $group_id Group id * @return String */ function _admin_links_table($link_type_id) { $html = ''; $dao = $this->getProjectLinksDao(); $links = $dao->searchLinksByType($link_type_id); if ($links->rowCount() > 0) { $html .= html_build_list_table_top(array($GLOBALS['Language']->getText('plugin_plinks', 'dbfn_name'), ''), false, false, false); foreach ($dao->searchLinksByType($link_type_id) as $row) { $html .= '<tr>'; // Name $html .= '<td>' . $row['group_name'] . '</td>'; // Delete $url = "?func=pl_link_delete&disp=edit_link_type&link_type_id=" . $link_type_id . "&group_id=" . $row['master_group_id'] . "&link_id=" . $row['link_id']; $warn = $GLOBALS['Language']->getText('plugin_plinks', 'delete_link'); $alt = $GLOBALS['Language']->getText('plugin_plinks', 'delete_link'); $html .= '<td>' . html_trash_link($url, $warn, $alt) . '</td>'; $html .= '</tr>'; } $html .= '</table>'; } return $html; }
/** * _browseWikiDocument - private */ function _browseWikiDocument() { $purifier = Codendi_HTMLPurifier::instance(); $wei = WikiEntry::getEntryIterator($this->gid); print $GLOBALS['Language']->getText('wiki_views_wkserviews', 'browsedoc'); print html_build_list_table_top(array($GLOBALS['Language']->getText('wiki_views_wkserviews', 'doc_name'), $GLOBALS['Language']->getText('wiki_views_wkserviews', 'doc_page'), $GLOBALS['Language']->getText('wiki_views_wkserviews', 'doc_rank'), $GLOBALS['Language']->getText('wiki_views_wkserviews', 'doc_delete'))); $i = 0; while ($wei->valid()) { $we = $wei->current(); print '<tr class="' . html_get_alt_row_color($i) . '">'; print '<td> <a href="' . $this->wikiAdminLink . '&view=updateWikiDocument&id=' . $we->getId() . '">' . $purifier->purify($we->getName()) . '</a> </td>'; print '<td>'; print $purifier->purify($we->getPage()); print ' - '; print '<a href="' . $this->wikiAdminLink . '&view=docPerms&id=' . $we->wikiPage->getId() . '">'; $status = $GLOBALS['Language']->getText('wiki_views_wkserviews', 'define_perms'); if ($we->wikiPage->permissionExist()) { $status = $GLOBALS['Language']->getText('wiki_views_wkserviews', 'edit_perms'); } print '[' . $purifier->purify($status) . ']'; print '</a>'; print '</td>'; print '<td align="center">' . $we->getRank() . '</td>'; print '<td align="center">'; $alt = $GLOBALS['Language']->getText('wiki_views_wkserviews', 'deletedoc', array($purifier->purify($we->getName()))); print html_trash_link($this->wikiAdminLink . '&view=wikiDocuments&action=delete&id=' . $we->getId(), $GLOBALS['Language']->getText('common_mvc_view', 'warn', $alt), $alt); print '</td>'; print '</tr>'; $i++; $wei->next(); } print '</table>'; }
function _content($params) { $md =& $params['md']; $sthCanChange = false; $mdContent = ''; $mdContent .= '<h3>' . $GLOBALS['Language']->getText('plugin_docman', 'admin_md_detail_param_title') . '</h3>'; $mdContent .= '<table>'; $metaMdHtml = new Docman_MetaMetadataHtml($md); $mdContent .= $metaMdHtml->getName($sthCanChange); $mdContent .= $metaMdHtml->getDescription($sthCanChange); $mdContent .= $metaMdHtml->getType($sthCanChange); $mdContent .= $metaMdHtml->getEmptyAllowed($sthCanChange); if ($md->getType() == PLUGIN_DOCMAN_METADATA_TYPE_LIST) { $mdContent .= $metaMdHtml->getMultipleValuesAllowed($sthCanChange); } $mdContent .= $metaMdHtml->getUseIt($sthCanChange); $mdContent .= $metaMdHtml->getKeepHistory($sthCanChange); $mdContent .= '</table>'; if ($sthCanChange) { $act_url = $this->buildUrl($params['default_url'], array()); echo '<form name="md_details_update" method="POST" action="' . $act_url . '" class="docman_form">'; echo '<input type="hidden" name="label" value="' . $md->getLabel() . '" />'; echo '<input type="hidden" name="action" value="admin_md_details_update" />'; echo $mdContent; echo '<input type="submit" name="submit" value="' . $GLOBALS['Language']->getText('plugin_docman', 'admin_md_details_update') . '" />'; echo '</form>'; } else { echo $mdContent; } // // Display list of values // if ($md->getType() == PLUGIN_DOCMAN_METADATA_TYPE_LIST) { echo '<h3>' . $GLOBALS['Language']->getText('plugin_docman', 'admin_md_detail_val_title') . '</h3>'; echo '<div class="docman_admin_list_values">' . "\n"; echo html_build_list_table_top(array($GLOBALS['Language']->getText('plugin_docman', 'admin_md_detail_val_name'), $GLOBALS['Language']->getText('plugin_docman', 'admin_md_detail_val_desc'), $GLOBALS['Language']->getText('plugin_docman', 'admin_md_detail_val_status'), $GLOBALS['Language']->getText('plugin_docman', 'admin_md_detail_val_delete'))); $vIter =& $md->getListOfValueIterator(); $vIter->rewind(); $rowColorIdx = 0; while ($vIter->valid()) { $e =& $vIter->current(); // Status $canDelete = false; $displayed = true; switch ($e->getStatus()) { case 'A': $canDelete = true; $status = $GLOBALS['Language']->getText('plugin_docman', 'admin_md_detail_val_active'); break; case 'P': $status = $GLOBALS['Language']->getText('plugin_docman', 'admin_md_detail_val_perm'); break; case 'D': $displayed = false; break; default: $status = $GLOBALS['Language']->getText('plugin_docman', 'admin_md_detail_val_inactive'); } if ($displayed) { $class = ' class="' . html_get_alt_row_color($rowColorIdx++) . '"'; echo '<tr' . $class . '>'; // Name $name = Docman_MetadataHtmlList::_getElementName($e); if ($e->getId() > 100) { $url = $this->buildUrl($params['default_url'], array('action' => 'admin_display_love', 'md' => $md->getLabel(), 'loveid' => $e->getId())); $href = '<a href="' . $url . '">' . $name . '</a>'; } else { $href = $name; } echo '<td>' . $href . '</td>'; // Description echo '<td>' . Docman_MetadataHtmlList::_getElementDescription($e) . '</td>'; // Status echo '<td>' . $status . '</td>'; // Delete $trash = '-'; if ($canDelete) { $link = '?group_id=' . $params['group_id'] . '&action=admin_delete_love&loveid=' . $e->getId() . '&md=' . $md->getLabel(); $warn = $GLOBALS['Language']->getText('plugin_docman', 'admin_md_detail_val_delete_warn', array($name)); $alt = $GLOBALS['Language']->getText('plugin_docman', 'admin_md_detail_val_delete_alt', array($name)); $trash = html_trash_link($link, $warn, $alt); } echo '<td>' . $trash . '</td>'; echo '</tr>'; } $vIter->next(); } echo '</table>'; echo '</div><!-- docman_admin_list_values -->' . "\n"; if ($md->getLabel() != 'status') { echo '<h3>' . $GLOBALS['Language']->getText('plugin_docman', 'admin_md_detail_val_create_title') . '</h3>'; $loveDetailsHtml = new Docman_View_LoveDetails($md); echo '<form name="md_create_love" method="POST" action="?group_id=' . $params['group_id'] . '&action=admin_create_love" class="docman_form">'; echo $loveDetailsHtml->getHiddenFields(); echo '<table>'; echo $loveDetailsHtml->getNameField(); echo $loveDetailsHtml->getDescriptionField(); echo $loveDetailsHtml->getRankField(); echo '</table>'; echo '<input type="submit" name="submit" value="' . $GLOBALS['Language']->getText('plugin_docman', 'admin_md_detail_val_create_submit') . '" />'; echo '</form>'; } } $backUrl = $this->buildUrl($params['default_url'], array('action' => 'admin_metadata')); echo '<p><a href="' . $backUrl . '">' . $GLOBALS['Language']->getText('plugin_docman', 'admin_md_detail_backtomenu') . '</a></p>'; }
function getContent() { $html = ''; $user = UserManager::instance()->getCurrentUser(); $result = db_query("SELECT groups.group_id, groups.group_name, groups.unix_group_name, groups.status, groups.is_public, user_group.admin_flags" . " FROM groups" . " JOIN user_group USING (group_id)" . " WHERE user_group.user_id = " . $user->getId() . " AND groups.status = 'A'" . " ORDER BY is_public, groups.group_name"); $rows = db_numrows($result); if (!$result || $rows < 1) { $html .= $GLOBALS['Language']->getText('my_index', 'not_member'); } else { $html .= '<table cellspacing="0" class="widget_my_projects">'; $i = 0; $prevIsPublic = -1; while ($row = db_fetch_array($result)) { $tdClass = ''; if ($prevIsPublic == 0 && $row['is_public'] == 1) { $tdClass .= ' widget_my_projects_first_public'; } $html .= '<tr class="' . util_get_alt_row_color($i++) . '" >'; // Privacy if ($row['is_public'] == 1) { $privacy = 'public'; } else { $privacy = 'private'; } $html .= '<td class="widget_my_projects_privacy' . $tdClass . '"><span class="project_privacy_' . $privacy . '">'; $html .= ' '; $html .= '</span></td>'; // Project name $html .= '<td class="widget_my_projects_project_name' . $tdClass . '"><a href="/projects/' . $row['unix_group_name'] . '/">' . $row['group_name'] . '</a></td>'; // Admin link $html .= '<td class="widget_my_projects_actions' . $tdClass . '">'; if ($row['admin_flags'] == 'A') { $html .= '<a href="/project/admin/?group_id=' . $row['group_id'] . '">[' . $GLOBALS['Language']->getText('my_index', 'admin_link') . ']</a>'; } else { $html .= ' '; } $html .= '</td>'; // Remove from project $html .= '<td class="widget_my_projects_remove' . $tdClass . '">'; if ($row['admin_flags'] != 'A') { $html .= html_trash_link('rmproject.php?group_id=' . $row['group_id'], $GLOBALS['Language']->getText('my_index', 'quit_proj'), $GLOBALS['Language']->getText('my_index', 'quit_proj')); } else { $html .= ' '; } $html .= '</td>'; $html .= '</tr>'; $prevIsPublic = $row['is_public']; } // Legend $html .= '<tr>'; $html .= '<td colspan="4" class="widget_my_projects_legend">'; $html .= '<span class="widget_my_projects_legend_title">' . $GLOBALS['Language']->getText('my_index', 'my_projects_legend') . '</span>'; $html .= '<span class="project_privacy_private"> ' . $GLOBALS['Language']->getText('project_privacy', 'private') . '</span>'; $html .= '<span class="project_privacy_public"> ' . $GLOBALS['Language']->getText('project_privacy', 'public') . '</span>'; $html .= '</td>'; $html .= '</tr>'; $html .= '</table>'; // Javascript for project privacy tooltip $js = "\ndocument.observe('dom:loaded', function() {\n \$\$('span[class=project_privacy_private], span[class=project_privacy_public]').each(function (span) {\n var type = span.className.substring('project_privacy_'.length, span.className.length);\n codendi.Tooltips.push(new codendi.Tooltip(span, '/project/privacy.php?project_type='+type));\n });\n});\n"; $GLOBALS['HTML']->includeFooterJavascriptSnippet($js); } return $html; }