示例#1
0
    } else {
        // Load current values.
        $_POST = array_merge($_POST, $zData);
        if ($zData['statusid'] < STATUS_HIDDEN) {
            $_POST['statusid'] = STATUS_OK;
        }
    }
    $_T->printHeader();
    $_T->printTitle();
    if (GET) {
        print '      To edit an phenotype information entry, please fill out the form below.<BR>' . "\n" . '      <BR>' . "\n\n";
    }
    lovd_errorPrint();
    // Tooltip JS code.
    lovd_includeJS('inc-js-tooltip.php');
    lovd_includeJS('inc-js-custom_links.php');
    // Hardcoded ACTION because when we're publishing, but we get the form on screen (i.e., something is wrong), we want this to be handled as a normal edit.
    print '      <FORM action="' . CURRENT_PATH . '?edit" method="post">' . "\n";
    // Array which will make up the form table.
    $aForm = array_merge($_DATA->getForm(), array(array('', '', 'print', '<INPUT type="submit" value="Edit phenotype information entry">' . ($bSubmit ? '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<INPUT type="submit" value="Cancel" onclick="window.location.href=\'' . lovd_getInstallURL() . 'submit/individual/' . $zData['individualid'] . '\'; return false;" style="border : 1px solid #FF4422;">' : ''))));
    lovd_viewForm($aForm);
    print '</FORM>' . "\n\n";
    $_T->printFooter();
    exit;
}
if (PATH_COUNT == 2 && ctype_digit($_PE[1]) && ACTION == 'delete') {
    // URL: /phenotypes/0000000001?delete
    // Drop specific entry.
    $nID = sprintf('%010d', $_PE[1]);
    define('PAGE_TITLE', 'Delete phenotype #' . $nID);
    define('LOG_EVENT', 'PhenotypeDelete');
示例#2
0
        } else {
            // Because we're sending the data back to the form, I need to unset the password fields!
            unset($_POST['password']);
            // Currently does not have an effect here.
        }
    } else {
        // Default values.
        foreach ($zData as $key => $val) {
            $_POST[$key] = $val;
        }
    }
    $_T->printHeader();
    $_T->printTitle();
    lovd_errorPrint();
    // Tooltip JS code.
    lovd_includeJS('inc-js-tooltip.php');
    // Table.
    print '      <FORM action="' . CURRENT_PATH . '?' . ACTION . '" method="post">' . "\n";
    // Array which will make up the form table.
    $aForm = array_merge($_DATA->getForm(), array(array('', '', 'submit', 'Edit announcement')));
    lovd_viewForm($aForm);
    print '</FORM>' . "\n\n";
    $_T->printFooter();
    exit;
}
if (PATH_COUNT == 2 && ctype_digit($_PE[1]) && ACTION == 'delete') {
    // URL: /announcements/00001?delete
    // Delete a specific announcement.
    $nID = sprintf('%05d', $_PE[1]);
    define('PAGE_TITLE', 'Delete announcement #' . $nID);
    define('LOG_EVENT', 'AnnouncementDelete');
示例#3
0
文件: objects.php 项目: LOVDnl/LOVD3
    function viewList($sViewListID = false, $aColsToSkip = array(), $bNoHistory = false, $bHideNav = false, $bOptions = false, $bOnlyRows = false, $bFindReplace = false)
    {
        // Show a viewlist for the current object.
        // Params:
        // bFindReplace     if true, find & replace option is shown in viewlist options menu.
        // Views list of entries in the database, allowing search.
        global $_DB, $_INI, $_SETT;
        if (!defined('LOG_EVENT')) {
            define('LOG_EVENT', $this->sObject . '::viewList()');
        }
        if (FORMAT == 'text/plain' && !defined('FORMAT_ALLOW_TEXTPLAIN')) {
            die('text/plain not allowed here');
        }
        $bAjax = substr(lovd_getProjectFile(), 0, 6) == '/ajax/';
        // ViewLists need an ID to identify the specific viewList, in case there are a few in one document.
        if (!$sViewListID || !is_string($sViewListID)) {
            $sViewListID = lovd_generateRandomID();
        } else {
            $sViewListID = preg_replace('/[^A-Z0-9._-]+/i', '', $sViewListID);
        }
        if (!is_array($aColsToSkip)) {
            $aColsToSkip = array($aColsToSkip);
        }
        foreach ($this->aColumnsViewList as $sCol => $aCol) {
            if (!$aCol['view'] && !in_array($sCol, $aColsToSkip)) {
                $aColsToSkip[] = $sCol;
            }
        }
        require_once ROOT_PATH . 'inc-lib-viewlist.php';
        // First, check if entries are in the database at all.
        $nTotal = $this->getCount();
        if (!$nTotal && FORMAT == 'text/html') {
            if ($bOnlyRows) {
                die('0');
                // Silent error.
            }
            lovd_showInfoTable('No entries in the database yet!', 'stop');
            return 0;
        }
        // Process search fields (i.e. $_GET['search_...'] values) for viewlist.
        list($WHERE, $HAVING, $aArguments, $aBadSyntaxColumns, $aColTypes) = $this->processViewListSearchArgs($_GET);
        if ($WHERE) {
            $this->aSQLViewList['WHERE'] .= ($this->aSQLViewList['WHERE'] ? ' AND ' : '') . $WHERE;
        }
        if ($HAVING) {
            $this->aSQLViewList['HAVING'] .= ($this->aSQLViewList['HAVING'] ? ' AND ' : '') . $HAVING;
        }
        // SORT: Current settings, also implementing XSS check.
        if (!empty($_GET['order']) && $_GET['order'] === strip_tags($_GET['order'])) {
            $aOrder = explode(',', $_GET['order']);
        } else {
            $aOrder = array('', '');
        }
        // SORT: Verify request and set default.
        if (empty($this->aColumnsViewList[$aOrder[0]]['db'][1])) {
            $aOrder[0] = $this->sSortDefault;
        }
        if ($aOrder[1] != 'ASC' && $aOrder[1] != 'DESC') {
            $aOrder[1] = $this->aColumnsViewList[$aOrder[0]]['db'][1];
        }
        $sSQLOrderBy = $this->aColumnsViewList[$aOrder[0]]['db'][0] . ' ' . $aOrder[1];
        if (in_array($aOrder[0], array('chromosome', 'VariantOnGenome/DNA'))) {
            // 2014-03-07; 3.0-10; We need to find the table alias of the VOG or genes table, because otherwise MySQL fails here ('chromosome' is ambiguous) if both are joined.
            // 2014-04-28; 3.0-10; Prefer the genes table, since it joins to VOG as well, but may not have results which messes up the order.
            $sAlias = '';
            if (preg_match('/' . TABLE_GENES . ' AS ([a-z]+)/i', $this->aSQLViewList['FROM'], $aRegs)) {
                $sAlias = $aRegs[1];
            } elseif (preg_match('/' . TABLE_VARIANTS . ' AS ([a-z]+)/i', $this->aSQLViewList['FROM'], $aRegs)) {
                $sAlias = $aRegs[1];
            }
            $this->aSQLViewList['FROM'] .= ' LEFT OUTER JOIN ' . TABLE_CHROMOSOMES . ' AS chr ON (' . (!$sAlias ? '' : $sAlias . '.') . 'chromosome = chr.name)';
            $sSQLOrderBy = 'chr.sort_id ' . $aOrder[1];
            if ($aOrder[0] == 'VariantOnGenome/DNA') {
                $sSQLOrderBy .= ', position_g_start ' . $aOrder[1] . ', position_g_end ' . $aOrder[1] . ', `VariantOnGenome/DNA` ' . $aOrder[1];
            }
        } elseif ($aOrder[0] == 'VariantOnTranscript/DNA') {
            $sSQLOrderBy = 'position_c_start ' . $aOrder[1] . ', position_c_start_intron ' . $aOrder[1] . ', position_c_end ' . $aOrder[1] . ', position_c_end_intron ' . $aOrder[1] . ', `VariantOnTranscript/DNA` ' . $aOrder[1];
        }
        // At this point, we're not sure if we'll actually use the ORDER BY at all.
        $this->aSQLViewList['ORDER_BY'] = $sSQLOrderBy . (empty($this->aSQLViewList['ORDER_BY']) ? '' : ', ' . $this->aSQLViewList['ORDER_BY']);
        // Only print stuff if we're not in Ajax right now.
        if (!$bAjax && FORMAT == 'text/html') {
            // Keep the URL clean; disable any fields that are not used.
            lovd_includeJS('inc-js-viewlist.php' . (!$bNoHistory ? '' : '?nohistory'));
            lovd_includeJS('inc-js-tooltip.php');
            // Print form; required for sorting and searching.
            // Because we don't want the form to submit itself while we are waiting for the Ajax response, we need to kill the native submit() functionality.
            print '      <FORM action="' . CURRENT_PATH . '" method="get" id="viewlistForm_' . $sViewListID . '" style="margin : 0px;" onsubmit="return false;">' . "\n" . '        <INPUT type="hidden" name="viewlistid" value="' . $sViewListID . '">' . "\n" . '        <INPUT type="hidden" name="object" value="' . $this->sObject . '">' . "\n" . (!isset($this->sObjectID) ? '' : '        <INPUT type="hidden" name="object_id" value="' . $this->sObjectID . '">' . "\n") . (!isset($this->nID) ? '' : '        <INPUT type="hidden" name="id" value="' . $this->nID . '">' . "\n") . (!ACTION ? '' : '        <INPUT type="hidden" name="' . ACTION . '" value="">' . "\n") . '        <INPUT type="hidden" name="order" value="' . implode(',', $aOrder) . '">' . "\n";
            // Skipping (permanently hiding) columns.
            foreach ($aColsToSkip as $sCol) {
                if (array_key_exists($sCol, $this->aColumnsViewList)) {
                    // Internet Explorer refuses to submit input with equal names. If names are different, everything works fine.
                    // Somebody please tell me it's a bug and nobody's logical thinking. Had to include $sCol to make it work.
                    print '        <INPUT type="hidden" name="skip[' . $sCol . ']" value="' . $sCol . '">' . "\n";
                    // Check if we're skipping columns, that do have a search value. If so, it needs to be sent on like this.
                    if (isset($_GET['search_' . $sCol])) {
                        print '        <INPUT type="hidden" name="search_' . $sCol . '" value="' . htmlspecialchars($_GET['search_' . $sCol]) . '">' . "\n";
                    }
                }
            }
            if ($bHideNav) {
                print '        <INPUT type="hidden" name="hidenav" value="true">' . "\n";
            }
            if ($bOptions) {
                print '        <INPUT type="hidden" name="options" value="true">' . "\n";
            }
            print "\n";
        }
        // Make a reference variable of the session for cleaner code.
        $aSessionViewList =& $_SESSION['viewlists'][$sViewListID];
        // To make row ids persist when the viewList is refreshed, we must store the row id in $_SESSION.
        if (!empty($aSessionViewList['row_id'])) {
            $this->sRowID = $aSessionViewList['row_id'];
        } else {
            $aSessionViewList['row_id'] = $this->sRowID;
            // Implies array creation.
        }
        // To make row links persist when the viewList is refreshed, we must store the row link in $_SESSION.
        if (!empty($aSessionViewList['row_link'])) {
            $this->sRowLink = $aSessionViewList['row_link'];
        } else {
            $aSessionViewList['row_link'] = $this->sRowLink;
            // Implies array creation.
        }
        // Process input values regarding find & replace.
        // User clicked preview.
        $bFRPreview = !empty($_GET['FRPreviewClicked_' . $sViewListID]);
        // Selected field name for replace.
        $sFRFieldname = isset($_GET['FRFieldname_' . $sViewListID]) ? $_GET['FRFieldname_' . $sViewListID] : null;
        // Display name of selected field.
        $sFRFieldDisplayname = isset($_GET['FRFieldDisplayname_' . $sViewListID]) ? $_GET['FRFieldDisplayname_' . $sViewListID] : null;
        // Search query for find & replace.
        $sFRSearchValue = isset($_GET['FRSearch_' . $sViewListID]) ? $_GET['FRSearch_' . $sViewListID] : null;
        // Replace value for find & replace.
        $sFRReplaceValue = isset($_GET['FRReplace_' . $sViewListID]) ? $_GET['FRReplace_' . $sViewListID] : null;
        // Type of matching.
        $sFRMatchType = isset($_GET['FRMatchType_' . $sViewListID]) ? $_GET['FRMatchType_' . $sViewListID] : null;
        // Flag stating whether all field content sould be replaced.
        $bFRReplaceAll = !empty($_GET['FRReplaceAll_' . $sViewListID]);
        // Predicted affected row count.
        $nFRRowsAffected = null;
        // Find & replace options parameter.
        $aFROptions = array('sFRMatchType' => $sFRMatchType, 'bFRReplaceAll' => $bFRReplaceAll);
        $nTotal = 0;
        // Overwrites the previous $nTotal.
        if (!count($aBadSyntaxColumns)) {
            // Build argument list.
            $aArgs = array_merge($aArguments['WHERE'], $aArguments['HAVING']);
            if ($bFRPreview) {
                // User clicked 'preview' in Find&Replace form, add F&R changes as a separate
                // column in the query.
                $nFRRowsAffected = $this->previewColumnFindAndReplace($sFRFieldname, $sFRFieldDisplayname, $sFRSearchValue, $sFRReplaceValue, $aArgs, $aFROptions);
            }
            // First find the amount of rows returned. We can use the SQL_CALC_FOUND_ROWS()
            // function, but we'll try to avoid that due to extreme slowness in some cases.
            // getRowCountForViewList() will take care of that.
            // There is talk about a possible race condition using this technique on the mysql_num_rows man page, but I could find no evidence of it's existence on InnoDB tables.
            // Just to be sure, I'm implementing a serializable transaction, which should lock the table between the two SELECT queries to ensure proper results.
            // Last checked 2010-01-25, by Ivo Fokkema.
            $_DB->query('SET TRANSACTION ISOLATION LEVEL SERIALIZABLE');
            $_DB->beginTransaction();
            // For ALL viewlists, we store the number of hits that we get, including the current filters.
            // For large tables, getting a count can take a long time (especially when using SQL_CALC_FOUND_ROWS).
            // ORDER BY is absolutely killing on large result sets.
            // So, long time to retrieve count (>1s) => don't count again, and no sort.
            // Count OK (<=1s), but big result set (250K) => no sort. ($_SETT['lists']['max_sortable_rows'])
            // 1) If we don't have a count in memory, request count separately.
            // Also if last count was >15min ago, request again.
            $bTrueCount = false;
            // Indicates whether or not we are sure about the number of results.
            $sFilterMD5 = md5($WHERE . '||' . $HAVING . '||' . implode('|', $aArgs));
            // A signature for the filters, NOTE that this depends on the column order!
            // FIXME: If this count takes longer than 1s, we don't estimate anymore like we used to (see line 1543).
            if (true || !isset($aSessionViewList['counts'][$sFilterMD5]['n'])) {
                $t = microtime(true);
                // Now, get the total number of hits if no LIMIT was used. Note that $nTotal gets overwritten here.
                $nTotal = $this->getRowCountForViewList($this->aSQLViewList, $aArgs);
                $tQ = microtime(true) - $t;
                $aSessionViewList['counts'][$sFilterMD5]['n'] = $nTotal;
                $aSessionViewList['counts'][$sFilterMD5]['t'] = $tQ;
                $aSessionViewList['counts'][$sFilterMD5]['d'] = time();
                $bTrueCount = true;
            }
            // Manipulate SELECT to include SQL_CALC_FOUND_ROWS.
            $bSQLCALCFOUNDROWS = false;
            // TODO: Remove this block. For now, this will be bypassed because $bTrueCount will always be true.
            if (!$bTrueCount && $_INI['database']['driver'] == 'mysql' && ($aSessionViewList['counts'][$sFilterMD5]['t'] < 1 || $aSessionViewList['counts'][$sFilterMD5]['d'] < time() - 60 * 15)) {
                // But only if we're using MySQL and it takes less than a second to get the correct number of results, or it's been more than 15 minutes since the last check!
                $this->aSQLViewList['SELECT'] = 'SQL_CALC_FOUND_ROWS ' . $this->aSQLViewList['SELECT'];
                $bSQLCALCFOUNDROWS = true;
            }
            if ($bOptions) {
                // If the session variable does not exist, create it!
                if (!isset($aSessionViewList['checked'])) {
                    $aSessionViewList['checked'] = array();
                }
                if (isset($_GET['ids_changed'])) {
                    if ($_GET['ids_changed'] == 'all') {
                        // If the select all button was clicked, fetch all entries and mark them as 'checked' in session.
                        // This query is the same as the viewList query, but without the ORDER BY and LIMIT, so that we can get the full result
                        // of the query.
                        $sSQL = $this->buildSQL(array('SELECT' => $this->aSQLViewList['SELECT'], 'FROM' => $this->aSQLViewList['FROM'], 'WHERE' => $this->aSQLViewList['WHERE'], 'GROUP_BY' => $this->aSQLViewList['GROUP_BY'], 'HAVING' => $this->aSQLViewList['HAVING']));
                        $q = $_DB->query($sSQL, $aArgs);
                        while ($zData = $q->fetchAssoc()) {
                            $zData = $this->generateRowID($zData);
                            // We only need the row_id here for knowing which ones we need to check.
                            // 2015-09-18; 3.0-14; We need to run rawurldecode() or else Columns are not selectable this way.
                            $aSessionViewList['checked'][] = rawurldecode($zData['row_id']);
                        }
                    } elseif ($_GET['ids_changed'] == 'none') {
                        // If the unselect all button was clicked, reset the 'checked' array.
                        $aSessionViewList['checked'] = array();
                    } else {
                        // Get the changed ids and remove them from or add them to the session.
                        $aIDsChanged = explode(';', $_GET['ids_changed']);
                        // Flip the keys & values, so that we can do a simple isset() to see if the id is already present.
                        $aSessionViewList['checked'] = array_flip($aSessionViewList['checked']);
                        // Determine the highest key number, so we can use that later when adding new values to the array.
                        $nIndex = count($aSessionViewList['checked']) ? max($aSessionViewList['checked']) + 1 : 0;
                        foreach ($aIDsChanged as $nID) {
                            if (isset($aSessionViewList['checked'][$nID])) {
                                // ID is found in the array, but is also in the 'ids_changed' array, so remove it!
                                unset($aSessionViewList['checked'][$nID]);
                            } else {
                                // ID is not found in the array, but IS in the 'ids_changed' array, so add it using the $nIndex as value we determined earlier.
                                // Also add 1 to the $nIndex so that the next id that needs to be added will not overwrite this one.
                                $aSessionViewList['checked'][$nID] = ++$nIndex;
                            }
                        }
                        // Flip the array back to its original state.
                        $aSessionViewList['checked'] = array_flip($aSessionViewList['checked']);
                    }
                }
            }
            // ORDER BY will only occur when we estimate we have time for it.
            if ($aSessionViewList['counts'][$sFilterMD5]['t'] < 1 && $aSessionViewList['counts'][$sFilterMD5]['n'] <= $_SETT['lists']['max_sortable_rows']) {
                $bSortableVL = true;
            } else {
                // Not sortable, indicate this on the VL...
                $aOrder = array('', '');
                $bSortableVL = false;
                // 2013-07-03; 3.0-07; However, we do try and sort because in principle, the order is random and this may cause confusion while paginating.
                //   So, as a result we'll try and sort on the PK. We attempt to determine this from the GROUP BY or ID col in the VL columns list.
                $sCol = '';
                if (isset($this->aSQLViewList['GROUP_BY'])) {
                    $sCol = $this->aSQLViewList['GROUP_BY'];
                } elseif ($this->aColumnsViewList['id']) {
                    $sCol = $this->aColumnsViewList['id']['db'][0];
                } elseif ($this->aColumnsViewList['id_']) {
                    $sCol = $this->aColumnsViewList['id_']['db'][0];
                }
                $this->aSQLViewList['ORDER_BY'] = $sCol;
            }
            if (!$bHideNav && FORMAT == 'text/html') {
                // Implement LIMIT only if navigation is not hidden.
                // We have a problem here, because we don't know how many hits there are,
                // because we're using SQL_CALC_FOUND_ROWS which only gives us the number
                // of hits AFTER we run the whole query. This means we should just assume
                // the page number is possible.
                $this->aSQLViewList['LIMIT'] = lovd_pagesplitInit();
                // Function requires variable names $_GET['page'] and $_GET['page_size'].
            }
            $sSQL = $this->buildSQL($this->aSQLViewList);
            // Run the viewList query.
            // FIXME; what if using AJAX? Probably we should generate a number here, if this query fails, telling the system to try once more. If that fails also, the JS should throw a general error, maybe.
            $q = $_DB->query($sSQL, $aArgs);
            // Now, get the total number of hits as if no LIMIT was used (when we have used the proper SELECT syntax). Note that $nTotal gets overwritten here.
            if ($bSQLCALCFOUNDROWS) {
                // FIXME: 't' needs to be recalculated as well!
                $nTotal = $_DB->query('SELECT FOUND_ROWS()')->fetchColumn();
                $aSessionViewList['counts'][$sFilterMD5]['n'] = $nTotal;
                $aSessionViewList['counts'][$sFilterMD5]['d'] = time();
                $bTrueCount = true;
            } else {
                // Estimate the number of results!
                $nTotal = $aSessionViewList['counts'][$sFilterMD5]['n'];
            }
            $_DB->commit();
            // To end the transaction and the locks that come with it.
        } else {
            // Set certain values that are needed for hiding notices, applicable for the "incorrect syntax" error message.
            $bTrueCount = true;
            // Yes, we're sure we have 0 results.
            $bSortableVL = false;
            // Sorting makes no sense when you have no results.
        }
        // If no results are found, try to figure out if it was because of the user's searching or not.
        if (!$nTotal) {
            $bSearched = false;
            $aHiddenSearch = array();
            foreach ($_GET as $key => $value) {
                if (substr($key, 0, 7) == 'search_') {
                    $sColumn = substr($key, 7);
                    if (!in_array($sColumn, $aColsToSkip)) {
                        $bSearched = true;
                    } elseif ($this->aColumnsViewList[$sColumn]['view']) {
                        $sColHeader = $this->aColumnsViewList[$sColumn]['view'][0];
                        // Make sure all hidden ID columns have "ID" in the header, so we can recognize them.
                        if (substr(rtrim($sColumn, '_'), -2) == 'id' && substr($sColHeader, -3) != ' ID') {
                            $sColHeader .= ' ID';
                        }
                        $aHiddenSearch[$sColHeader] = $value;
                    }
                }
            }
        }
        // FIXME; this is a temporary hack just to get the genes?authorize working when all users have been selected.
        //   There is no longer a viewList when all users have been selected, but we need one for the JS execution.
        //   Possibly, this code can be standardized a bit and, if necessary for other viewLists as well, can be kept here.
        if (!$nTotal && !$bSearched && ($this->sObject == 'User' && !empty($_GET['search_id']))) {
            // FIXME; Maybe check for JS contents of the rowlink?
            // There has been searched, but apparently the ID column is forced hidden. This must be the authorize page.
            $bSearched = true;
            // This will trigger the creation of the viewList table.
        }
        if (FORMAT == 'text/html' && ($nTotal || $bSearched)) {
            // Only print stuff if we're not just loading one entry right now.
            if (!$bOnlyRows) {
                if (!$bAjax) {
                    print '      <DIV id="viewlistDiv_' . $sViewListID . '">' . "\n";
                    // These contents will be replaced by Ajax.
                }
                // If we have a legend, create a hidden DIV that will be used for the full legend.
                print '      <DIV id="viewlistLegend_' . $sViewListID . '" title="Legend" style="display : none;">' . "\n" . '        <H2 class="LOVD">Legend</H2>' . "\n\n" . '        <I class="S11">Please note that a short description of a certain column can be displayed when you move your mouse cursor over the column\'s header and hold it still. Below, a more detailed description is shown per column.</I><BR><BR>' . "\n\n";
                $bLegend = false;
                // We need to check if we have a legend at all.
                foreach ($this->aColumnsViewList as $sField => $aCol) {
                    if (!empty($aCol['legend'])) {
                        $bLegend = true;
                        if (empty($aCol['legend'][1])) {
                            $aCol['legend'][1] = $aCol['legend'][0];
                        }
                        print '        <B>' . $aCol['view'][0] . '</B>: ' . $aCol['legend'][1];
                        if (substr($aCol['legend'][1], -5) == '</UL>') {
                            // No additional breaks, no possible listing of selection options. Column has its own UL already.
                            print "\n\n";
                            continue;
                        }
                        if (isset($this->aColumns[$sField]) && $this->aColumns[$sField]['form_type'][2] == 'select') {
                            // This is a custom column and it has a selection list with options. List the options below.
                            print '<BR>' . "\n" . '        All options:' . "\n" . '        <UL style="margin-top : 0px;">' . "\n";
                            foreach ($this->aColumns[$sField]['select_options'] as $sOption) {
                                print '          <LI>' . $sOption . '</LI>' . "\n";
                            }
                            print '      </UL>' . "\n\n";
                        } else {
                            print '<BR><BR>' . "\n\n";
                        }
                    }
                }
                print '      </DIV>' . "\n\n";
                if (!$bHideNav) {
                    lovd_pagesplitShowNav($sViewListID, $nTotal, $bTrueCount, $bSortableVL, $bLegend);
                }
                // 'checked' attribute values for find & replace menu options.
                $sFRMatchtypeCheck1 = !isset($sFRMatchType) || $sFRMatchType == '1' ? 'checked' : '';
                $sFRMatchtypeCheck2 = $sFRMatchType == '2' ? 'checked' : '';
                $sFRMatchtypeCheck3 = $sFRMatchType == '3' ? 'checked' : '';
                $sFRReplaceAllCheck = $bFRReplaceAll ? 'checked' : '';
                $sFRRowsAffected = !is_null($nFRRowsAffected) ? strval($nFRRowsAffected) : '';
                $sFRFieldname = htmlspecialchars($sFRFieldname);
                $sFRFieldDisplayname = htmlspecialchars($sFRFieldDisplayname);
                $sFRSearchValue = htmlspecialchars($sFRSearchValue);
                $sFRReplaceValue = htmlspecialchars($sFRReplaceValue);
                // Print options menu for find & replace (hidden by default).
                print <<<FROptions
<DIV id="viewlistFRFormContainer_{$sViewListID}" class="fnroptionsmenu" style="display: none;">
    <SPAN><B style="color: red">Note that find &amp; replace is still in BETA. Changes made using this feature are not checked for errors, therefore using find &amp; replace may have destructive consequences.<BR>Make a download or backup of the data you're about to edit. If uncertain, use the edit form of the data entries instead.</B><BR>
        Applying find &amp; replace to column
        &quot;<B id="viewlistFRColDisplay_{$sViewListID}">{$sFRFieldname}</B>&quot;.
        <INPUT id="FRFieldname_{$sViewListID}" type="hidden" name="FRFieldname_{$sViewListID}"
               value="{$sFRFieldname}" />
        <INPUT id="FRFieldDisplayname_{$sViewListID}" type="hidden"
               name="FRFieldDisplayname_{$sViewListID}" value="{$sFRFieldDisplayname}" />
        <INPUT id="FRRowsAffected_{$sViewListID}" type="hidden" value="{$sFRRowsAffected}" />
    </SPAN>
    <BR />
    <TABLE>
        <TR>
            <TD>Text to find</TD>
            <TD>
                <INPUT type="text" name="FRSearch_{$sViewListID}" value="{$sFRSearchValue}"
                       style="width: 110px" />
            </TD>
            <TD>
                <INPUT type="radio" name="FRMatchType_{$sViewListID}" value="1" {$sFRMatchtypeCheck1} />Match anywhere
                <INPUT type="radio" name="FRMatchType_{$sViewListID}" value="2" {$sFRMatchtypeCheck2} />Match at beginning of field
                <INPUT type="radio" name="FRMatchType_{$sViewListID}" value="3" {$sFRMatchtypeCheck3} />Match at end of field
            </TD>
        </TR>
        <TR>
            <TD>Replace with</TD>
            <TD>
                <INPUT type="text" name="FRReplace_{$sViewListID}" value="{$sFRReplaceValue}"
                       style="width: 110px" />
            </TD>
            <TD>
                <INPUT type="checkbox" name="FRReplaceAll_{$sViewListID}" value="1" {$sFRReplaceAllCheck} />Replace everything in field
            </TD>
        </TR>
    </TABLE>
    <INPUT id="FRPreview_{$sViewListID}" type="button" value="Preview" />
    <INPUT id="FRCancel_{$sViewListID}" type="button" value="Cancel" style="border : 1px solid #FF4422;" />
    <DIV id="FRSubmitDiv_{$sViewListID}">
        <BR>
        Enter your password to apply find and replace:<BR> 
        <INPUT type="password" name="password" size="20" />
        <INPUT id="FRSubmit_{$sViewListID}" type="submit" value="Submit" />
    </DIV>
</DIV>
FROptions;
                // Table and search headers (if applicable).
                print '      <TABLE border="0" cellpadding="0" cellspacing="1" class="data" id="viewlistTable_' . $sViewListID . '">' . "\n" . '        <THEAD>' . "\n" . '        <TR>' . ($bOptions ? "\n" . '          <TH valign="center" style="text-align:center;">' . "\n" . '            <IMG id="viewlistOptionsButton_' . $sViewListID . '" src="gfx/options.png" width="16" height="16" style="cursor : pointer;"></TH>' : '');
                foreach ($this->aColumnsViewList as $sField => $aCol) {
                    if (in_array($sField, $aColsToSkip)) {
                        continue;
                    }
                    $bSortable = !empty($aCol['db'][1]) && $bSortableVL;
                    // If we can't sort at all, nothing is sortable.
                    $bSearchable = !empty($aCol['db'][2]);
                    $nAllowFindAndReplace = (int) (!empty($aCol['allowfnr']));
                    // Later allow other columns as well, such as owned_by or statusid or so.
                    $sImg = '';
                    $sAlt = '';
                    if ($bSortable && $aOrder[0] == $sField) {
                        $sImg = $aOrder[1] == 'DESC' ? '_desc' : '_asc';
                        $sAlt = $aOrder[1] == 'DESC' ? 'Descending' : 'Ascending';
                    }
                    print "\n" . '          <TH valign="top"' . ($bSortable ? ' class="order' . ($aOrder[0] == $sField ? 'ed' : '') . '"' : '') . (empty($aCol['legend'][0]) ? '' : ' title="' . htmlspecialchars($aCol['legend'][0]) . '"') . ' data-allowfnr="' . $nAllowFindAndReplace . '" data-fieldname="' . $sField . '">' . "\n" . '            <IMG src="gfx/trans.png" alt="" width="' . $aCol['view'][1] . '" height="1" id="viewlistTable_' . $sViewListID . '_colwidth_' . $sField . '"><BR>' . (!$bSortable ? str_replace(' ', '&nbsp;', $aCol['view'][0]) . '<BR>' : "\n" . '            <DIV onclick="document.forms[\'viewlistForm_' . $sViewListID . '\'].order.value=\'' . $sField . ',' . ($aOrder[0] == $sField ? $aOrder[1] == 'ASC' ? 'DESC' : 'ASC' : $aCol['db'][1]) . '\'; if (document.forms[\'viewlistForm_' . $sViewListID . '\'].page) { document.forms[\'viewlistForm_' . $sViewListID . '\'].page.value=1; } lovd_AJAX_viewListSubmit(\'' . $sViewListID . '\');" style="position : relative;">' . "\n" . '              <IMG src="gfx/order_arrow' . $sImg . '.png" alt="' . $sAlt . '" title="' . $sAlt . '" width="13" height="12" style="position : absolute; top : 2px; right : 0px;">' . str_replace(' ', '&nbsp;', $aCol['view'][0]) . '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</DIV>') . (!$bSearchable ? '' : "\n" . '            <INPUT type="text" name="search_' . $sField . '" value="' . (!isset($_GET['search_' . $sField]) ? '' : htmlspecialchars($_GET['search_' . $sField])) . '" title="' . $aCol['view'][0] . ' field should contain...' . (!empty($_GET['search_' . $sField]) ? "\nCurrent search:\n\n" . htmlspecialchars(lovd_formatSearchExpression($_GET['search_' . $sField], $aColTypes[$sField])) : '') . '" style="width : ' . ($aCol['view'][1] - 6) . 'px; font-weight : normal;" onkeydown="if (event.keyCode == 13) { if (document.forms[\'viewlistForm_' . $sViewListID . '\'].page) { document.forms[\'viewlistForm_' . $sViewListID . '\'].page.value=1; } setTimeout(\'lovd_AJAX_viewListSubmit(\\\'' . $sViewListID . '\\\')\', 0); return false;}">') . '</TH>';
                }
                print '</TR></THEAD>';
            }
        } elseif (FORMAT == 'text/plain') {
            // Download format: show headers.
            $sObject = $this->sObject == 'Custom_ViewList' ? $this->sObjectID : $this->sObject . 's';
            header('Content-type: text/plain; charset=UTF-8');
            header('Content-Disposition: attachment; filename="LOVD_' . $sObject . '_' . date('Y-m-d_H.i.s') . '.txt"');
            header('Pragma: public');
            print '### LOVD-version ' . lovd_calculateVersion($_SETT['system']['version']) . ' ### ' . $sObject . ' Quick Download format ### This file can not be imported ###' . "\r\n";
            // FIXME: this has to be done better, we can't see what we're filtering for, because it's in the arguments!
            $sFilter = $WHERE . ($WHERE && $HAVING ? ' AND ' : '') . $HAVING;
            if ($sFilter) {
                if (count($aArgs) == substr_count($sFilter, '?')) {
                    foreach ($aArgs as $sArg) {
                        $sFilter = preg_replace('/\\?/', ctype_digit($sArg) ? $sArg : '"' . $sArg . '"', $sFilter, 1);
                    }
                }
                print '## Filter: ' . $sFilter . "\r\n";
            }
            if (ACTION == 'downloadSelected') {
                print '## Filter: selected = ' . implode(',', $aSessionViewList['checked']) . "\r\n";
            }
            print '# charset=UTF-8' . "\r\n";
            $i = 0;
            foreach ($this->aColumnsViewList as $sField => $aCol) {
                if (in_array($sField, $aColsToSkip)) {
                    continue;
                }
                print ($i++ ? "\t" : '') . '"{{' . $sField . '}}"';
            }
            print "\r\n";
        }
        if (!$nTotal && FORMAT == 'text/html') {
            if ($bSearched) {
                // Searched, but no results. FIXME: link to the proper documentation entry about search expressions
                $sBadSyntaxColumns = implode(', ', array_unique($aBadSyntaxColumns));
                // FIXME; use an IF here.
                $sMessageNormal = 'No results have been found that match your criteria.<BR>Please redefine your search criteria.';
                $sMessageBadSyntax = 'Your search column' . (count($aBadSyntaxColumns) > 1 ? 's contain' : ' contains') . ' incorrect search expression syntax at: ' . $sBadSyntaxColumns . '.';
                $sMessage = empty($aBadSyntaxColumns) ? $sMessageNormal : $sMessageBadSyntax;
                if ($bOnlyRows) {
                    die('0');
                    // Silent error.
                }
                // FIXME; This code is sort of duplicated, some 100 lines below we also print this, *if* results are found.
                print '</TABLE><BR>' . "\n";
                // <BR> is necessary to keep the InfoTable apart from the data headers.
                if (!$bHideNav) {
                    print '        <INPUT type="hidden" name="total" value="' . $nTotal . '" disabled>' . "\n" . '        <INPUT type="hidden" name="page_size" value="' . $_GET['page_size'] . '">' . "\n" . '        <INPUT type="hidden" name="page" value="' . $_GET['page'] . '">' . "\n";
                }
                lovd_showInfoTable($sMessage, 'stop');
                print '      </DIV></FORM>' . "\n\n";
            } else {
                if ($bOnlyRows) {
                    die('0');
                    // Silent error.
                }
                print '      <DIV id="viewlistDiv_' . $sViewListID . '">' . "\n";
                // These contents will be replaced by Ajax.
                if (substr($this->sObject, -7) == 'Variant') {
                    $sUnit = 'variants' . (substr($this->sObject, 0, 10) == 'Transcript' ? ' on transcripts' : '');
                } elseif ($this->sObject == 'Custom_Viewlist') {
                    $sUnit = 'entries';
                } elseif ($this->sObject == 'Shared_Column') {
                    $sUnit = 'active columns';
                } else {
                    $sUnit = strtolower($this->sObject) . 's';
                }
                $sMessage = 'No ' . $sUnit . ' found';
                if (!empty($aHiddenSearch)) {
                    $sWhere = '';
                    foreach ($aHiddenSearch as $sCol => $sValue) {
                        // If the hidden column has "ID" in its name, it is the primary filter column.
                        if (substr($sCol, -3) == ' ID') {
                            $sWhere .= ($sWhere ? ' and ' : ' ') . 'for this ' . strtolower(substr($sCol, 0, -3));
                        } else {
                            $sWhere .= ($sWhere ? ' and ' : ' where ') . strtolower($sCol) . ' is "' . str_replace('|', '" or "', trim($sValue, '="') . '"');
                        }
                    }
                    $sMessage .= $sWhere;
                }
                lovd_showInfoTable($sMessage . '!', 'stop');
                print '      </DIV></FORM>' . "\n\n";
                return 0;
            }
        }
        // Now loop through the data and print. But check for $q to be set; if we had a bad search syntax, we end up here as well, but without an $q.
        while (isset($q) && $nTotal && ($zData = $q->fetchAssoc())) {
            // If row_id is not given by the database, but it should be created according to some format ($this->sRowID), put the data's ID in this format.
            $zData = $this->generateRowID($zData);
            // If row_link is not given by the database, but it should be created according to some format ($this->sRowLink), put the data's ID and the viewList's ID in this format.
            if (!isset($zData['row_link'])) {
                if ($this->sRowLink !== '' && $zData['row_id']) {
                    $zData['row_link'] = str_replace(array('{{ID}}', '{{ViewListID}}'), array(rawurlencode($zData['row_id']), $sViewListID), $this->sRowLink);
                    //$zData['row_link'] = preg_replace('/\{\{zData_(\w)+\}\}/', rawurlencode("$1"), $zData['row_link']);
                    //$zData['row_link'] = preg_replace_callback('/\{\{zData_(\w+)\}\}/', create_function('$aRegs', 'global $zData; return rawurlencode($zData[$aRegs[1]]);'), $zData['row_link']);
                    // FIXME; sorry, couldn't figure out how to do this in one line. Suggestions are welcome.
                    foreach ($zData as $key => $val) {
                        // Also allow data from $zData to be put into the row link & row id.
                        // FIXME; This is a temporary ugly solution, so we need to fix this later!!!!
                        $zData['row_link'] = preg_replace('/\\{\\{' . preg_quote($key, '/') . '\\}\\}/', rawurlencode($val), $zData['row_link']);
                        $zData['row_link'] = preg_replace('/\\{\\{zData_' . preg_quote($key, '/') . '\\}\\}/', rawurlencode($val), $zData['row_link']);
                    }
                } else {
                    $zData['row_link'] = '';
                }
            }
            $zData = $this->autoExplode($zData);
            // Only the CustomViewList object has this 3rd argument, but other objects' prepareData()
            // don't complain when called with this 3 argument they didn't define.
            $zData = $this->prepareData($zData, 'list', $sViewListID);
            if (FORMAT == 'text/html') {
                // FIXME; rawurldecode() in the line below should have a better solution.
                // IE (who else) refuses to respect the BASE href tag when using JS. So we have no other option than to include the full path here.
                print "\n" . '        <TR class="' . (empty($zData['class_name']) ? 'data' : $zData['class_name']) . '"' . (!$zData['row_id'] ? '' : ' id="' . $zData['row_id'] . '"') . ' valign="top"' . (!$zData['row_link'] ? '' : ' style="cursor : pointer;"') . (!$zData['row_link'] ? '' : ' onclick="' . (substr($zData['row_link'], 0, 11) == 'javascript:' ? rawurldecode(substr($zData['row_link'], 11)) : 'window.location.href = \'' . lovd_getInstallURL(false) . $zData['row_link'] . '\';') . '"') . '>';
                if ($bOptions) {
                    print "\n" . '          <TD align="center" class="checkbox" onclick="cancelParentEvent(event);"><INPUT id="check_' . $zData['row_id'] . '" class="checkbox" type="checkbox" name="check_' . $zData['row_id'] . '" onclick="lovd_recordCheckChanges(this, \'' . $sViewListID . '\');"' . (in_array($zData['row_id'], $aSessionViewList['checked']) ? ' checked' : '') . '></TD>';
                }
                foreach ($this->aColumnsViewList as $sField => $aCol) {
                    if (in_array($sField, $aColsToSkip)) {
                        continue;
                    }
                    print "\n" . '          <TD' . (!empty($aCol['view'][2]) ? ' ' . $aCol['view'][2] : '') . ($aOrder[0] == $sField ? ' class="ordered"' : '') . '>' . ($zData[$sField] === '' ? '-' : $zData[$sField]) . '</TD>';
                }
                print '</TR>';
            } elseif (FORMAT == 'text/plain') {
                // Download format: print contents.
                if (ACTION == 'downloadSelected' && !in_array($zData['row_id'], $aSessionViewList['checked'])) {
                    // Only selected entries should be downloaded. And this one is not selected.
                    continue;
                }
                $i = 0;
                foreach ($this->aColumnsViewList as $sField => $aCol) {
                    if (in_array($sField, $aColsToSkip)) {
                        continue;
                    }
                    print ($i++ ? "\t" : '') . '"' . str_replace(array("\r\n", "\r", "\n"), array('\\r\\n', '\\r', '\\n'), addslashes(html_entity_decode(strip_tags($zData[$sField])))) . '"';
                }
                print "\r\n";
            }
        }
        // Only print stuff if we're not just loading one entry right now.
        if ($nTotal && !$bOnlyRows && FORMAT == 'text/html') {
            print '</TABLE>' . "\n";
            if (!$bHideNav) {
                print '        <INPUT type="hidden" name="total" value="' . $nTotal . '" disabled>' . "\n" . '        <INPUT type="hidden" name="page_size" value="' . $_GET['page_size'] . '">' . "\n" . '        <INPUT type="hidden" name="page" value="' . $_GET['page'] . '">' . "\n\n";
                lovd_pagesplitShowNav($sViewListID, $nTotal, $bTrueCount, $bSortableVL, $bLegend);
            }
            if (!$bAjax) {
                print '      </DIV></FORM><BR>' . "\n";
                // These contents will be replaced by Ajax.
            }
        }
        if (!$bAjax && FORMAT == 'text/html') {
            // If sent using Ajax, the browser is not going to evaluate this code, anyways.
            print '      <SCRIPT type="text/javascript">' . "\n" . '        // This has to be run when the document has finished loading everything, because only then can it get the proper width from IE7 and lower!' . "\n" . '        $( function () {lovd_stretchInputs(\'' . $sViewListID . '\');});' . "\n";
            if ($bOptions) {
                $sFRMenuOption = '';
                if ($bFindReplace) {
                    // Add find & replace menu item to viewlist options menu.
                    $sFRMenuOption = <<<FRITEM
'            <LI class="icon">' +
'                <A click="lovd_FRColumnSelector(\\'{$sViewListID}\\');">' +
'                    <SPAN class="icon" style=""></SPAN>' +
'                    Find and replace text in column' +
'                </A>' +
'            </LI>' +
FRITEM;
                }
                print <<<OPMENU
        // If menu's UL doesn't exist yet, create it.
        if (\$('#viewlistMenu_{$sViewListID}').attr('id') == undefined) {
          var oUL = window.document.createElement('ul');
          oUL.setAttribute('id', 'viewlistMenu_{$sViewListID}');
          oUL.className = 'jeegoocontext jeegooviewlist';
          window.document.body.appendChild(oUL);
        }
        // Fix the top border that could not be set through jeegoo's style.css.
        \$('#viewlistMenu_{$sViewListID}').attr('style', 'border-top : 1px solid #000;');
        \$('#viewlistMenu_{$sViewListID}').prepend(
'            <LI class="icon">' +
'                <A click="check_list[\\'{$sViewListID}\\'] = \\'all\\'; lovd_AJAX_viewListSubmit(\\'{$sViewListID}\\');">' +
'                    <SPAN class="icon" style="background-image: url(gfx/check.png);"></SPAN>' +
'                    Select all <SPAN>entries</SPAN>' +
'                </A>' +
'            </LI>' +
'            <LI class="icon">' +
'                <A click="check_list[\\'{$sViewListID}\\'] = \\'none\\'; lovd_AJAX_viewListSubmit(\\'{$sViewListID}\\');">' +
'                    <SPAN class="icon" style="background-image: url(gfx/cross.png);"></SPAN>' +
'                    Unselect all' +
'                </A>' +
'            </LI>' +
{$sFRMenuOption}
'            ');
        \$('#viewlistMenu_{$sViewListID}').append(
'            <LI class="icon">' +
'                <A click="lovd_AJAX_viewListSubmit(\\'{$sViewListID}\\', function(){lovd_AJAX_viewListDownload(\\'{$sViewListID}\\', true);});">' +
'                    <SPAN class="icon" style="background-image: url(gfx/menu_save.png);"></SPAN>' +
'                    Download all entries (summary data)' +
'                </A>' +
'            </LI>' +
'            <LI class="icon">' +
'                <A click="lovd_AJAX_viewListSubmit(\\'{$sViewListID}\\', function(){lovd_AJAX_viewListDownload(\\'{$sViewListID}\\', false);});">' +
'                    <SPAN class="icon" style="background-image: url(gfx/menu_save.png);"></SPAN>' +
'                    Download selected entries (summary data)' +
'                </A>' +
'            </LI>');
        lovd_activateMenu('{$sViewListID}');
OPMENU;
            }
            print '        check_list[\'' . $sViewListID . '\'] = [];' . "\n" . '      </SCRIPT>' . "\n\n";
        }
        return $nTotal;
    }
示例#4
0
文件: template.php 项目: LOVDnl/LOVD3
    function printHeaderHTML($bFull = true)
    {
        // Print the LOVD header, including the menu (if $bFull == true).
        global $_AUTH, $_CONF, $_DB, $_SETT, $_STAT;
        // Build menu, if tabs are shown.
        if ($bFull) {
            $this->buildMenu();
        }
        ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
        "http://www.w3.org/TR/html4/loose.dtd">
<HTML lang="en_US">
<HEAD>
  <TITLE><?php 
        echo (!defined('PAGE_TITLE') ? '' : PAGE_TITLE . ' - ') . $_CONF['system_title'];
        ?>
</TITLE>
  <META http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <META name="author" content="LOVD development team, LUMC, Netherlands">
  <META name="generator" content="gPHPEdit / GIMP @ GNU/Linux (Ubuntu)">
  <BASE href="<?php 
        echo lovd_getInstallURL();
        ?>
">
  <LINK rel="stylesheet" type="text/css" href="styles.css">
  <LINK rel="stylesheet" type="text/css" href="lib/jeegoocontext/style.css">
  <LINK rel="shortcut icon" href="favicon.ico" type="image/x-icon">

<?php 
        // FIXME; later?
        /*  <LINK rel="alternate" type="application/atom+xml" title="<?php echo $_CONF['system_title']; ?> Atom 1.0 feed" href="<?php echo ROOT_PATH; ?>api/feed.php" />*/
        lovd_includeJS('inc-js-openwindow.php', 1);
        lovd_includeJS('inc-js-toggle-visibility.js', 1);
        // Used on forms and variant overviews for small info tables.
        lovd_includeJS('lib/jQuery/jquery.min.js', 1);
        lovd_includeJS('lib/jQuery/jquery-ui.custom.min.js', 1);
        lovd_includeJS('lib/jeegoocontext/jquery.jeegoocontext.min.js', 1);
        if (!$bFull) {
            ?>
</HEAD>

<BODY style="margin : 10px;">

<TABLE border="0" cellpadding="0" cellspacing="0" width="100%">
  <TR>
    <TD>










<?php 
            return true;
        }
        $sCurrSymbol = $sCurrGene = '';
        if (!empty($_SESSION['currdb'])) {
            // FIXME; Currently we don't support "=GENE" matching (for instance, on the disease tab) because changing that value will not trigger a change in CURRDB... Yet.
            $sGeneSwitchURL = preg_replace('/(\\/)' . preg_quote($_SESSION['currdb'], '/') . '\\b/', "\$1{{GENE}}", $_SERVER['REQUEST_URI']);
            // Just use currently selected database.
            $sCurrSymbol = $_SESSION['currdb'];
            $sCurrGene = $_SETT['currdb']['name'];
        }
        // FIXME; how will we handle this? (if we'll handle this)
        // During submission, show the gene we're submitting to instead of the currently selected gene.
        //if (lovd_getProjectFile() == '/submit.php' && !empty($_POST['gene']) && $_POST['gene'] != $_SESSION['currdb']) {
        //    // Fetch gene's info from db... we don't have it anywhere yet.
        //    list($sCurrSymbol, $sCurrGene) = $_DB->query('SELECT id, gene FROM ' . TABLE_DBS . ' WHERE id = ?', array($_POST['gene']))->fetchRow();
        //}
        ?>

  <SCRIPT type="text/javascript">
    var geneSwitcher = '';

    function lovd_switchGene()
    {
        // Fetches the gene switcher data from LOVD. Might be a form with a
        // dropdown, or a form with a text field for autocomplete.
        $.get('ajax/get_gene_switcher.php', function (sData, sStatus)
        {
            geneSwitcher = sData;
            if (geneSwitcher === '<?php 
        echo AJAX_DATA_ERROR;
        ?>
') {
                alert('Error when retrieving a list of genes');
                return;
            }
            $('#gene_name').hide();

            $('#gene_switcher').html(geneSwitcher['html']);
            if (geneSwitcher['switchType'] === 'autocomplete') {
                $('#select_gene_autocomplete').autocomplete({
                    source: geneSwitcher['data'],
                    minLength: 3
                }).on('autocompleteselect', function (e, ui) { $(this).val(ui['item']['value']); $(this).parent().parent().submit(); }); // Auto submit on selecting the gene from the list.
                // And set focus to the field, too.
                $('#select_gene_autocomplete').focus();
            }
        },'json'
        ).fail(function (sData, sStatus)
        {
            alert('Error when retrieving a list of genes: ' + sStatus);
        });
    }

    function lovd_changeURL ()
    {
        // Replaces the gene in the current URL with the one selected.
        var sURL = '<?php 
        if (!empty($_SESSION['currdb'])) {
            echo $sGeneSwitchURL;
        }
        ?>
';
        // FIXME; It is very very difficult to keep the hash, it should be selective since otherwise you might be loading the EXACT SAME VL, BUT ON A DIFFERENT PAGE (viewing variants belonging to gene X, on a page that says you're looking at gene Y).
        if (geneSwitcher['switchType'] === 'autocomplete') {
            document.location.href = sURL.replace('{{GENE}}', $('#select_gene_autocomplete').val());
        } else {
            document.location.href = sURL.replace('{{GENE}}', $('#select_gene_dropdown').val());
        }
    }

  </SCRIPT>
  <LINK rel="stylesheet" type="text/css" href="lib/jQuery/css/cupertino/jquery-ui.custom.css">
</HEAD>

<BODY style="margin : 0px;">

<?php 
        // Check for announcements. Ignore errors, in case the table doesn't exist yet.
        $qAnnouncements = @$_DB->query('SELECT id, type, announcement FROM ' . TABLE_ANNOUNCEMENTS . ' WHERE start_date <= NOW() AND end_date >= NOW()', array(), false);
        if ($qAnnouncements) {
            $zAnnouncements = $qAnnouncements->fetchAllAssoc();
        } else {
            $zAnnouncements = array();
        }
        foreach ($zAnnouncements as $zAnnouncement) {
            lovd_showInfoTable($zAnnouncement['announcement'], $zAnnouncement['type'], '100%', !$_AUTH || $_AUTH['level'] < LEVEL_MANAGER ? '' : 'announcements/' . $zAnnouncement['id'], false);
        }
        ?>

<TABLE border="0" cellpadding="0" cellspacing="0" width="100%"><TR><TD>

<TABLE border="0" cellpadding="0" cellspacing="0" width="100%" class="logo" style="position : fixed; z-index : 10">
  <TR>
<?php 
        if (!is_readable(ROOT_PATH . $_CONF['logo_uri'])) {
            $_CONF['logo_uri'] = 'gfx/LOVD3_logo145x50.jpg';
        }
        $aImage = @getimagesize(ROOT_PATH . $_CONF['logo_uri']);
        if (!is_array($aImage)) {
            $aImage = array('130', '50', '', 'width="130" heigth="50"');
        }
        list($nWidth, $nHeight, $sType, $sSize) = $aImage;
        print '    <TD valign="top" width="' . ($nWidth + 20) . '" height="' . ($nHeight + 5) . '">' . "\n" . '      <IMG src="' . $_CONF['logo_uri'] . '" alt="LOVD - Leiden Open Variation Database" ' . $sSize . '>' . "\n" . '    </TD>' . "\n";
        print '    <TD valign="top" style="padding-top : 2px; white-space : nowrap; width : 100%">' . "\n" . '      <H2 style="margin-bottom : 2px;">' . $_CONF['system_title'] . '</H2>';
        if ($sCurrSymbol && $sCurrGene) {
            print '      <H5 id="gene_name" style="display:inline">' . $sCurrGene . ' (' . $sCurrSymbol . ')' . "\n";
            if (strpos($sGeneSwitchURL, '{{GENE}}') !== false) {
                print '        <A href="#" onclick="lovd_switchGene(); return false;">' . "\n" . '          <IMG src="gfx/lovd_genes_switch_inline.png" width="23" height="23" alt="Switch gene" title="Switch gene database" align="top">' . "\n" . '        </A>' . "\n";
            }
            print '      </H5>' . "\n";
        }
        // With an ajax call, the H5 with ID 'gene_switcher' is filled with a dropdown or an autocomplete field.
        // This is done with function lovd_switchGene().
        print '      <H5 id="gene_switcher"></H5>' . "\n" . '    </TD>' . "\n" . '    <TD valign="top" align="right" style="padding-right : 5px; padding-top : 2px; white-space: nowrap; padding-left: 20px;">' . "\n" . '      LOVD v.' . $_STAT['tree'] . ' Build ' . $_STAT['build'] . (!defined('NOT_INSTALLED') ? ' [ <A href="status">Current LOVD status</A> ]' : '') . '<BR>' . "\n";
        if (!(defined('NOT_INSTALLED') || ROOT_PATH == '../' && substr(lovd_getProjectFile(), 0, 9) == '/install/')) {
            if ($_AUTH) {
                print '      <B>Welcome, ' . $_AUTH['name'] . '</B><BR>' . "\n" . '      <A href="users/' . $_AUTH['id'] . '"><B>Your account</B></A> | ' . (false && $_AUTH['level'] == LEVEL_SUBMITTER && $_CONF['allow_submitter_mods'] ? '<A href="variants?search_created_by=' . $_AUTH['id'] . '"><B>Your submissions</B></A> | ' : '') . (!empty($_AUTH['saved_work']['submissions']['individual']) || !empty($_AUTH['saved_work']['submissions']['screening']) ? '<A href="users/' . $_AUTH['id'] . '?submissions"><B>Unfinished submissions</B></A> | ' : '') . '<A href="logout"><B>Log out</B></A>' . "\n";
            } else {
                print '      ' . (!$_CONF['allow_submitter_registration'] || $_CONF['lovd_read_only'] ? '' : '<A href="users?register"><B>Register as submitter</B></A> | ') . '<A href="login"><B>Log in</B></A>' . "\n";
            }
        }
        print '    </TD>' . "\n" . '  </TR>' . "\n" . '</TABLE>' . "\n\n";
        $nTotalTabWidth = 0;
        // Will stretch the page at least this far, so the tabs don't "break" if the window is narrow.
        print '<TABLE border="0" cellpadding="0" cellspacing="0" width="100%" class="logo" style="margin-top:55px;' . (count($this->aMenu) ? '' : ' border-bottom : 2px solid #000000;') . '">' . "\n";
        // Add curator info to header.
        if ($sCurrSymbol && $sCurrGene) {
            $sCurators = '';
            $aCurators = $_DB->query('SELECT u.name, u.email FROM ' . TABLE_USERS . ' AS u LEFT JOIN ' . TABLE_CURATES . ' AS u2g ON (u.id = u2g.userid) WHERE u2g.geneid = ? AND u2g.allow_edit = 1 AND u2g.show_order > 0 ORDER BY u2g.show_order ASC, u.level DESC, u.name ASC', array($sCurrSymbol))->fetchAllAssoc();
            $nCurators = count($aCurators);
            foreach ($aCurators as $i => $z) {
                $i++;
                $sCurators .= ($sCurators ? $i == $nCurators ? ' and ' : ', ' : '') . '<A href="mailto:' . str_replace(array("\r\n", "\r", "\n"), ', ', trim($z['email'])) . '">' . $z['name'] . '</A>';
            }
            if ($sCurators) {
                print '  <TR>' . "\n" . '    <TD width="150">&nbsp;</TD>' . "\n" . '    <TD valign="top" colspan="2" style="padding-bottom : 2px;"><B>Curator' . ($nCurators > 1 ? 's' : '') . ': ' . $sCurators . '</B></TD>' . "\n" . '  </TR>' . "\n";
            }
        }
        // Build menu tabs...
        print '  <TR>' . "\n" . '    <TD align="left" colspan="2" style="background : url(\'gfx/tab_fill.png\'); background-repeat : repeat-x;">' . "\n";
        // Loop menu.
        $n = 0;
        $bPrevSel = false;
        $aMenus = array();
        $bCurator = $_AUTH && (count($_AUTH['curates']) || $_AUTH['level'] > LEVEL_CURATOR);
        // We can't check LEVEL_CURATOR since it may not be set.
        foreach ($this->aMenu as $sPrefix => $Title) {
            // Arrays (children links of parent tabs) can only be processed if we still have the $sFile from the previous run.
            if (is_array($Title)) {
                if (empty($sFile)) {
                    continue;
                }
                $sPrefix = substr($sFile, 4);
                // Remove 'tab_'.
                // Menu will be built in an UL, that will be transformed into a dropdown menu by using the Jeegocontext script by www.planitworks.nl.
                $sUL = '<UL id="menu_' . $sFile . '" class="jeegoocontext">' . "\n";
                $bHR = false;
                foreach ($Title as $sURL => $aItem) {
                    if (!is_array($aItem)) {
                        if ($aItem == 'hr') {
                            $bHR = true;
                        }
                        continue;
                    }
                    list($sIMG, $sName, $nRequiredLevel) = $aItem;
                    $bDisabled = false;
                    if ($nRequiredLevel && ($nRequiredLevel == LEVEL_CURATOR && !$bCurator || $nRequiredLevel != LEVEL_CURATOR && $nRequiredLevel > $_AUTH['level'])) {
                        $bDisabled = true;
                    } else {
                        if (!$sURL) {
                            // Default action of default page.
                            $sURL = $sPrefix;
                        } elseif ($sURL[0] == '/') {
                            // Direct URL.
                            $sURL = substr($sURL, 1);
                        } else {
                            // Action given.
                            $sURL = $sPrefix . '?' . $sURL;
                        }
                    }
                    if (!$bDisabled) {
                        // IE (who else) refuses to respect the BASE href tag when using JS. So we have no other option than to include the full path here.
                        // Not using the "separator" class from the original code, since it's not compatible to our changes.
                        $sUL .= ($bHR ? '  <LI class="hr disabled"><HR></LI>' . "\n" : '') . '  <LI' . (!$sIMG ? '' : ' class="icon"') . '><A href="' . lovd_getInstallURL(false) . $sURL . '">' . (!$sIMG ? '' : '<SPAN class="icon" style="background-image: url(gfx/' . $sIMG . ');"></SPAN>') . $sName . '</A></LI>' . "\n";
                        $bHR = false;
                    }
                    // class disabled, disabled. Nu gewoon maar even weggehaald.
                    //                    $sUL .= '  <LI class="disabled">' .
                    //                        (!$sIMG? '' : '<SPAN class="icon" style="background-image: url(gfx/' . preg_replace('/(\.[a-z]+)$/', '_disabled' . "$1", $sIMG) . ');"></SPAN>') . $sName .
                    //                        '</LI>' . "\n";
                }
                $sUL .= '</UL>' . "\n";
                $aMenus[$sFile] = $sUL;
                continue;
            }
            // Determine if we're the current tab.
            if (defined('TAB_SELECTED')) {
                // Hard coded exceptions...
                $bSel = TAB_SELECTED == $sPrefix;
            } else {
                $bSel = substr(lovd_getProjectFile(), 1, strrpos(lovd_getProjectFile(), '.') - 1) == $sPrefix;
            }
            $sFile = 'tab_' . $sPrefix;
            // Print transition.
            $nTotalTabWidth += 25;
            print '      <IMG src="gfx/tab_' . (!$n ? '0' : ($bPrevSel ? 'F' : 'B')) . ($bSel ? 'F' : 'B') . '.png" alt="" width="25" height="25" align="left">' . "\n";
            // Get header info.
            $sFileName = 'gfx/' . $sFile . '_' . ($bSel ? 'F' : 'B') . '.png';
            $aImage = @getimagesize(ROOT_PATH . $sFileName);
            $sSize = $aImage[3];
            // Print header.
            $sURL = $sPrefix;
            // If a gene has been selected, some of the tabs get different default URLs.
            if ($_SESSION['currdb']) {
                if (in_array($sPrefix, array('configuration', 'genes', 'transcripts', 'variants', 'screenings', 'individuals'))) {
                    $sURL = $sPrefix . '/' . $_SESSION['currdb'];
                    if ($sPrefix == 'variants') {
                        $sURL .= '/unique';
                    }
                } elseif ($sPrefix == 'diseases') {
                    $sURL = $sPrefix . '?search_genes_=' . $_SESSION['currdb'];
                }
            }
            $nTotalTabWidth += $aImage[0];
            print '      <A href="' . $sURL . '"><IMG src="' . $sFileName . '" alt="' . $Title . '" id="' . $sFile . '" ' . $sSize . ' align="left"></A>' . "\n";
            $bPrevSel = $bSel;
            $n++;
        }
        // If we've had tabs at all, close the transition.
        if (count($this->aMenu)) {
            $nTotalTabWidth += 25;
            print '      <IMG src="gfx/tab_' . ($bPrevSel ? 'F' : 'B') . '0.png" alt="" width="25" height="25" align="left">' . "\n";
        }
        // Close menu table.
        print '    </TD>' . "\n" . '  </TR>' . "\n" . '</TABLE>' . "\n\n" . '<IMG src="gfx/trans.png" alt="" width="' . $nTotalTabWidth . '" height="0">' . "\n\n";
        // Attach dropdown menus.
        print '<!-- Start drop down menu definitions -->' . "\n";
        foreach ($aMenus as $sUL) {
            print $sUL . "\n";
        }
        print '
<SCRIPT type="text/javascript">
  $(function(){
    var aMenuOptions = {
        widthOverflowOffset: 0,
        heightOverflowOffset: 1,' . '
        startLeftOffset: -20,
        event: "mouseover",
        openBelowContext: true,
        autoHide: true,
        delay: 100,
        onSelect: function(e, context){
            if($(this).hasClass("disabled"))
            {
                return false;
            } else {
                window.location = $(this).find("a").attr("href");
                return false;
            }
        }
    };' . "\n";
        foreach (array_keys($aMenus) as $sTabID) {
            print '    $(\'#' . $sTabID . '\').jeegoocontext(\'menu_' . $sTabID . '\', aMenuOptions);' . "\n";
        }
        print '  });
</SCRIPT>' . "\n" . '<!-- End drop down menu definitions -->' . "\n";
        ?>



<DIV style="padding : 0px 10px;">
<TABLE border="0" cellpadding="0" cellspacing="0" width="100%">
  <TR>
    <TD style="padding-top : 10px;">







<?php 
        return true;
    }
示例#5
0
文件: logs.php 项目: LOVDnl/LOVD3
 *
 * LOVD 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 LOVD.  If not, see <http://www.gnu.org/licenses/>.
 *
 *************/
define('ROOT_PATH', './');
define('TAB_SELECTED', 'setup');
require ROOT_PATH . 'inc-init.php';
if ($_AUTH) {
    // If authorized, check for updates.
    require ROOT_PATH . 'inc-upgrade.php';
}
// URL: /logs
// View all log entries.
define('PAGE_TITLE', 'View system log entries');
$_T->printHeader();
$_T->printTitle();
lovd_requireAUTH(LEVEL_MANAGER);
require ROOT_PATH . 'class/object_logs.php';
lovd_includeJS('inc-js-logs.php');
$_DATA = new LOVD_Log();
// Define menu, to delete multiple logs in one go.
print '      <UL id="viewlistMenu_Logs" class="jeegoocontext jeegooviewlist">' . "\n" . '        <LI class="icon"><A click="lovd_AJAX_viewListSubmit(\'Logs\', function(){$.get(\'ajax/delete_log.php?id=selected\', function(sResponse){if(sResponse.substring(0,1) == \'1\'){alert(\'Successfully deleted \' + sResponse.substring(2) + \' log entries.\');lovd_AJAX_viewListSubmit(\'Logs\');}}).fail(function(){alert(\'Log entries could not be deleted.\');});});"><SPAN class="icon" style="background-image: url(gfx/cross.png);"></SPAN>Delete selected entries</A></LI>' . "\n" . '      </UL>' . "\n\n";
$_DATA->viewList('Logs', array(), false, false, true);
// Don't change viewListID, the log's prepareData() and ajax/delete_log.php are referring to it.
$_T->printFooter();
示例#6
0
文件: diseases.php 项目: LOVDnl/LOVD3
            $_T->printFooter();
            exit;
        } else {
            // Because we're sending the data back to the form, I need to unset the password fields!
            unset($_POST['password']);
        }
    } else {
        // Default values.
        $_POST = array_merge($_POST, $zData);
    }
    $_T->printHeader();
    $_T->printTitle();
    lovd_errorPrint();
    // Tooltip JS code.
    lovd_includeJS('inc-js-tooltip.php');
    lovd_includeJS('inc-js-columns.php');
    // Table.
    print '      <FORM action="' . CURRENT_PATH . '?' . ACTION . '" method="post">' . "\n";
    // Array which will make up the form table.
    $aForm = array_merge($_DATA->getForm(), array(array('', '', 'submit', 'Edit custom data column')));
    if ($aFormType[2] != 'select') {
        unset($aForm['options'], $aForm['options_note']);
    }
    lovd_viewForm($aForm);
    print '</FORM>' . "\n\n";
    $_T->printFooter();
    exit;
}
if (PATH_COUNT == 3 && ctype_digit($_PE[1]) && $_PE[2] == 'columns' && ACTION == 'order') {
    // URL: /diseases/00001/columns?order
    // Change order of enabled columns for this disease.
示例#7
0
文件: genes.php 项目: LOVDnl/LOVD3
 define('PAGE_TITLE', 'Graphs &amp; statistics on gene ' . $sID);
 $_T->printHeader();
 $_T->printTitle();
 // Load authorization, collaborators and up see statistics about all variants, not just the public ones.
 lovd_isAuthorized('gene', $sID);
 // Check if there are variants at all.
 $nVariants = $_DB->query('SELECT COUNT(*) FROM ' . TABLE_VARIANTS . ' AS vog INNER JOIN ' . TABLE_VARIANTS_ON_TRANSCRIPTS . ' AS vot USING (id) INNER JOIN ' . TABLE_TRANSCRIPTS . ' AS t ON (vot.transcriptid = t.id) WHERE t.geneid = ?' . ($_AUTH['level'] >= LEVEL_COLLABORATOR ? '' : ' AND statusid >= ' . STATUS_MARKED), array($sID))->fetchColumn();
 if (!$nVariants) {
     lovd_showInfoTable('There are currently no ' . ($_AUTH['level'] >= LEVEL_COLLABORATOR ? '' : 'public ') . 'variants in this gene.', 'stop');
     $_T->printFooter();
     exit;
 }
 require ROOT_PATH . 'class/graphs.php';
 $_G = new LOVD_Graphs();
 lovd_includeJS('lib/flot/jquery.flot.min.js');
 lovd_includeJS('lib/flot/jquery.flot.pie.min.js');
 print '      <!--[if lte IE 8]><SCRIPT type="text/javascript" src="lib/flot/excanvas.min.js"></SCRIPT><![endif]-->' . "\n\n";
 // FIXME; Implement:
 // Check what's left here.
 // - Variant types (RNA).
 // - Locations of variants (exon and intron numbers)?
 // - Variants in this gene reported in individuals with which diseases?
 //   * Too bad we don't know if these variants cause this disease. Search for pathogenicity only? YES
 // We need to create the DIV containers, the Graph object will fill it in.
 // To save ourselves a lot of code, we'll build the DIV containers as templates.
 $aGraphs = array('Variant type (DNA level, all ' . ($_AUTH['level'] >= LEVEL_COLLABORATOR ? '' : 'public ') . 'variants)' => array('variantsTypeDNA_all' => 'All ' . ($_AUTH['level'] >= LEVEL_COLLABORATOR ? '' : 'public ') . 'variants', 'variantsTypeDNA_unique' => 'Unique ' . ($_AUTH['level'] >= LEVEL_COLLABORATOR ? '' : 'public ') . 'variants'), 'Variant type (DNA level, all ' . ($_AUTH['level'] >= LEVEL_COLLABORATOR ? '' : 'public ') . 'pathogenic variants)' => array('variantsTypeDNA_all_pathogenic' => 'All ' . ($_AUTH['level'] >= LEVEL_COLLABORATOR ? '' : 'public ') . 'pathogenic variants', 'variantsTypeDNA_unique_pathogenic' => 'Unique ' . ($_AUTH['level'] >= LEVEL_COLLABORATOR ? '' : 'public ') . 'pathogenic variants'), 'Variant type (Protein level, all ' . ($_AUTH['level'] >= LEVEL_COLLABORATOR ? '' : 'public ') . 'variants) (note: numbers are sums for all transcripts of this gene)' => array('variantsTypeProtein_all' => 'All ' . ($_AUTH['level'] >= LEVEL_COLLABORATOR ? '' : 'public ') . 'variants', 'variantsTypeProtein_unique' => 'Unique ' . ($_AUTH['level'] >= LEVEL_COLLABORATOR ? '' : 'public ') . 'variants'), 'Variant type (Protein level, all ' . ($_AUTH['level'] >= LEVEL_COLLABORATOR ? '' : 'public ') . 'pathogenic variants) (note: numbers are sums for all transcripts of this gene)' => array('variantsTypeProtein_all_pathogenic' => 'All ' . ($_AUTH['level'] >= LEVEL_COLLABORATOR ? '' : 'public ') . 'pathogenic variants', 'variantsTypeProtein_unique_pathogenic' => 'Unique ' . ($_AUTH['level'] >= LEVEL_COLLABORATOR ? '' : 'public ') . 'pathogenic variants'), 'Variant location (DNA level, all ' . ($_AUTH['level'] >= LEVEL_COLLABORATOR ? '' : 'public ') . 'variants) (note: numbers are sums for all transcripts of this gene)' => array('variantsLocations_all' => 'All ' . ($_AUTH['level'] >= LEVEL_COLLABORATOR ? '' : 'public ') . 'variants', 'variantsLocations_unique' => 'Unique ' . ($_AUTH['level'] >= LEVEL_COLLABORATOR ? '' : 'public ') . 'variants'), 'Variant type (DNA level, all ' . ($_AUTH['level'] >= LEVEL_COLLABORATOR ? '' : 'public ') . 'pathogenic variants) (note: numbers are sums for all transcripts of this gene)' => array('variantsLocations_all_pathogenic' => 'All ' . ($_AUTH['level'] >= LEVEL_COLLABORATOR ? '' : 'public ') . 'pathogenic variants', 'variantsLocations_unique_pathogenic' => 'Unique ' . ($_AUTH['level'] >= LEVEL_COLLABORATOR ? '' : 'public ') . 'pathogenic variants'));
 foreach ($aGraphs as $sCategory => $aCategory) {
     print '      <H5>' . $sCategory . '</H5>' . "\n" . '      <TABLE border="0" cellpadding="2" cellspacing="0" width="900" style="height : 320px;">' . "\n" . '        <TR valign="top">';
     foreach ($aCategory as $sGraphID => $sTitle) {
         print "\n" . '          <TD width="50%">' . "\n" . '            <B>' . $sTitle . '</B><BR>' . "\n" . '            <DIV id="' . $sGraphID . '" style="width : 325px; height : 250px;"><IMG src="gfx/lovd_loading.gif" alt="Loading..."></DIV><BR><DIV id="' . $sGraphID . '_hover">&nbsp;</DIV></TD>';
     }
示例#8
0
文件: settings.php 项目: LOVDnl/LOVD3
            }
            $q = $_DB->query($sSQL, $aSQL, true, true);
            // Write to log...
            lovd_writeLog('Event', LOG_EVENT, 'Edited system configuration');
            // Thank the user...
            header('Refresh: 3; url=' . lovd_getInstallURL() . 'setup');
            $_T->printHeader();
            $_T->printTitle();
            lovd_showInfoTable('Successfully edited the system settings!', 'success');
            $_T->printFooter();
            exit;
        }
    } else {
        // Load current values.
        $_POST = array_merge($_POST, $zData);
    }
    $_T->printHeader();
    $_T->printTitle();
    lovd_errorPrint();
    // Tooltip JS code.
    lovd_includeJS('inc-js-tooltip.php');
    // Allow checking the database URL.
    lovd_includeJS('inc-js-submit-settings.php');
    print '      <FORM action="' . CURRENT_PATH . '?' . ACTION . '" method="post" onsubmit="return lovd_checkForm();">' . "\n";
    // Array which will make up the form table.
    $aForm = array_merge($_DATA->getForm(), array('skip', array('', '', 'submit', PAGE_TITLE)));
    lovd_viewForm($aForm);
    print '</FORM>' . "\n\n";
    $_T->printFooter();
    exit;
}
示例#9
0
文件: variants.php 项目: LOVDnl/LOVD3
 $_T->printHeader();
 $_T->printTitle();
 if (GET) {
     print '      To edit a variant entry, please fill out the form below.<BR>' . "\n" . '      <BR>' . "\n\n";
 }
 lovd_errorPrint();
 // Tooltip JS code.
 lovd_includeJS('inc-js-tooltip.php');
 lovd_includeJS('inc-js-custom_links.php');
 // Hardcoded ACTION because when we're publishing, but we get the form on screen (i.e., something is wrong), we want this to be handled as a normal edit.
 print '      <FORM id="variantForm" action="' . CURRENT_PATH . '?edit' . (isset($_GET['submission']) ? '&amp;submission=' . $_GET['submission'] : '') . '" method="post">' . "\n";
 // Array which will make up the form table.
 $aForm = array_merge($_DATA['Genome']->getForm(), array(array('', '', 'print', '<INPUT type="submit" value="Edit variant entry">' . ($bSubmit ? '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<INPUT type="submit" value="Cancel" onclick="window.location.href=\'' . lovd_getInstallURL() . 'submit/screening/' . $_GET['submission'] . '\'; return false;" style="border : 1px solid #FF4422;">' : ''))));
 lovd_viewForm($aForm);
 print "\n" . '      </FORM>' . "\n\n";
 lovd_includeJS('inc-js-variants.php?chromosome=' . $zData['chromosome']);
 print '      <SCRIPT type="text/javascript">' . "\n" . '        var aUDrefseqs = {' . "\n";
 if ($bGene) {
     $i = 0;
     foreach ($aGenes as $sGene) {
         echo ($i ? ',' . "\n" : '') . '            \'' . $sGene . '\' : \'' . $_DB->query('SELECT refseq_UD FROM ' . TABLE_GENES . ' WHERE id = ?', array($sGene))->fetchColumn() . '\'';
         $i++;
     }
 }
 print "\n" . '        };' . "\n" . '        var aTranscripts = {' . "\n";
 $i = 0;
 if ($bGene) {
     foreach ($_DATA['Transcript'][$sGene]->aTranscripts as $nTranscriptID => $aTranscript) {
         list($sTranscriptNM, $sGeneSymbol, $sMutalyzerID) = $aTranscript;
         echo ($i ? ',' . "\n" : '') . '            \'' . $nTranscriptID . '\' : [\'' . $sTranscriptNM . '\', \'' . $sGeneSymbol . '\', \'' . $sMutalyzerID . '\']';
         $i++;