function _adminPage_ResyncTemplate($group_id, $template_id)
 {
     // re-synchronise project links and types with originating template
     global $HTML, $Language;
     $HTML->box1_top($Language->getText('plugin_plinks', 'project_links') . " " . $this->_icon('main') . " " . $Language->getText('plugin_plinks', 'synchronise_with_template'));
     print mkAH("[" . $Language->getText('global', 'btn_cancel') . "]", $this->_adminURI() . "?group_id={$group_id}");
     // ==== compare link types ====
     print "<hr>\n";
     print "<h2>" . $Language->getText('plugin_plinks', 'sync_type') . "</h2>\n";
     $lt_tmplt = 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($template_id) . ");");
     print html_build_list_table_top(array($Language->getText('plugin_plinks', 'action'), $Language->getText('plugin_plinks', 'dbfn_name'), $Language->getText('plugin_plinks', 'dbfn_reverse_name'), $Language->getText('plugin_plinks', 'dbfn_description'), $Language->getText('plugin_plinks', 'dbfn_uri_plus')), false, false, false);
     //full_width
     $typeMatch = array();
     $cnt = 0;
     while ($ltr_tmplt = db_fetch_array($lt_tmplt)) {
         $cls = "class='" . html_get_alt_row_color($cnt++) . "'";
         print "<tr style=' vertical-align: top;'>\n";
         $diffs = array();
         $rs_grp = db_query("SELECT link_type_id, name, reverse_name,\n                description, uri_plus FROM plugin_projectlinks_link_type\n                WHERE ((group_id = " . db_ei($group_id) . ")\n                    AND (name = '" . db_es($ltr_tmplt['name']) . "')\n                    );");
         $basicURI = $this->_adminURI() . "?disp=resync_template" . "&amp;group_id={$group_id}" . "&amp;template_id={$template_id}" . "&amp;template_type_id={$ltr_tmplt['link_type_id']}";
         if (db_numrows($rs_grp) == 0) {
             // does not exist
             print "<td {$cls} style='text-align: center;\n                        vertical-align: middle;'>" . mkAH($this->_icon("add"), $basicURI . "&amp;func=template_sync_type_add") . "</td>";
         } else {
             // same name - any differences?
             $ltr_grp = db_fetch_array($rs_grp);
             $basicURI .= "&link_type_id={$ltr_grp['link_type_id']}";
             $typeMatch[$ltr_tmplt['link_type_id']] = $ltr_grp['link_type_id'];
             foreach (array('reverse_name', 'description', 'uri_plus') as $param) {
                 if ($ltr_tmplt[$param] != $ltr_grp[$param]) {
                     $diffs[$param] = $ltr_grp[$param];
                 }
             }
             if (count($diffs) > 0) {
                 print "<td {$cls}>";
                 print "<table border='0' cellspacing='0' cellpadding='3'>\n                        <tr><td>" . mkAH($Language->getText('plugin_plinks', 'sync_link_update'), $basicURI . "&name=" . urlencode($ltr_tmplt['name']) . "&reverse_name=" . urlencode($ltr_tmplt['reverse_name']) . "&description=" . urlencode($ltr_tmplt['description']) . "&uri_plus=" . urlencode($ltr_tmplt['uri_plus']) . "&link_type_id=" . urlencode($ltr_grp['link_type_id']) . "&func=pl_type_update") . "</td></tr><tr>" . "<td style='text-align: right;'>" . $this->_icon("arrow-right") . "</td></tr></table>";
                 print "</td>";
             } else {
                 print "<td {$cls} style='text-align: center;\n                        vertical-align: middle;'>" . $this->_icon('matched') . "</td>";
             }
         }
         print "<td {$cls}>";
         if (count($diffs) > 0) {
             print "<table border='0' cellspacing='0' cellpadding='3'>\n                    <tr><td style='white-space: nowrap;'>" . htmlentities($ltr_tmplt['name']) . "&nbsp; &nbsp; &nbsp; " . "<span style='font-style:italic;'>" . $Language->getText('plugin_plinks', 'project') . ":</span></td></tr><tr>\n                    <td style='text-align: right;font-style:italic;'>" . $Language->getText('plugin_plinks', 'sync_link_template') . ":</td></tr></table>";
         } else {
             print htmlentities($ltr_tmplt['name']);
         }
         print "</td>";
         foreach (array('reverse_name', 'description', 'uri_plus') as $param) {
             $style = "";
             if ($param != 'description') {
                 $style .= "white-space: nowrap;";
             }
             if (isset($diffs[$param])) {
                 $style .= " font-weight: bold;";
             }
             print "<td {$cls} style='{$style}'>";
             if (count($diffs) > 0) {
                 print "<table border='0' cellspacing='0' cellpadding='3'>\n                        <tr><td style='{$style}'>";
             }
             if (isset($diffs[$param])) {
                 print nz(htmlentities($diffs[$param]), "&nbsp;");
             } else {
                 print htmlentities($ltr_tmplt[$param]);
             }
             if (count($diffs) > 0) {
                 print "</td></tr><tr><td style='{$style}'>" . nz(htmlentities($ltr_tmplt[$param]), "&nbsp;") . "</td></tr></table>";
             }
             print "</td>";
         }
         print "</tr>\n";
     }
     print "</TABLE>\n";
     // ==== compare link instances ====
     print "<hr>\n";
     print "<h2>" . $Language->getText('plugin_plinks', 'sync_link_new') . "</h2>\n";
     $templLinks = db_query("\n            SELECT plugin_projectlinks_relationship.link_type_id,\n                name AS link_name, type, groups.group_id,\n                group_name, unix_group_name, uri_plus,\n                link_id, creation_date, master_group_id, target_group_id\n            FROM plugin_projectlinks_relationship,\n                plugin_projectlinks_link_type,groups\n            WHERE (plugin_projectlinks_relationship.link_type_id\n                    = plugin_projectlinks_link_type.link_type_id)\n                AND (plugin_projectlinks_relationship.target_group_id\n                    = groups.group_id)\n                AND ((master_group_id = " . db_ei($template_id) . ")\n                    AND (target_group_id <> " . db_ei($group_id) . ")\n                    AND (status = 'A'))\n            ORDER BY name, type, group_name;");
     if (db_numrows($templLinks) > 0) {
         print $Language->getText('plugin_plinks', 'synchronise_clickit', $this->_icon("add"));
         $type_missing = false;
         print html_build_list_table_top(array($Language->getText('plugin_plinks', 'action'), $Language->getText('plugin_plinks', 'dbfn_link_type_id'), $Language->getText('plugin_plinks', 'project')), false, false, false);
         //full_width
         $basicURI = $this->_adminURI() . "?disp=resync_template" . "&amp;func=pl_link_update" . "&amp;group_id={$group_id}" . "&amp;template_id={$template_id}";
         $cnt = 0;
         while ($row_templLinks = db_fetch_array($templLinks)) {
             $cls = "class='" . html_get_alt_row_color($cnt++) . "'";
             print "<tr valign='top'>";
             print "<td {$cls}  style='text-align: center; vertical-align: middle;'>";
             // is there a matching link in the project?
             if (isset($typeMatch[$row_templLinks['link_type_id']])) {
                 // we found a matching type
                 $findlinks = db_query("\n                        SELECT creation_date\n                        FROM plugin_projectlinks_relationship\n                        WHERE ((master_group_id = " . db_ei($group_id) . ")\n                            AND (target_group_id =\n                            " . db_ei($row_templLinks['target_group_id']) . ")\n                            AND (link_type_id =\n                            " . db_ei($typeMatch[$row_templLinks['link_type_id']]) . ")\n                        );");
                 if (db_numrows($findlinks) <= 0) {
                     print mkAH($this->_icon("add"), $basicURI . "&amp;target_group_id=" . $row_templLinks['target_group_id'] . "&amp;link_type_id=" . $typeMatch[$row_templLinks['link_type_id']]);
                 } else {
                     print $this->_icon('matched');
                 }
             } else {
                 $type_missing = true;
                 print $Language->getText('plugin_plinks', 'sync_link_needs_type');
             }
             print "</td>";
             print "<td {$cls}>" . htmlentities($row_templLinks['link_name']) . "</td>";
             print "<td {$cls}>" . htmlentities($row_templLinks['group_name']) . "</td>";
             print "</tr>";
         }
         print "</TABLE>\n";
         if ($type_missing) {
             print "<div style='width: 30em'><hr><i>" . $Language->getText('plugin_plinks', 'sync_link_needs_type') . "</i> " . $Language->getText('plugin_plinks', 'sync_link_new_no_type_explain', array($this->_icon("add"), $Language->getText('plugin_plinks', 'sync_type'))) . "</div>";
         }
     }
     $HTML->box1_bottom();
 }
Example #2
0
function check_not_zero($int)
{
    return nz($int);
}
Example #3
0
function form_genShowBox($Caption, $Value, $UpdateURL = NULL)
{
    //
    // just display the information
    //
    global $gInForm;
    if (!$gInForm) {
        trigger_error("Form item outside form: form_genShowBox()");
    }
    if (strlen($Caption) > 0) {
        print "<td" . FORM_CAPTION_STYLE . ">{$Caption}</td><td>";
    } else {
        print "<td colspan=2>";
    }
    print nz($Value, "&nbsp;");
    if (!is_null($UpdateURL)) {
        print "&nbsp;<span style='font-size: 80%;'" . mkAH("-&gt;&gt;", $UpdateURL) . "</span>";
    }
    print "</td>\n";
}
Example #4
0
function funcDtNullChk($date)
{
    if ($date == "0000-00-00" || nz($date, "") == "") {
        return true;
    }
    if (empty($date)) {
        return true;
    }
    return false;
}