function _adminPage_UpdateLinkType($group_id, $link_type_id)
 {
     global $HTML, $Language;
     if (isset($link_type_id)) {
         $db_res = db_query("SELECT link_type_id, group_id, name,\n                reverse_name, description, uri_plus\n                FROM plugin_projectlinks_link_type\n                WHERE ((group_id = " . db_ei($group_id) . ")\n                    AND (link_type_id = " . db_ei($link_type_id) . "));");
         if (db_numrows($db_res) != 1) {
             exit_error("invalid data", "2.2");
             // unexpected - no i18l
         }
         $row = db_fetch_array($db_res);
         $def = array('name' => htmlentities($row['name']), 'reverse_name' => htmlentities($row['reverse_name']), 'description' => htmlentities($row['description']), 'uri_plus' => htmlentities($row['uri_plus']));
     } else {
         $def = array('name' => "", 'reverse_name' => "", 'description' => "", 'uri_plus' => '/projects/$projname/');
     }
     $HTML->box1_top($Language->getText('plugin_plinks', 'project_links') . " " . $this->_icon('main') . " " . $Language->getText('plugin_plinks', 'link_type_update'));
     print mkAH("[" . $Language->getText('global', 'btn_cancel') . "]", $this->_adminURI() . "?group_id={$group_id}");
     print "<hr>\n";
     print "<table><tr><td>\n";
     $HTML->box1_top("");
     form_Start("");
     form_HiddenParams(array("func" => 'pl_type_update', "group_id" => $group_id));
     if (isset($link_type_id)) {
         form_HiddenParams(array("link_type_id" => $link_type_id));
     }
     form_GenTextBox("name", htmlentities($Language->getText('plugin_plinks', 'dbfn_name')), $def['name'], 20);
     form_Validation("name", FORM_VAL_IS_NOT_ZERO_LENGTH);
     form_NewRow();
     form_GenTextBox("reverse_name", htmlentities($Language->getText('plugin_plinks', 'dbfn_reverse_name')), $def['reverse_name'], 20);
     form_NewRow();
     form_GenTextArea("description", htmlentities($Language->getText('plugin_plinks', 'dbfn_description')), $def['description']);
     /** **1 commented out for now - until we can decide how to deal with project links functionality
         form_NewRow();
         form_GenTextBox("uri_plus",
         htmlentities($Language->getText('plugin_plinks', 'dbfn_uri_plus')),
         $def['uri_plus'], 85);
         form_Validation("uri_plus", FORM_VAL_IS_NOT_ZERO_LENGTH);
         **/
     foreach (array("uri_plus", "name", "reverse_name", "description") as $ref) {
         $formRefs[$ref] = form_JS_ElementRef($ref) . ".value";
     }
     form_End();
     $HTML->box1_bottom();
     print "</td><td>\n";
     $HTML->box1_top($Language->getText('plugin_plinks', 'set_to_defaults'));
     print "<div style='padding: 5px; border: solid thin;\n            vertical-align: middle;'>";
     print $Language->getText('plugin_plinks', 'replace_form_details') . ":<p>";
     form_genJSButton($Language->getText('plugin_plinks', 'def_sp_name'), "if (confirm('" . $Language->getText('plugin_plinks', 'replace_form_details') . "?')){" . $formRefs["name"] . "='" . $Language->getText('plugin_plinks', 'def_sp_name') . "';" . $formRefs["reverse_name"] . "='" . $Language->getText('plugin_plinks', 'def_sp_rname') . "';" . $formRefs["description"] . "='" . $Language->getText('plugin_plinks', 'def_sp_desc') . "';" . "}");
     print "<p>";
     form_genJSButton($Language->getText('plugin_plinks', 'def_rp_name'), "if (confirm('" . $Language->getText('plugin_plinks', 'replace_form_details') . "?')){" . $formRefs["name"] . "='" . $Language->getText('plugin_plinks', 'def_rp_name') . "';" . $formRefs["reverse_name"] . "='" . $Language->getText('plugin_plinks', 'def_rp_rname') . "';" . $formRefs["description"] . "='" . $Language->getText('plugin_plinks', 'def_rp_desc') . "';" . "}");
     print "</div><p>";
     /** **1 commented out for now - until we can decide how to deal with project links functionality
         print "<div style='padding: 5px; border: solid thin;
         vertical-align: middle;'>";
         form_genJSButton($Language->getText('plugin_plinks', 'def_link_summary'),
         $formRefs["uri_plus"]."='/projects/\$projname/';");
         print "<p>";
         form_genJSButton($Language->getText('plugin_plinks', 'def_link_doc'),
         $formRefs["uri_plus"]."='/plugins/docman/?group_id=\$group_id';"
         );
         print "</div>";
         **/
     $HTML->box1_bottom();
     print "</td></tr></table>\n";
     if (isset($link_type_id)) {
         // Display list of linked projects
         $HTML->box1_top('Projects linked');
         print $this->_admin_links_table($link_type_id);
         // Admin can add new link
         print '<form name="plugin_projectlinks_add_link" method="post" action="?func=pl_link_update">';
         print '<input type="hidden" name="link_type_id" value="' . $link_type_id . '" />';
         print '<input type="hidden" name="group_id" value="' . $group_id . '" />';
         print '<input type="hidden" name="disp" value="edit_link_type" />';
         print '<p><label for="plugin_projectlinks_link_project">' . $GLOBALS['Language']->getText('plugin_plinks', 'add_project') . '</label>';
         print '<input type="text" name="target_group" value="' . $GLOBALS['Language']->getText('plugin_plinks', 'add_project_autocompleter') . '" size="60" id="plugin_projectlinks_link_project" /></p>';
         print '<input type="submit" value="' . $GLOBALS['Language']->getText('global', 'btn_create') . '" />';
         print '</form>';
         $HTML->box1_bottom();
         $HTML->includeFooterJavascriptSnippet("new ProjectAutoCompleter('plugin_projectlinks_link_project', '" . util_get_dir_image_theme() . "', false);");
     }
     $HTML->box1_bottom();
 }
Example #2
0
function form_FocusFirstTextBox()
{
    global $gFormName, $gFirstFormTextBox, $gInForm;
    if (!$gInForm) {
        trigger_error("form_FocusFirstTextBox() outside of form");
    }
    if (strlen($gFirstFormTextBox) > 0) {
        print "<script type='text/javascript' language='javascript'>" . form_JS_ElementRef($gFirstFormTextBox) . ".focus();</script>\n";
    }
}