php_lib . "/common/format_utils.inc"; require_once $dotorg->php_lib . "/base/common/dbclasses/o_person.inc"; require_once $dotorg->php_lib . "/base/workgroup/common/dbclasses/o_calendar.inc"; require_once $dotorg->php_lib . "/base/workgroup/common/dbclasses/o_document_state.inc"; require_once $dotorg->php_lib . "/base/workgroup/common/dbclasses/o_document.inc"; require_once $dotorg->php_lib . "/base/workgroup/common/dbclasses/o_workgroup.inc"; require_once $dotorg->php_lib . "/base/workgroup/common/wg_search.inc"; require_once $dotorg->php_lib . "/base/workgroup/common/dbclasses/o_wg_public.inc"; require_once $dotorg->php_lib . "/base/workgroup/common/wg_traversal_tree.inc"; require_once $dotorg->php_lib . "/base/common/help_tree.inc"; ////////////////////////////////////////////////////////////////////// // Ensure user input is clean (base/common/helpers.inc and // validate registered globals (base/common/validate.inc) ////////////////////////////////////////////////////////////////////// $my_sort_type_values = array('ASC', 'DESC'); $my_sort_field_values = array ('d1.name', 'd1.file_size', 'document_state.name', 'workgroup.name', 'person.plname', 'd1.submission_date'); $_CLEAN['GET'] = clean($_GET); if (isset($_CLEAN['GET']['sort_field'])) { $sort_field = validateEnum($_CLEAN['GET']['sort_field'], $my_sort_field_values); } if (isset($_CLEAN['GET']['sort_type'])) { $sort_type = validateEnum($_CLEAN['GET']['sort_type'], $my_sort_type_values); } if (isset($_CLEAN['GET']['wg_abbrev'])) { $wg_abbrev = validateAbbrev($_CLEAN['GET']['wg_abbrev']); } if (isset($_CLEAN['GET']['num_per_wg'])) { $num_per_wg = validateInteger($_CLEAN['GET']['num_per_wg']); } if (isset($_CLEAN['GET']['folder_id'])) { $folder_id = validateInteger($_CLEAN['GET']['folder_id']); } if (isset($_CLEAN['GET']['month'])) { $month = validateInteger($_CLEAN['GET']['month']); } if (isset($_CLEAN['GET']['year'])) { $year = validateInteger($_CLEAN['GET']['year']); } if (isset($_CLEAN['GET']['page'])) { $page = validateInteger($_CLEAN['GET']['page']); } if (isset($_CLEAN['GET']['show_descriptions'])) { $show_descriptions = validateEnum($_CLEAN['GET']['show_descriptions'], array('yes', 'no',)); } $_CLEAN['POST'] = clean($_POST); if (isset($_CLEAN['POST']['sort_field'])) { $sort_field = validateEnum($_CLEAN['POST']['sort_field'], $my_sort_field_values); } if (isset($_CLEAN['POST']['sort_type'])) { $sort_type = validateEnum($_CLEAN['POST']['sort_type'], $my_sort_type_values); } if (isset($_CLEAN['POST']['wg_abbrev'])) { $wg_abbrev = validateAbbrev($_CLEAN['POST']['wg_abbrev']); } if (isset($_CLEAN['POST']['num_per_wg'])) { $num_per_wg = validateInteger($_CLEAN['POST']['num_per_wg']); } if (isset($_CLEAN['POST']['folder_id'])) { $folder_id = validateInteger($_CLEAN['POST']['folder_id']); } if (isset($_CLEAN['POST']['month'])) { $month = validateInteger($_CLEAN['POST']['month']); } if (isset($_CLEAN['POST']['year'])) { $year = validateInteger($_CLEAN['POST']['year']); } if (isset($_CLEAN['POST']['page'])) { $page = validateInteger($_CLEAN['POST']['page']); } if (isset($_CLEAN['POST']['show_descriptions'])) { $show_descriptions = validateEnum($_CLEAN['POST']['show_descriptions'], array('yes', 'no',)); } ////////////////////////////////////////////////////////////////////// // Declare local variables ////////////////////////////////////////////////////////////////////// $workgroup_id = 0; ////////////////////////////////////////////////////////////////////// // Declare form variables ////////////////////////////////////////////////////////////////////// if (!isset($show_descriptions)) { $show_descriptions = ''; } if (!isset($wg_abbrev)) { $wg_abbrev = ''; } if (!isset($sort_type)) { $sort_type = ''; } if (!isset($sort_field)) { $sort_field = ''; } if (!isset($num_per_wg)) { $num_per_wg = ''; } ////////////////////////////////////////////////////////////////////// // END OF VARIABLES ////////////////////////////////////////////////////////////////////// // For headers and footers $wg_public = new oWGPublic(); $workgroup = new oWorkGroup(); $workgroup_tbl = new oWorkGroupTable(); // If a wg abbreviation has been passed in, find the workgroup if (isset ($wg_abbrev) && $wg_abbrev != '') { $found_workgroup = $workgroup_tbl->retrieveObject ("abbreviation='$wg_abbrev'", $workgroup); if ($found_workgroup) { $workgroup_id = $workgroup->getValue ('id'); $header = $workgroup->getPublicHeader(); $footer = $workgroup->getPublicFooter(); $group_name = $workgroup->getValue ('name'); } else { $header = $wg_public->getHeader(); $footer = $wg_public->getFooter(); $group_name = 'Groups'; } } else { $header = $wg_public->getHeader(); $footer = $wg_public->getFooter(); $group_name = 'Groups'; } $header = 'file://'. $_SERVER["DOCUMENT_ROOT"] .'/committees/standard_html_header_nobc'; $footer = 'file://'. $_SERVER["DOCUMENT_ROOT"] .'/committees/standard_html_footer'; $document = new oDocument(); $document_tbl = new oDocumentTable(); $person_tbl = new oPersonTable(); $person = new oPerson(); $person_id = $person->populateFromLogin(); ////////////////////////////////////////////////////////////////////// // Begin Output ////////////////////////////////////////////////////////////////////// $page_title = "$group_name Public Documents"; include_remote_header($header, $page_title, 'workgroup'); $organization_traversal->display(); $organization_help->display(); print "

