// // aegis - project change supervisor // Copyright (C) 2004-2009, 2011, 2012, 2014 Peter Miller // Copyright (C) 2007 Walter Franzini // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 3 of the License, or (at // your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program. If not, see . // #include #include #include #include #include #include #include #include #include #include #include #include #include #include change_functor_inventory::change_functor_inventory(bool arg1, project *arg2, bool arg3, bool arg4, const nstring &arg5, const char *arg6, const nstring_list &arg7, const nstring_list &arg8) : change_functor(arg1), pp(arg2), exclude_change(arg8), include_change(arg7), include_original_uuid(arg3), generate_uuid_based_links(arg4), prefix(arg5), suffix(arg6), num(0) { html_header(pp, change::pointer()); printf("Project "); html_encode_string(project_name_get(pp)); printf(",\nChange Set Inventory\n"); html_header_ps(pp, change::pointer()); printf("

"); emit_project(pp); printf(",
\nChange Set Inventory

\n"); // // list the project's changes // printf("
\n"); printf(""); printf("\n"); } static size_t max_printable(const nstring &s) { size_t len = 0; const char *cp = s.c_str(); for (;;) { unsigned char c = *cp++; if (!c || !isprint(c)) break; ++len; if (len >= 200) break; } return len; } void change_functor_inventory::print_one_line(change::pointer cp, const nstring &uuid) { // // If the change's aeget:inventory:hide attribute is true, do not // emit this change set into the inventory listing used by // aedist --missing, et al. // if (change_attributes_find_boolean(cp, "aeget:inventory:hide")) return; printf("", (((num++ / 3) & 1) ? "even" : "odd")); printf("\n"); } void change_functor_inventory::operator()(const change::pointer &cp) { if (!cp->is_completed()) return; nstring uuid(cp->uuid_get()); if (!uuid.empty()) print_one_line(cp, uuid); if (!include_original_uuid) return; cstate_ty *cstate_data = cp->cstate_get(); if (cstate_data->attribute) { for (size_t j = 0; j < cstate_data->attribute->length; ++j) { attributes_ty *ap = cstate_data->attribute->list[j]; assert(ap); if ( ap->name && 0 == strcasecmp(ORIGINAL_UUID, ap->name->str_text) && ap->value && // users can edit, make sure is OK universal_unique_identifier_valid(ap->value) ) { print_one_line(cp, nstring(ap->value)); } } } } change_functor_inventory::~change_functor_inventory() { printf("\n", (unsigned long)num); printf("
ChangeUUIDDescription
"); emit_change_href(cp, "menu"); html_encode_string(cp->version_get()); printf(""); if (generate_uuid_based_links) { emit_change_uuid_href(cp, uuid, prefix, suffix); } else { emit_change_href ( cp, nstring::format("aedist+compat=%s", version_stamp()).c_str() ); } html_encode_string(uuid); printf(""); // // We are deliberately not using emit_change_brief_description to // ensure that this row only ever takes one line, and contains no // html anchor. This makes it simple to parse in aedist --missing // nstring s = cp->brief_description_get(); s = s.substr(0, max_printable(s)); html_encode_string(s); printf("
\n"); printf("Listed %lu change sets.
\n"); printf("

There is also a page containing this list "); if (include_original_uuid) { emit_project_href(pp, "inventory"); printf("without"); } else { emit_project_href(pp, "inventory+all"); printf("with"); } printf(" the original-uuid attributes.

"); printf("
\n"); printf("A similar report may be obtained from the command line, with\n"); printf("
ael cin -p ");
    html_encode_string(project_name_get(pp));
    printf("
\n"); printf("
\n"); printf("

[\n"); printf("Project List |\n", http_script_name()); emit_project_href(pp, "menu"); printf("Project Menu\n"); printf("]

\n"); html_footer(pp, change::pointer()); } // vim: set ts=8 sw=4 et :