$title = "Lag lenke"; $form = 'linkage_add'; $focus = 'text'; $per_id = fetch_val("SELECT COUNT(*) + 1 FROM source_linkage WHERE source_fk={$node}"); require "./form_header.php"; echo "<h2>Lag lenke</h2>\n"; echo '<p>' . fetch_val("SELECT source_text FROM sources WHERE source_id={$node}") . "</p>\n"; form_begin($form, $_SERVER['PHP_SELF']); hidden_input('posted', 1); hidden_input('node', $node); // per_id text_input("Lnr.: ", 10, 'per_id', $per_id); // role_fk select_role(); person_id_input(0, 'person_id', 'Person:'); select_surety(); text_input("Navn i kilden: ", 100, 's_name'); textarea_input("Note: ", 5, 100, 'sl_note'); form_submit(); form_end(); echo "<h3>Personer nevnt i kilden:</h3>\n"; list_mentioned($node, 0); echo "</body>\n</html>\n"; } else { $node = $_POST['node']; $note = rtrim($_POST['sl_note']); pg_prepare("query", "INSERT INTO\n source_linkage(\n source_fk,\n per_id,\n role_fk,\n person_fk,\n surety_fk,\n s_name,\n sl_note\n )\n VALUES (\$1, \$2, \$3, \$4, \$5, \$6, \$7)"); pg_execute("query", array($node, $_POST['per_id'], $_POST['role_id'], $_POST['person_id'] ? $_POST['person_id'] : NULL, $_POST['surety'], $_POST['s_name'], $note)); // return to parent node header("Location: {$app_root}/source_manager.php?node={$node}"); }
// full source text echo para(square_brace($props['sort_order']) . conc(square_brace($props['source_date'])) . conc($props['source_txt']) . conc(paren(to_url('./forms/source_edit.php', array('person' => 0, 'source' => $self, 'self' => 1), $_edit)))); // displays feedback from add_source depending on outcome; (not i18n'd yet) // see ddl/functions.sql function add_source() for details $new = isset($_GET['new']) ? $_GET['new'] : 0; if ($new && $new < 0) { $new = abs($new); echo '<p class="alert">Kilden finnes allerede, se nr. [' . to_url($_SERVER['PHP_SELF'], array('node' => $new), $new) . "]!</p>\n"; } // ***************************************************************************** // experimental section: print list of persons mentioned in this source // ***************************************************************************** if ($props['part_type'] == 1) { if (fetch_val("\n \t SELECT COUNT(*) FROM source_linkage WHERE source_fk={$self}")) { echo "<h3>Personer nevnt i kilden:</h3>\n"; list_mentioned($self, 1); } else { echo para(to_url('./forms/linkage_add.php', array('node' => $self), 'Legg til lenke')); } } // ***************************************************************************** // section I: print list of events cited by this source // ***************************************************************************** if ($props['number_of_events']) { echo "<h3>{$_Events}:</h3>\n<ol>"; $handle = pg_query("\n SELECT\n e.event_id,\n e.tag_fk,\n e.event_date,\n get_place_name(e.place_fk) AS event_place,\n link_expand(e.event_note) AS event_note,\n get_event_type(e.event_id) AS event_type\n FROM\n events e,\n event_citations s\n WHERE\n e.event_id = s.event_fk\n AND\n s.source_fk = {$self}\n ORDER BY\n get_event_type(e.event_id),\n e.sort_date,\n e.event_id\n "); while ($row = pg_fetch_assoc($handle)) { $event = $row['event_id']; echo '<li>'; echo square_brace($event) . conc(italic(get_tag_name($row['tag_fk']))) . conc(fuzzydate($row['event_date'])) . conc($row['event_place']); if ($row['event_type'] < 3) {