$page_title

"; // DEFAULT PARAMETERS if (!isset($folder_id)) { $folder_id = "all"; } if (!is_numeric($num_per_wg)) { $num_per_wg = 10; // need org default } // Construct a qeury string to maintain state between pages. $current_state = "num_per_wg=$num_per_wg&wg_abbrev=$wg_abbrev"; // DEFAULT DATES if (!isset($month)) { $month = date('n'); } if (!isset($year)) { $year = date('Y'); } $next_month = $month + 1; $last_month = $month - 1; ?>
Number of Documents Show last documents per workgroup
Document Descriptions
"; } else { $new_sort_type = 'DESC'; $button_img = "\"sort"; $new_sort_text = "descending"; } if ($sort_field == 'd1.name') { $name_link = "Document Name $button_img"; } else { $name_link = "Document Name"; } if ($sort_field == 'd1.file_size') { $file_size_link = "Size $button_img"; } else { $file_size_link = "Size"; } if ($sort_field == 'document_state.name') { $state_link = "State $button_img"; } else { $state_link = "State"; } if ($sort_field == 'workgroup.name') { $wg_name_link = "Group $button_img"; } else { $wg_name_link = "Group"; } if ($sort_field == "person.plname") { $submitter_name_link = "Submitter $button_img"; } else { $submitter_name_link = "Submitter"; } if ($sort_field == 'd1.submission_date') { $date_link = "Date $button_img"; } else { $date_link = "Date"; } // GET ALL WORKGROUP IDS $wg_query = "SELECT id,name,location FROM workgroup "; if ($workgroup_id) { $wg_query .= " WHERE id=$workgroup_id "; } else { $wg_query .= " WHERE 0 = 1 "; } $wg_query .= "ORDER BY name ASC"; $wg_result = $document_tbl->database->query($wg_query); $num_docs_listed = 0; if ($wg_result) { while (list($this_workgroup_id, $workgroup_name, $workgroup_location) = mysql_fetch_array($wg_result)) { // QUERY TO GET TOTAL COUNT $query = " SELECT COUNT(*) FROM folder, document, wg_item_share wgis WHERE folder.id = document.folder_id AND folder.workgroup_id=$this_workgroup_id AND wgis.type='document' AND wgis.item_id=document.id AND wgis.destination_workgroup_id='9999' "; $result = $document_tbl->database->query($query); if ($result && mysql_num_rows($result)) { list($total_count) = mysql_fetch_row($result); } // QUERY $query = " SELECT d1.id, d1.name, d1.description, d1.location, d1.submission_date, d1.file_size, d1.revision_number, content_type.id, document_type.icon, document_type.name, document_state.name, workgroup.name, workgroup.location, folder.location, person.person_id, person.pfname, person.plname FROM document d1 JOIN workgroup JOIN wg_item_share wgis LEFT JOIN document_state ON document_state.id=d1.document_state_id LEFT JOIN person ON person.person_id=d1.submitter_id LEFT JOIN content_type ON content_type.id=d1.content_type_id LEFT JOIN folder ON folder.id=d1.folder_id LEFT JOIN document_type ON document_type.id=content_type.document_type_id WHERE folder.workgroup_id=$this_workgroup_id AND workgroup.id=$this_workgroup_id AND wgis.type='document' AND wgis.item_id=d1.id AND wgis.destination_workgroup_id='9999' "; // by default, sort by submission date, descending if (!$sort_field) { $sort_field = "d1.submission_date"; } if (!$sort_type) { $sort_type = "DESC"; } // If I'm sorting by anything but document name, add an additional sort criteria if ($sort_field == "d1.name") { $extra_sort = "d1.revision_number ASC, d1.submission_date ASC"; } else { $extra_sort = "d1.name ASC"; } // sort $query .= " ORDER BY $sort_field $sort_type, $extra_sort"; // Limit by num_per_wg $query .= " LIMIT 0, $num_per_wg"; ////////////////////////////////////////////////////////////////////// // DO THE QUERY ////////////////////////////////////////////////////////////////////// $result = $document_tbl->database->query($query); // no lineborders if showing descriptions $cellspacing = ($show_descriptions == 'yes') ? '0' : '1'; if ($result && mysql_num_rows($result)) { $displayed_count = mysql_num_rows($result); $total_count = ($total_count < $displayed_count) ? $displayed_count : $total_count; print << $workgroup_name   (Showing $displayed_count of $total_count) $name_link # $file_size_link $state_link $submitter_name_link $date_link Action HTML; $class = "odd"; while (list( $id, $name, $description, $location, $submission_date, $file_size, $revision_number, $content_type_id, $icon, $doc_type_name, $state_name, $wg_name, $wg_location, $folder_location, $pid, $pfname, $plname ) = mysql_fetch_array($result)) { $file_size = formatFileSize($file_size); $long_name = urldecode($name); $submitter_name = "$pfname $plname"; if (!trim($submitter_name)) { $submitter_name = "Person $pid"; } $submission_date_string = date("Y-m-d", strtotime($submission_date)); $tip_name = $document->formatTipText($long_name, $location, $description); $encoded_name = $document->encodeName($long_name); // JTK // Let the reverse proxy take care of delivering the file. $download_url = "/committees/download.php/$id/$encoded_name"; // List them out. print <<
*  $long_name
$revision_number
$file_size
$state_name
$submitter_name
$submission_date_string
Details
HTML; if ($show_descriptions && !empty($description)) { print "
$description
"; } // Alternate TD classes $class = ($class == 'even') ? 'odd' : 'even'; ++$num_docs_listed; } if (!$num_docs_listed) { print "Sorry, no documents matched your search criteria."; } print ""; print "
"; } if ($result) { mysql_free_result($result); } } } include_remote_footer($footer, 'workgroup');