function printNewitemTR() { printOpFormIntro('add'); echo '<tr>'; echo '<td class=tdleft>' . getImageHREF('create', 'create new', TRUE) . '</td>'; echo "<td> </td>"; echo '<td>' . getSelect(getPatchCableConnectorOptions(), array('name' => 'end1_conn_id')) . '</td>'; echo '<td>' . getSelect(getPatchCableTypeOptions(), array('name' => 'pctype_id')) . '</td>'; echo '<td>' . getSelect(getPatchCableConnectorOptions(), array('name' => 'end2_conn_id')) . '</td>'; echo '<td><input type=text size=6 name=length value="1.00"></td>'; echo '<td><input type=text size=48 name=description></td>'; echo '<td class=tdleft>' . getImageHREF('create', 'create new', TRUE) . '</td>'; echo '</tr></form>'; }
/** * * @param unknown $tableName */ function getAllColumns($tableName) { $pdo = DbUtil::connect(); $sql = "SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = 'numeracy' AND TABLE_NAME = '" . $tableName . "'"; //$sql ="DESCRIBE numeracy.m01_user"; $values = $pdo->query($sql); $count = 1; $result = ""; $colnameArray = array(); if (is_array($values) || is_object($values)) { foreach ($values as $row) { $colnameArray[] = $row['COLUMN_NAME']; } } $tableName = strtoupper($tableName); $idField = findIdField($tableName, $colnameArray); print '<br/>'; print 'private static $insertSQL = "INSERT INTO ' . $tableName . ' (' . getInsert1($tableName, $colnameArray) . ') VALUES (' . getInsert2($tableName, $colnameArray) . ')";</br>'; print '<br/>'; if ($idField != '') { print 'private static $selectSQL = "SELECT ' . getSelect($colnameArray) . ' FROM ' . $tableName . ' ORDER BY ' . $idField . ' DESC "; </br>'; } else { print 'private static $selectSQL = "SELECT ' . getSelect($colnameArray) . ' FROM ' . $tableName . ' "; </br>'; } print '<br/>'; if ($idField != '') { print 'private static $updateSQL = "UPDATE ' . $tableName . ' SET ' . getUpdate($tableName, $colnameArray) . ' WHERE ' . $idField . ' = ? ";</br>'; } else { //('private static $updateSQL = "UPDATE '.$tableName.' SET '.getUpdate($tableName, $colnameArray).' ";</br>'); print 'private static $updateSQL = "UPDATE ' . $tableName . ' SET ' . getUpdate($tableName, $colnameArray) . ' WHERE CONDITIONFIELD = ? ";</br>'; } print '<br/>'; print 'private static $deleteSQL = "DELETE FROM ' . $tableName . ' WHERE ' . $idField . ' = ? ";</br>'; print '<br/>'; print 'private static $selectByIdSQL = "SELECT * FROM ' . $tableName . ' WHERE ' . $idField . ' = ? ";</br>'; printCreateFunction($tableName, $colnameArray); printGetAllFunction($tableName, $colnameArray); printUpdateFunction($tableName, $colnameArray); printDeleteFunction($tableName, $colnameArray); printGetByIdFunction($tableName, $colnameArray, $idField); DbUtil::disconnect(); //return $$colnameArray; }
function execute( $par ) { global $wgOut, $wgUser, $wgRequest; $wgOut->setPageTitle( 'Add Collection' ); if ( !$wgUser->isAllowed( 'addcollection' ) ) { $wgOut->addHTML( 'You do not have permission to add a collection.' ); return false; } $dbr = wfGetDB( DB_MASTER ); if ( $wgRequest->getText( 'collection' ) ) { require_once( 'WikiDataAPI.php' ); require_once( 'Transaction.php' ); $dc = $wgRequest->getText( 'dataset' ); $collectionName = $wgRequest->getText( 'collection' ); startNewTransaction( $wgUser->getID(), wfGetIP(), 'Add collection ' . $collectionName ); bootstrapCollection( $collectionName, $wgRequest->getText( 'language' ), $wgRequest->getText( 'type' ), $dc ); $wgOut->addHTML( wfMsg( 'ow_collection_added', $collectionName ) . "<br />" ); } $datasets = wdGetDatasets(); $datasetarray[''] = wfMsgSc( "none_selected" ); foreach ( $datasets as $datasetid => $dataset ) { $datasetarray[$datasetid] = $dataset->fetchName(); } $wgOut->addHTML( getOptionPanel( array( 'Collection name:' => getTextBox( 'collection' ), 'Language of name:' => getSuggest( 'language', 'language' ), 'Collection type:' => getSelect( 'type', array( '' => 'None', 'RELT' => 'RELT', 'LEVL' => 'LEVL', 'CLAS' => 'CLAS', 'MAPP' => 'MAPP' ) ), 'Dataset:' => getSelect( 'dataset', $datasetarray ) ), '', array( 'create' => wfMsg( 'ow_create' ) ) ) ); }
function getLanguageSelect( $name, $languageIdsToExclude = array() ) { global $wgLang ; $userLanguageId = getLanguageIdForCode( $wgLang->getCode() ) ; return getSelect( $name, getLanguageOptions( $languageIdsToExclude ), $userLanguageId ); }
function getNiftySelect($groupList, $select_attrs, $selected_id = NULL, $tree = false) { // special treatment for ungrouped data if (count($groupList) == 1 and isset($groupList['other'])) { return getSelect($groupList['other'], $select_attrs, $selected_id); } if (!array_key_exists('name', $select_attrs)) { return ''; } if (!array_key_exists('id', $select_attrs)) { $select_attrs['id'] = $select_attrs['name']; } if ($tree) { # it is safe to call many times for the same file addJS('js/jquery.optionTree.js'); $ret = "<input type=hidden name={$select_attrs['name']}>\n"; $ret .= "<script type='text/javascript'>\n"; $ret .= "\$(function() {\n"; $ret .= " var option_tree = {\n"; foreach ($groupList as $groupname => $groupdata) { $ret .= " '{$groupname}': {"; foreach ($groupdata as $dict_key => $dict_value) { $ret .= "\"{$dict_value}\":'{$dict_key}', "; } $ret .= "},\n"; } $ret .= " };\n"; $ret .= " var options = {empty_value: '', choose: 'select...'};\n"; $ret .= " \$('input[name={$select_attrs['name']}]').optionTree(option_tree, options);\n"; $ret .= "});\n"; $ret .= "</script>\n"; } else { $ret = '<select'; foreach ($select_attrs as $attr_name => $attr_value) { $ret .= " {$attr_name}={$attr_value}"; } $ret .= ">\n"; foreach ($groupList as $groupname => $groupdata) { $ret .= "<optgroup label='{$groupname}'>\n"; foreach ($groupdata as $dict_key => $dict_value) { $ret .= "<option value='{$dict_key}'" . ($dict_key == $selected_id ? ' selected' : '') . ">{$dict_value}</option>\n"; } $ret .= "</optgroup>\n"; } $ret .= "</select>\n"; } return $ret; }
function snmpgeneric_snmpconfig($object_id) { $object = spotEntity('object', $object_id); //$object['attr'] = getAttrValues($object_id); $endpoints = findAllEndpoints($object_id, $object['name']); addJS('function showsnmpv3(element) { var style; if(element.value != \'v3\') { style = \'none\'; document.getElementById(\'snmp_community_label\').style.display=\'\'; } else { style = \'\'; document.getElementById(\'snmp_community_label\').style.display=\'none\'; } var elements = document.getElementsByName(\'snmpv3\'); for(var i=0;i<elements.length;i++) { elements[i].style.display=style; } };', TRUE); addJS('function shownewobject(element) { var style; if(element.checked) { style = \'\'; } else { style = \'none\'; } var elements = document.getElementsByName(\'newobject\'); for(var i=0;i<elements.length;i++) { elements[i].style.display=style; } };', TRUE); addJS('function checkInput() { var host = document.getElementById(\'host\'); if(host.value == "-1") { var newvalue = prompt("Enter Hostname or IP Address",""); if(newvalue != "") { host.options[host.options.length] = new Option(newvalue, newvalue); host.value = newvalue; } } if(host.value != "-1" && host.value != "") return true; else return false; };', TRUE); echo '<body onload="document.getElementById(\'submitbutton\').focus(); showsnmpv3(document.getElementById(\'snmpversion\')); shownewobject(document.getElementById(\'asnewobject\'));">'; foreach ($endpoints as $key => $value) { $endpoints[$value] = $value; unset($endpoints[$key]); } unset($key); unset($value); foreach (getObjectIPv4Allocations($object_id) as $ip => $value) { $ip = ip_format($ip); if (!in_array($ip, $endpoints)) { $endpoints[$ip] = $ip; } } unset($ip); unset($value); foreach (getObjectIPv6Allocations($object_id) as $value) { $ip = ip_format(ip_parse($value['addrinfo']['ip'])); if (!in_array($ip, $endpoints)) { $endpoints[$ip] = $ip; } } unset($value); /* ask for ip/host name on submit see js checkInput() */ $endpoints['-1'] = 'ask me'; // saved snmp settings $snmpstr = strtok($object['comment'], "\n\r"); $snmpstrarray = explode(':', $snmpstr); if ($snmpstrarray[0] == "SNMP") { /* keep it compatible with older version */ switch ($snmpstrarray[2]) { case "1": $snmpstrarray[2] = 'v1'; break; case "2": case "v2C": $snmpstrarray[2] = 'v2c'; break; case "3": $snmpstrarray[2] = 'v3'; break; } $snmpnames = array('SNMP', 'host', 'version', 'community'); if ($snmpstrarray[2] == "v3") { $snmpnames = array_merge($snmpnames, array('sec_level', 'auth_protocol', 'auth_passphrase', 'priv_protocol', 'priv_passphrase')); } $snmpvalues = array(); foreach ($snmpnames as $key => $value) { if (isset($snmpstrarray[$key])) { switch ($key) { case 6: case 8: $snmpvalues[$value] = base64_decode($snmpstrarray[$key]); break; default: $snmpvalues[$value] = $snmpstrarray[$key]; } } } unset($snmpvalues['SNMP']); $snmpconfig = $snmpvalues; } else { $snmpconfig = array(); } $snmpconfig += $_POST; if (!isset($snmpconfig['host'])) { $snmpconfig['host'] = -1; /* try to find first FQDN or IP */ foreach ($endpoints as $value) { if (preg_match('/^[^ .]+(\\.[^ .]+)+\\.?/', $value)) { $snmpconfig['host'] = $value; break; } } unset($value); } // sg_var_dump_html($endpoints); if (!isset($snmpconfig['version'])) { $snmpconfig['version'] = mySNMP::SNMP_VERSION; } if (!isset($snmpconfig['community'])) { $snmpconfig['community'] = getConfigVar('DEFAULT_SNMP_COMMUNITY'); } if (empty($snmpconfig['community'])) { $snmpconfig['community'] = mySNMP::SNMP_COMMUNITY; } if (!isset($snmpconfig['sec_level'])) { $snmpconfig['sec_level'] = NULL; } if (!isset($snmpconfig['auth_protocol'])) { $snmpconfig['auth_protocol'] = NULL; } if (!isset($snmpconfig['auth_passphrase'])) { $snmpconfig['auth_passphrase'] = NULL; } if (!isset($snmpconfig['priv_protocol'])) { $snmpconfig['priv_protocol'] = NULL; } if (!isset($snmpconfig['priv_passphrase'])) { $snmpconfig['priv_passphrase'] = NULL; } if (!isset($snmpconfig['asnewobject'])) { $snmpconfig['asnewobject'] = NULL; } if (!isset($snmpconfig['object_type_id'])) { $snmpconfig['object_type_id'] = '8'; } if (!isset($snmpconfig['object_name'])) { $snmpconfig['object_name'] = NULL; } if (!isset($snmpconfig['object_label'])) { $snmpconfig['object_label'] = NULL; } if (!isset($snmpconfig['object_asset_no'])) { $snmpconfig['object_asset_no'] = NULL; } if (!isset($snmpconfig['save'])) { $snmpconfig['save'] = true; } // sg_var_dump_html($snmpconfig); // $snmpv3displaystyle = ($snmpconfig['version'] == "3" ? "style=\"\"" : "style=\"display:none;\""); echo '<h1 align=center>SNMP Config</h1>'; echo '<form method=post name="snmpconfig" onsubmit="return checkInput()" action=' . $_SERVER['REQUEST_URI'] . ' />'; echo '<table cellspacing=0 cellpadding=5 align=center class=widetable> <tr><th class=tdright>Host:</th><td>'; //if($snmpconfig['asnewobject'] == '1' ) if ($snmpconfig['host'] != '-1' and !isset($endpoints[$snmpconfig['host']])) { $endpoints[$snmpconfig['host']] = $snmpconfig['host']; } echo getSelect($endpoints, array('id' => 'host', 'name' => 'host'), $snmpconfig['host'], FALSE); echo '</td></tr> <tr> <th class=tdright><label for=snmpversion>Version:</label></th> <td class=tdleft>'; echo getSelect(array("v1" => 'v1', "v2c" => 'v2c', "v3" => 'v3'), array('name' => 'version', 'id' => 'snmpversion', 'onchange' => 'showsnmpv3(this)'), $snmpconfig['version'], FALSE); echo '</td> </tr> <tr> <th id="snmp_community_label" class=tdright><label for=community>Community:</label></th> <th name="snmpv3" style="display:none;" class=tdright><label for=community>Security Name:</label></th> <td class=tdleft><input type=text name=community value=' . $snmpconfig['community'] . ' ></td> </tr> <tr name="snmpv3" style="display:none;"> <th></th> </tr> <tr name="snmpv3" style="display:none;"> <th class=tdright><label">Security Level:</label></th> <td class=tdleft>'; echo getSelect(array('noAuthNoPriv' => 'no Auth and no Priv', 'authNoPriv' => 'auth without Priv', 'authPriv' => 'auth with Priv'), array('name' => 'sec_level'), $snmpconfig['sec_level'], FALSE); echo '</td></tr> <tr name="snmpv3" style="display:none;"> <th class=tdright><label>Auth Type:</label></th> <td class=tdleft> <input name=auth_protocol type=radio value=MD5 ' . ($snmpconfig['auth_protocol'] == 'MD5' ? ' checked="checked"' : '') . '/><label>MD5</label> <input name=auth_protocol type=radio value=SHA ' . ($snmpconfig['auth_protocol'] == 'SHA' ? ' checked="checked"' : '') . '/><label>SHA</label> </td> </tr> <tr name="snmpv3" style="display:none;"> <th class=tdright><label>Auth Key:</label></th> <td class=tdleft><input type=password id=auth_passphrase name=auth_passphrase value="' . $snmpconfig['auth_passphrase'] . '"></td> </tr> <tr name="snmpv3" style="display:none;"> <th class=tdright><label>Priv Type:</label></th> <td class=tdleft> <input name=priv_protocol type=radio value=DES ' . ($snmpconfig['priv_protocol'] == 'DES' ? ' checked="checked"' : '') . '/><label>DES</label> <input name=priv_protocol type=radio value=AES ' . ($snmpconfig['priv_protocol'] == 'AES' ? ' checked="checked"' : '') . '/><label>AES</label> </td> </tr> <tr name="snmpv3" style="display:none;"> <th class=tdright><label>Priv Key</label></th> <td class=tdleft><input type=password name=priv_passphrase value="' . $snmpconfig['priv_passphrase'] . '"></td> </tr> </tr> <tr> <th></th> <td class=tdleft> <input name=asnewobject id=asnewobject type=checkbox value=1 onchange="shownewobject(this)"' . ($snmpconfig['asnewobject'] == '1' ? ' checked="checked"' : '') . '> <label>Create as new object</label></td> </tr>'; // $newobjectdisplaystyle = ($snmpconfig['asnewobject'] == '1' ? "" : "style=\"display:none;\""); echo '<tr name="newobject" style="display:none;"> <th class=tdright>Type:</th><td class=tdleft>'; $typelist = withoutLocationTypes(readChapter(CHAP_OBJTYPE, 'o')); $typelist = cookOptgroups($typelist); printNiftySelect($typelist, array('name' => "object_type_id"), $snmpconfig['object_type_id']); echo '</td></tr> <tr name="newobject" style="display:none;"> <th class=tdright>Common name:</th><td class=tdleft><input type=text name=object_name value=' . $snmpconfig['object_name'] . '></td></tr> <tr name="newobject" style="display:none;"> <th class=tdright>Visible label:</th><td class=tdleft><input type=text name=object_label value=' . $snmpconfig['object_label'] . '></td></tr> <tr name="newobject" style="display:none;"> <th class=tdright>Asset tag:</th><td class=tdleft><input type=text name=object_asset_no value=' . $snmpconfig['object_asset_no'] . '></td></tr> <tr> <th></th> <td class=tdleft> <input name=save id=save type=checkbox value=1' . ($snmpconfig['save'] == '1' ? ' checked="checked"' : '') . '> <label>Save SNMP settings for object</label></td> </tr> <td colspan=2> <input type=hidden name=snmpconfig value=1> <input type=submit id="submitbutton" tabindex="1" value="Show List"></td></tr> </table></form>'; }
function getNiftySelect($groupList, $select_attrs, $selected_id = NULL) { // special treatment for ungrouped data if (count($groupList) == 1 and isset($groupList['other'])) { return getSelect($groupList['other'], $select_attrs, $selected_id); } if (!array_key_exists('name', $select_attrs)) { return ''; } if (!array_key_exists('id', $select_attrs)) { $select_attrs['id'] = $select_attrs['name']; } $ret = '<select'; foreach ($select_attrs as $attr_name => $attr_value) { $ret .= " {$attr_name}={$attr_value}"; } $ret .= ">\n"; foreach ($groupList as $groupname => $groupdata) { $ret .= "<optgroup label='{$groupname}'>\n"; foreach ($groupdata as $dict_key => $dict_value) { $ret .= "<option value='{$dict_key}'" . ($dict_key == $selected_id ? ' selected' : '') . ">{$dict_value}</option>\n"; } $ret .= "</optgroup>\n"; } $ret .= "</select>\n"; return $ret; }
function execute( $par ) { global $wgOut, $wgUser, $wgRequest; if ( !$wgUser->isAllowed( 'exporttsv' ) ) { $wgOut->addHTML( wfMsg( 'ow_exporttsv_not_allowed' ) ); return false; } $dbr = wfGetDB( DB_SLAVE ); $dc = wdGetDataSetcontext(); if ( $wgRequest->getText( 'collection' ) && $wgRequest->getText( 'languages' ) ) { // render the tsv file require_once( 'WikiDataAPI.php' ); require_once( 'Transaction.php' ); // get the collection to export. Cut off the 'cid' part that we added // to make the keys strings rather than numbers in the array sent to the form. $collectionId = substr( $wgRequest->getText( 'collection' ), 3 ); // get the languages requested, turn into an array, trim for spaces. $isoCodes = explode( ',', $wgRequest->getText( 'languages' ) ); for ( $i = 0; $i < count( $isoCodes ); $i++ ) { $isoCodes[$i] = trim( $isoCodes[$i] ); if ( !getLanguageIdForIso639_3( $isoCodes[$i] ) ) { $wgOut->setPageTitle( wfMsg( 'ow_exporttsv_export_failed' ) ); $wgOut->addHTML( wfMsg( 'ow_impexptsv_unknown_lang', $isoCodes[$i] ) ); return false; } } $wgOut->disable(); $languages = $this->getLanguages( $isoCodes ); $isoLookup = $this->createIsoLookup( $languages ); $downloadFileName = $this->createFileName( $isoCodes ); // Force the browser into a download header( 'Content-Type: text/tab-separated-values;charset=utf-8' ); header( 'Content-Disposition: attachment; filename="' . $downloadFileName . '"' ); // attachment // separator character used. $sc = "\t"; echo( pack( 'CCC', 0xef, 0xbb, 0xbf ) ); // start the first row: column names echo( 'defined meaning id' . $sc . 'defining expression' ); foreach ( $isoCodes as $isoCode ) { echo( $sc . 'definition_' . $isoCode . $sc . 'translations_' . $isoCode ); } echo( "\r\n" ); // get all the defined meanings in the collection $query = "SELECT dm.defined_meaning_id, exp.spelling "; $query .= "FROM {$dc}_collection_contents col, {$dc}_defined_meaning dm, {$dc}_expression exp "; $query .= "WHERE col.collection_id=" . $collectionId . " "; $query .= "AND col.member_mid=dm.defined_meaning_id "; $query .= "AND dm.expression_id = exp.expression_id "; $query .= "AND " . getLatestTransactionRestriction( "col" ); $query .= "AND " . getLatestTransactionRestriction( "dm" ); $query .= "AND " . getLatestTransactionRestriction( "exp" ); $query .= "ORDER BY exp.spelling"; // wfDebug($query."\n"); $queryResult = $dbr->query( $query ); while ( $row = $dbr->fetchRow( $queryResult ) ) { $dm_id = $row['defined_meaning_id']; // echo the defined meaning id and the defining expression echo( $dm_id ); echo( "\t" . $row['spelling'] ); // First we'll fill an associative array with the definitions and // translations. Then we'll use the isoCodes array to put them in the // proper order. // the associative array holding the definitions and translations $data = array(); // **************************** // query to get the definitions // **************************** $qry = 'SELECT txt.text_text, trans.language_id '; $qry .= "FROM {$dc}_text txt, {$dc}_translated_content trans, {$dc}_defined_meaning dm "; $qry .= 'WHERE txt.text_id = trans.text_id '; $qry .= 'AND trans.translated_content_id = dm.meaning_text_tcid '; $qry .= "AND dm.defined_meaning_id = $dm_id "; $qry .= 'AND trans.language_id IN ('; for ( $i = 0; $i < count( $languages ); $i++ ) { $language = $languages[$i]; if ( $i > 0 ) $qry .= ","; $qry .= $language['language_id']; } $qry .= ') AND ' . getLatestTransactionRestriction( 'trans' ); $qry .= 'AND ' . getLatestTransactionRestriction( 'dm' ); // wfDebug($qry."\n"); // uncomment this if you accept having 1700+ queries in the log $definitions = $dbr->query( $qry ); while ( $row = $dbr->fetchRow( $definitions ) ) { // $key becomes something like def_eng $key = 'def_' . $isoLookup['id' . $row['language_id']]; $data[$key] = $row['text_text']; } $dbr->freeResult( $definitions ); // ***************************** // query to get the translations // ***************************** $qry = "SELECT exp.spelling, exp.language_id "; $qry .= "FROM {$dc}_expression exp "; $qry .= "INNER JOIN {$dc}_syntrans trans ON exp.expression_id=trans.expression_id "; $qry .= "WHERE trans.defined_meaning_id=$dm_id "; $qry .= "AND " . getLatestTransactionRestriction( "exp" ); $qry .= "AND " . getLatestTransactionRestriction( "trans" ); // wfDebug($qry."\n"); // uncomment this if you accept having 1700+ queries in the log $translations = $dbr->query( $qry ); while ( $row = $dbr->fetchRow( $translations ) ) { // qry gets all languages, we filter them here. Saves an order // of magnitude execution time. if ( isset( $isoLookup['id' . $row['language_id']] ) ) { // $key becomes something like trans_eng $key = 'trans_' . $isoLookup['id' . $row['language_id']]; if ( !isset( $data[$key] ) ) $data[$key] = $row['spelling']; else $data[$key] = $data[$key] . '|' . $row['spelling']; } } $dbr->freeResult( $translations ); // now that we have everything, output the row. foreach ( $isoCodes as $isoCode ) { // if statements save a bunch of notices in the log about // undefined indices. echo( "\t" ); if ( isset( $data['def_' . $isoCode] ) ) echo( $this->escapeDelimitedValue( $data['def_' . $isoCode] ) ); echo( "\t" ); if ( isset( $data['trans_' . $isoCode] ) ) echo( $data['trans_' . $isoCode] ); } echo( "\r\n" ); } } else { // Get the collections $colQuery = "SELECT col.collection_id, exp.spelling " . "FROM {$dc}_collection col INNER JOIN {$dc}_defined_meaning dm ON col.collection_mid=dm.defined_meaning_id " . "INNER JOIN {$dc}_expression exp ON dm.expression_id=exp.expression_id " . "WHERE " . getLatestTransactionRestriction( 'col' ); $collections = array(); $colResults = $dbr->query( $colQuery ); while ( $row = $dbr->fetchRow( $colResults ) ) { $collections['cid' . $row['collection_id']] = $row['spelling']; } // render the page $wgOut->setPageTitle( wfMsg( 'ow_exporttsv_title' ) ); $wgOut->addHTML( wfMsg( 'ow_exporttsv_header' ) ); $wgOut->addHTML( getOptionPanel( array( wfMsg( 'ow_Collection_colon' ) => getSelect( 'collection', $collections, 'cid376322' ), wfMsg( 'ow_exporttsv_languages' ) => getTextBox( 'languages', 'ita, eng, deu, fra, cat' ), ), '', array( 'create' => wfMsg( 'ow_create' ) ) ) ); } }
function renderPopupPortSelector() { if (isset($_REQUEST['do_link'])) { return handlePopupPortLink(); } assertPermission('depot', 'default'); assertUIntArg('port'); $port_id = $_REQUEST['port']; $port_info = getPortInfo($port_id); $in_rack = isCheckSet('in_rack'); // fill port filter structure $filter = array('racks' => array(), 'objects' => '', 'ports' => '', 'asset_no' => ''); if (isset($_REQUEST['filter-obj'])) { $filter['objects'] = trim($_REQUEST['filter-obj']); } if (isset($_REQUEST['filter-port'])) { $filter['ports'] = trim($_REQUEST['filter-port']); } if (isset($_REQUEST['filter-asset_no'])) { $filter['asset_no'] = trim($_REQUEST['filter-asset_no']); } if ($in_rack) { $object = spotEntity('object', $port_info['object_id']); if ($object['rack_id']) { // the object itself is mounted in a rack $filter['racks'] = getProximateRacks($object['rack_id'], getConfigVar('PROXIMITY_RANGE')); } elseif ($object['container_id']) { $container = spotEntity('object', $object['container_id']); if ($container['rack_id']) { $filter['racks'] = getProximateRacks($container['rack_id'], getConfigVar('PROXIMITY_RANGE')); } } } $spare_ports = array(); if (!empty($filter['racks']) || !empty($filter['objects']) || !empty($filter['ports']) || !empty($filter['asset_no'])) { $spare_ports = findSparePorts($port_info, $filter); } // display search form echo 'Link ' . formatPort($port_info) . ' to...'; echo '<form method=GET>'; startPortlet('Port list filter'); echo '<input type=hidden name="module" value="popup">'; echo '<input type=hidden name="helper" value="portlist">'; echo '<input type=hidden name="port" value="' . $port_id . '">'; echo '<table align="center" valign="bottom"><tr>'; echo '<td class="tdleft"><label>Object name:<br><input type=text size=8 name="filter-obj" value="' . htmlspecialchars($filter['objects'], ENT_QUOTES) . '"></label></td>'; echo '<td class="tdleft"><label>Asset tag:<br><input type=text size=8 name="filter-asset_no" value="' . htmlspecialchars($filter['asset_no'], ENT_QUOTES) . '"></label></td>'; echo '<td class="tdleft"><label>Port name:<br><input type=text size=6 name="filter-port" value="' . htmlspecialchars($filter['ports'], ENT_QUOTES) . '"></label></td>'; echo '<td class="tdleft" valign="bottom"><label><input type=checkbox name="in_rack"' . ($in_rack ? ' checked' : '') . '>Nearest racks</label></td>'; echo '<td valign="bottom"><input type=submit value="show ports"></td>'; echo '</tr></table>'; finishPortlet(); // display results startPortlet('Compatible spare ports'); if (empty($spare_ports)) { echo '(nothing found)'; } else { echo getSelect($spare_ports, array('name' => 'remote_port', 'size' => getConfigVar('MAXSELSIZE')), NULL, FALSE); echo "<p>Cable ID: <input type=text id=cable name=cable>"; // suggest patch cables where it makes sense $heaps = getPatchCableHeapOptionsForOIF($port_info['oif_id']); if (count($heaps)) { // Use + instead of array_merge() to avoid renumbering the keys. echo '<p>Patch cable: ' . getSelect(array(0 => 'none') + $heaps, array('name' => 'heap_id')); } echo "<p><input type='submit' value='Link' name='do_link'>"; } finishPortlet(); echo '</form>'; }
<table width="40%" border=0 cellspacing=0 cellpadding=0 class="border"> <tr valign="top" > <td> <table width="100%" border=0 cellspacing=1 cellpadding=4> <?php print_r($this); ?> <tr valign="middle" class="bg1"> <td nowrap width="45%" class="fNormal">Type:</td> <td width="55%"> <?php echo getSelect("task", array("tools_editdetails_player" => "Player", "tools_editdetails_clan" => "Clan")); ?> </td> </tr> <tr valign="middle" class="bg1"> <td nowrap width="45%" class="fNormal">ID Number:</td> <td width="55%"><input type="text" name="id" size=15 maxlength=12 class="textbox"></td> </tr> </table></td> <td align="right"> <table border=0 cellspacing=0 cellpadding=10> <tr> <td><input type="submit" value=" Edit >> " class="submit"></td> </tr>
function linkmgmt_renderPopupPortSelectorbyName() { $linktype = $_REQUEST['linktype']; $object_id = $_REQUEST['object_id']; $object = spotEntity('object', $object_id); $objectlist = linkmgmt_findSparePorts(NULL, NULL, $linktype, false, true, TRUE, false, $object_id); $objectname = $object['dname']; /* remove self from list */ unset($objectlist[$object_id]); if (isset($_REQUEST['remote_object'])) { $remote_object = $_REQUEST['remote_object']; } else { /* choose first object from list */ $keys = array_keys($objectlist); if (isset($keys[0])) { $remote_object = $keys[0]; } else { $remote_object = NULL; } } if ($remote_object) { $filter['object_id'] = $remote_object; $link_list = linkmgmt_findSparePorts(NULL, $filter, $linktype, false, false, TRUE, false, $object_id); } else { $link_list = linkmgmt_findSparePorts(NULL, NULL, $linktype, false, false, TRUE, false, $object_id); } // display search form echo 'Link ' . $linktype . ' of ' . formatPortLink($object_id, $objectname, NULL, NULL) . ' Ports by Name to...'; echo '<form method=POST>'; echo '<table align="center"><tr><td>'; startPortlet('Object list'); $maxsize = getConfigVar('MAXSELSIZE'); $objectcount = count($objectlist); echo 'Object name (count ports)<br>'; echo getSelect($objectlist, array('name' => 'remote_object', 'size' => $objectcount <= $maxsize ? $objectcount : $maxsize), $remote_object, FALSE); echo '</td><td><input type=submit value="show ' . $linktype . ' ports>"></td>'; finishPortlet(); echo '<td>'; // display results startPortlet('Possible Backend Link List'); echo "Select links to create:<br>"; if (empty($link_list)) { echo '(nothing found)'; } else { $linkcount = count($link_list); $options = array('name' => 'link_list[]', 'size' => $linkcount <= $maxsize ? $linkcount : $maxsize, 'multiple' => 'multiple'); echo getSelect($link_list, $options, NULL, FALSE); echo "<p>{$linktype} Cable ID: <input type=text id=cable name=cable>"; echo "<p><input type='submit' value='Link {$linktype}' name='do_link'>"; } finishPortlet(); echo '</td></tr></table>'; echo '</form>'; }
?> <form method="get" action="<?php echo $g_options["scripturl"]; ?> "> <input type="hidden" name="mode" value="admin" /> <input type="hidden" name="task" value="<?php echo $code; ?> " /> <input type="hidden" name="sort" value="<?php echo $sort; ?> " /> <input type="hidden" name="sortorder" value="<?php echo $sortorder; ?> " /> <b style="padding-left:35px;">•</b> Show only events of type: <?php $resultTypes = $db->query("\r\n\t\tSELECT\r\n\t\t\tDISTINCT eventType\r\n\t\tFROM\r\n\t\t\thlstats_AdminEventHistory\r\n\t\tORDER BY\r\n\t\t\teventType ASC\r\n\t"); $types[""] = "(All)"; while (list($k) = $db->fetch_row($resultTypes)) { $types[$k] = $k; } echo getSelect("type", $types, $type); ?> <input type="submit" value="Filter" class="smallsubmit" /><br /><br /> </form> <?php $table->draw($result, $numitems, 95, "center");
function draw($value) { global $g_options; ?> <tr valign="middle"> <td width="45%" bgcolor="<?php echo $g_options["table_bgcolor1"]; ?> "> <?php echo $g_options["font_normal"]; echo l($this->title) . ":"; echo $g_options["fontend_normal"]; ?> </td> <td width="55%" bgcolor="<?php echo $g_options["table_bgcolor1"]; ?> "><?php switch ($this->type) { case "textarea": echo "<textarea name=\"{$this->name}\" cols=35 rows=4 wrap=\"virtual\">" . htmlspecialchars($value) . "</textarea>"; break; case 'checkbox': echo '<input type="checkbox" name=' . $this->name . ' value="0" />'; break; case "select": // for manual datasource in format "key/value;key/value" or "key;key" foreach (explode(";", $this->datasource) as $v) { if (ereg("/", $v)) { list($a, $b) = explode("/", $v); $coldata[$a] = $b; } else { $coldata[$v] = $v; } } echo getSelect($this->name, $coldata, $value); break; default: echo "<input type=\"text\" name=\"{$this->name}\" size=35 value=\"" . htmlspecialchars(l($value)) . "\" class=\"textbox\">"; break; } ?> </td> </tr> <?php }
function renderPopupPortSelector() { assertUIntArg('port'); $port_id = $_REQUEST['port']; $port_info = getPortInfo($port_id); $in_rack = isCheckSet('in_rack'); // fill port filter structure $filter = array('racks' => array(), 'objects' => '', 'ports' => ''); if (isset($_REQUEST['filter-obj'])) { $filter['objects'] = trim($_REQUEST['filter-obj']); } if (isset($_REQUEST['filter-port'])) { $filter['ports'] = trim($_REQUEST['filter-port']); } if ($in_rack) { $object = spotEntity('object', $port_info['object_id']); if ($object['rack_id']) { $filter['racks'] = getProximateRacks($object['rack_id'], getConfigVar('PROXIMITY_RANGE')); } } $spare_ports = array(); if (!empty($filter['racks']) || !empty($filter['objects']) || !empty($filter['ports'])) { $spare_ports = findSparePorts($port_info, $filter); } // display search form echo 'Link ' . formatPort($port_info) . ' to...'; echo '<form method=GET>'; startPortlet('Port list filter'); echo '<input type=hidden name="module" value="popup">'; echo '<input type=hidden name="helper" value="portlist">'; echo '<input type=hidden name="port" value="' . $port_id . '">'; echo '<table align="center" valign="bottom"><tr>'; echo '<td class="tdleft"><label>Object name:<br><input type=text size=8 name="filter-obj" value="' . htmlspecialchars($filter['objects'], ENT_QUOTES) . '"></label></td>'; echo '<td class="tdleft"><label>Port name:<br><input type=text size=6 name="filter-port" value="' . htmlspecialchars($filter['ports'], ENT_QUOTES) . '"></label></td>'; echo '<td class="tdleft" valign="bottom"><label><input type=checkbox name="in_rack"' . ($in_rack ? ' checked' : '') . '>Nearest racks</label></td>'; echo '<td valign="bottom"><input type=submit value="show ports"></td>'; echo '</tr></table>'; finishPortlet(); // display results startPortlet('Compatible spare ports'); if (empty($spare_ports)) { echo '(nothing found)'; } else { echo getSelect($spare_ports, array('name' => 'remote_port', 'size' => getConfigVar('MAXSELSIZE')), NULL, FALSE); echo "<p>Cable ID: <input type=text id=cable name=cable>"; echo "<p><input type='submit' value='Link' name='do_link'>"; } finishPortlet(); echo '</form>'; }
function renderNodePingChecks($object_id) { $accounts = getNodePingAccounts(); $account_options = array(); foreach ($accounts as $account) { $account_options[$account['id']] = $account['name']; } startPortlet('Add new check'); echo "<table cellspacing=0 cellpadding=5 align='center'>\n"; echo "<tr><th> </th><th>Account</th><th>Check ID</th><th></th><th> </th></tr>\n"; printOpFormIntro('add'); echo '<tr><td>'; printImageHREF('add', 'add check', TRUE); echo '</td><td>' . getSelect($account_options, array('name' => 'account_id')); echo '</td><td><input type=text size=25 name=np_check_id tabindex=101></td><td>'; printImageHREF('add', 'add check', TRUE); echo "</td></tr></form></table>\n"; finishPortlet(); $checks = getUnlinkedNodePingChecks($object_id); if (count($checks) > 0) { $check_options = array(); foreach ($checks as $check) { $check_options[$check['id']] = sprintf("%s - %s", $check['label'], $check['type']); } startPortlet('Link existing check (' . count($checks) . ')'); echo "<table cellspacing=0 cellpadding=5 align='center'>\n"; printOpFormIntro('link'); echo '<tr><td>' . getSelect($check_options, array('name' => 'check_id')); echo '</td><td class=tdleft>'; printImageHREF('ATTACH', 'Link check', TRUE); echo "</td></tr></form></table>\n"; finishPortlet(); } addJs(<<<END function toggleVisibility(tbodyId) { \t\$("#" + tbodyId).toggle(); } END , TRUE); $checks = getNodePingChecks($object_id); startPortlet('NodePing checks (' . count($checks) . ')'); if (count($checks)) { echo "<table cellspacing=0 cellpadding=5 align=center class=widetable>\n"; echo "<tr><th> </th><th>Type</th><th>Label</th><th>Interval</th><th>Reason</th><th>Result</th><th>Unlink</th><th> </th></tr>\n"; $token = ''; foreach ($checks as $check) { printOpFormIntro('upd', array('check_id' => $check['check_id'])); echo '<tr><td><a href="' . makeHrefProcess(array('op' => 'del', 'check_id' => $check['check_id'])) . '">'; echo getImageHREF('delete', 'Unlink and delete this check') . '</a></td>'; echo "<td><a href=\"#\" onclick=\"toggleVisibility('{$check['check_id']}');\">{$check['type']}</a></td>"; echo "<td>{$check['label']}</td>"; echo "<td>{$check['check_interval']}</td>"; // re-use a nodeping object if it already exists and is using the same token as this check if ($check['token'] != $token) { $nodeping = new NodePingClient(array('token' => $check['token'])); } $token = $check['token']; $np_result_raw = $nodeping->result->get(array('id' => $check['np_check_id'], 'limit' => 5, 'clean' => true)); if (isset($np_result_raw['error'])) { echo "<td colspan=5>Error: {$check_status_raw['error']}</td>"; } else { $np_result = $np_result_raw[0]; if ($np_result['su']) { $reason = ''; $result_str = 'PASS'; $result_class = 'msg_success'; } else { $reason = $np_result['sc']; $result_str = 'FAIL'; $result_class = 'msg_error'; } echo "<td>{$reason}</td>"; echo "<td><span class='{$result_class}'>{$result_str}</span></td>"; } echo '<td class=center><a href="' . makeHrefProcess(array('op' => 'unlink', 'link_id' => $check['link_id'])) . '">'; echo getImageHREF('cut', 'Unlink this check') . '</a></td>'; echo '<td class=tdleft>'; printImageHREF('save', 'Save changes', TRUE); echo "</td></tr>\n"; echo "<tbody id='{$check['check_id']}' style='display:none;'><tr><td colspan=8>"; echo '<table cellspacing=0 cellpadding=5 align=left>'; // override the td styling so it doesn't have a border echo '<tr><th>Account</th><td align=left style="border-top: 0px;">' . getSelect($account_options, array('name' => 'account_id'), $check['account_id']) . '</td></tr>'; echo '<tr><th>Check ID</th><td align=left style="border-top: 0px;"><input type=text size=25 name=np_check_id value="' . $check['np_check_id'] . '"></td></tr>'; echo "<tr><th>Target</th><td align=left style=\"border-top:0px; word-wrap:break-word; max-width:250px;\">{$check['target']}</td></tr>"; echo '</table></form>'; echo '<table cellspacing=0 cellpadding=5 align=right>'; echo '<tr><th colspan=5>Last 5 Results</th></tr>'; echo '<tr><th>Time</th><th>Loc</th><th>Run Time</th><th>Response</th><th>Result</th></tr>'; foreach ($np_result_raw as $np_row) { // time is reported in miliseconds, so trim off the last 3 digits printf('<tr><td>%s</td>', date('H:i:s A', substr($np_row['s'], 0, -3))); printf('<td>%s</td>', strtoupper($np_row['l'][$np_row['s']])); if ($np_row['su']) { $result_str = 'PASS'; $result_class = 'msg_success'; } else { $result_str = 'FAIL'; $result_class = 'msg_error'; } echo "<td>{$np_row['rt']}</td>"; echo "<td>{$np_row['sc']}</td>"; echo "<td><span class='{$result_class}'>{$result_str}</span></td></tr>"; } echo '</table>'; echo "</td></tr></tbody>\n"; } echo "</table>\n"; } finishPortlet(); }
<?
function renderEditVlan($vlan_ck) { global $vtoptions; $vlan = getVLANInfo($vlan_ck); startPortlet('Modify'); printOpFormIntro('upd'); // static attributes echo '<table border=0 cellspacing=0 cellpadding=2 align=center>'; echo '<tr><th class=tdright>Name:</th><td class=tdleft>' . "<input type=text size=40 name=vlan_descr value='{$vlan['vlan_descr']}'>" . '</td></tr>'; echo '<tr><th class=tdright>Type:</th><td class=tdleft>' . getSelect($vtoptions, array('name' => 'vlan_type', 'tabindex' => 102), $vlan['vlan_prop']) . '</td></tr>'; echo '</table>'; echo '<p>'; echo '<input type="hidden" name="vdom_id" value="' . htmlspecialchars($vlan['domain_id'], ENT_QUOTES) . '">'; echo '<input type="hidden" name="vlan_id" value="' . htmlspecialchars($vlan['vlan_id'], ENT_QUOTES) . '">'; printImageHREF('SAVE', 'Update VLAN', TRUE); echo '</form><p>'; // get configured ports count $portc = 0; foreach (getVLANConfiguredPorts($vlan_ck) as $subarray) { $portc += count($subarray); } $clear_line = ''; $delete_line = ''; if ($portc) { $clear_line .= '<p>'; $clear_line .= '<a href="' . makeHrefProcess(array('op' => 'clear', 'vlan_ck' => $vlan_ck)) . '">'; $clear_line .= getImageHREF('clear', "remove this vlan from {$portc} ports") . ' remove</a>' . ' this VLAN from ' . '<a href="' . makeHref(array('page' => 'vlan', 'tab' => 'default', 'vlan_ck' => $vlan_ck)) . '">' . "{$portc} ports</a>"; } $reason = ''; if ($vlan['vlan_id'] == VLAN_DFL_ID) { $reason = "You can not delete default VLAN"; } elseif ($portc) { $reason = "Can not delete: {$portc} ports configured"; } if (!empty($reason)) { echo getOpLink(NULL, 'delete VLAN', 'nodestroy', $reason); } else { echo getOpLink(array('op' => 'del', 'vlan_ck' => $vlan_ck), 'delete VLAN', 'destroy'); } echo $clear_line; finishPortlet(); }
function snmpgeneric_snmpconfig($object_id) { echo '<body onload="document.getElementById(\'submitbutton\').focus();">'; $object = spotEntity('object', $object_id); //$object['attr'] = getAttrValues($object_id); $endpoints = findAllEndpoints($object_id, $object['name']); addJS('function showsnmpv3(element) { var style; if(element.value != \'' . SNMPgeneric::VERSION_3 . '\') { style = \'none\'; document.getElementById(\'snmp_community_label\').style.display=\'\'; } else { style = \'\'; document.getElementById(\'snmp_community_label\').style.display=\'none\'; } var elements = document.getElementsByName(\'snmpv3\'); for(var i=0;i<elements.length;i++) { elements[i].style.display=style; } };', TRUE); addJS('function checkInput() { var host = document.getElementById(\'host\'); if(host.value == "-1") { var newvalue = prompt("Enter Hostname or IP Address",""); if(newvalue != "") { host.options[host.options.length] = new Option(newvalue, newvalue); host.value = newvalue; } } if(host.value != "-1" && host.value != "") return true; else return false; };', TRUE); foreach ($endpoints as $key => $value) { $endpoints[$value] = $value; unset($endpoints[$key]); } unset($key); unset($value); foreach (getObjectIPv4Allocations($object_id) as $ip => $value) { $ip = ip_format($ip); if (!in_array($ip, $endpoints)) { $endpoints[$ip] = $ip; } } unset($ip); unset($value); foreach (getObjectIPv6Allocations($object_id) as $value) { $ip = ip_format(ip_parse($value['addrinfo']['ip'])); if (!in_array($ip, $endpoints)) { $endpoints[$ip] = $ip; } } unset($value); /* ask for ip/host name on submit see js checkInput() */ $endpoints['-1'] = 'ask me'; $snmpconfig = $_POST; if (!isset($snmpconfig['host'])) { $snmpconfig['host'] = -1; /* try to find first FQDN or IP */ foreach ($endpoints as $value) { if (preg_match('/^[^ .]+(\\.[^ .]+)+\\.?/', $value)) { $snmpconfig['host'] = $value; break; } } unset($value); } // sg_var_dump_html($endpoints); if (!isset($snmpconfig['snmpversion'])) { $snmpconfig['version'] = mySNMP::SNMP_VERSION; } if (!isset($snmpconfig['community'])) { $snmpconfig['community'] = getConfigVar('DEFAULT_SNMP_COMMUNITY'); } if (empty($snmpconfig['community'])) { $snmpconfig['community'] = mySNMP::SNMP_COMMUNITY; } if (!isset($snmpconfig['sec_level'])) { $snmpconfig['sec_level'] = NULL; } if (!isset($snmpconfig['auth_protocol'])) { $snmpconfig['auth_protocol'] = NULL; } if (!isset($snmpconfig['auth_passphrase'])) { $snmpconfig['auth_passphrase'] = NULL; } if (!isset($snmpconfig['priv_protocol'])) { $snmpconfig['priv_protocol'] = NULL; } if (!isset($snmpconfig['priv_passphrase'])) { $snmpconfig['priv_passphrase'] = NULL; } echo '<h1 align=center>SNMP Config</h1>'; echo '<form method=post name="snmpconfig" onsubmit="return checkInput()" action=' . $_SERVER['REQUEST_URI'] . ' />'; echo '<table cellspacing=0 cellpadding=5 align=center class=widetable> <tr><th class=tdright>Host:</th><td>'; echo getSelect($endpoints, array('id' => 'host', 'name' => 'host'), $snmpconfig['host'], FALSE); echo '</td></tr> <tr> <th class=tdright><label for=snmpversion>Version:</label></th> <td class=tdleft>'; echo getSelect(array(SNMPgeneric::VERSION_1 => 'v1', SNMPgeneric::VERSION_2C => 'v2c', SNMPgeneric::VERSION_3 => 'v3'), array('name' => 'version', 'id' => 'snmpversion', 'onchange' => 'showsnmpv3(this)'), $snmpconfig['version'], FALSE); echo '</td> </tr> <tr> <th id="snmp_community_label" class=tdright><label for=community>Community:</label></th> <th name="snmpv3" style="display:none" class=tdright><label for=community>Security Name:</label></th> <td class=tdleft><input type=text name=community value=' . $snmpconfig['community'] . ' ></td> </tr> <tr name="snmpv3" style="display:none;"> <th></th> </tr> <tr name="snmpv3" style="display:none;"> <th class=tdright><label">Security Level:</label></th> <td class=tdleft>'; echo getSelect(array('noAuthNoPriv' => 'no Auth and no Priv', 'authNoPriv' => 'auth without Priv', 'authPriv' => 'auth with Priv'), array('name' => 'sec_level'), $snmpconfig['sec_level'], FALSE); echo '</td></tr> <tr name="snmpv3" style="display:none;"> <th class=tdright><label>Auth Type:</label></th> <td class=tdleft> <input name=auth_protocol type=radio value=MD5 ' . ($snmpconfig['auth_protocol'] == 'MD5' ? ' checked="checked"' : '') . '/><label>MD5</label> <input name=auth_protocol type=radio value=SHA ' . ($snmpconfig['auth_protocol'] == 'SHA' ? ' checked="checked"' : '') . '/><label>SHA</label> </td> </tr> <tr name="snmpv3" style="display:none;"> <th class=tdright><label>Auth Key:</label></th> <td class=tdleft><input type=password id=auth_passphrase name=auth_passphrase value="' . $snmpconfig['auth_passphrase'] . '"></td> </tr> <tr name="snmpv3" style="display:none;"> <th class=tdright><label>Priv Type:</label></th> <td class=tdleft> <input name=priv_protocol type=radio value=DES ' . ($snmpconfig['priv_protocol'] == 'DES' ? ' checked="checked"' : '') . '/><label>DES</label> <input name=priv_protocol type=radio value=AES ' . ($snmpconfig['priv_protocol'] == 'AES' ? ' checked="checked"' : '') . '/><label>AES</label> </td> </tr> <tr name="snmpv3" style="display:none;"> <th class=tdright><label>Priv Key</label></th> <td class=tdleft><input type=password name=priv_passphrase value="' . $snmpconfig['priv_passphrase'] . '"></td> </tr> </tr> <td colspan=2> <input type=hidden name=snmpconfig value=1> <input type=submit id="submitbutton" tabindex="1" value="Show List"></td></tr> </table></form>'; }
function renderEditVS($vs_id) { global $vs_proto; $vsinfo = spotEntity('ipvs', $vs_id); amplifyCell($vsinfo); $triplets = getTriplets($vsinfo); // first form - common VS settings printOpFormIntro('updVS'); echo '<table border=0 align=center>'; echo '<tr><th class=tdright>Name:</th><td class=tdleft><input type=text name=name value="' . htmlspecialchars($vsinfo['name'], ENT_QUOTES) . '"></td></tr>'; echo "<tr><th class=tdright>Tags:</th><td class=tdleft>"; printTagsPicker(); echo "</td></tr>\n"; echo '<tr><th class=tdright>VS config:</th><td class=tdleft><textarea name=vsconfig rows=3 cols=80>' . stringForTextarea($vsinfo['vsconfig']) . '</textarea></td></tr>'; echo '<tr><th class=tdright>RS config:</th><td class=tdleft><textarea name=rsconfig rows=3 cols=80>' . stringForTextarea($vsinfo['rsconfig']) . '</textarea></td></tr>'; echo '<tr><th></th><th>'; printImageHREF('SAVE', 'Save changes', TRUE); // delete link $triplets = getTriplets($vsinfo); echo '<span style="margin-left: 2em"></span>'; if (count($triplets) > 0) { echo getOpLink(NULL, '', 'NODESTROY', "Could not delete: there are " . count($triplets) . " LB links"); } else { echo getOpLink(array('op' => 'del', 'id' => $vsinfo['id']), '', 'DESTROY', 'Delete', 'need-confirmation'); } echo '</th></tr>'; echo '</table></form>'; addJS('js/jquery.thumbhover.js'); addJS('js/slb_editor.js'); // second form - ports and IPs settings echo '<p>'; // vertical indentation echo '<table width=50% border=0 align=center>'; echo '<tr><th style="white-space:nowrap">'; printOpFormIntro('addPort'); echo 'Add new port:<br>'; echo getSelect($vs_proto, array('name' => 'proto')); echo ' <input name=port size=5> '; echo getImageHREF('add', 'Add port', TRUE); echo '</form></th>'; echo '<td width=99%></td>'; echo '<th style="white-space:nowrap">'; printOpFormIntro('addIP'); echo 'Add new IP:<br>'; echo '<input name=ip size=14> '; echo getImageHREF('add', 'Add IP', TRUE); echo '</form></th></tr>'; echo '<tr><td valign=top class=tdleft><ul class="slb-checks editable">'; foreach ($vsinfo['ports'] as $port) { $used = 0; foreach ($triplets as $triplet) { if (isPortEnabled($port, $triplet['ports'])) { $used++; } } echo '<li class="enabled">'; echo formatVSPort($port) . getPopupSLBConfig($port); renderPopupVSPortForm($port, $used); echo '</li>'; } echo '</ul></td>'; echo '<td width=99%></td>'; echo '<td valign=top class=tdleft><ul class="slb-checks editable">'; foreach ($vsinfo['vips'] as $vip) { $used = 0; foreach ($triplets as $triplet) { if (isVIPEnabled($vip, $triplet['vips'])) { $used++; } } echo '<li class="enabled">'; echo formatVSIP($vip) . getPopupSLBConfig($vip); renderPopupVSVIPForm($vip, $used); echo '</li>'; } echo '</ul></td>'; echo '</tr></table>'; }
function getFilterOptionsPanel( $fromTransactionId, $transactionCount, $userName, $showRollBackOptions ) { $countOptions = array(); for ( $i = 1; $i <= 20; $i++ ) $countOptions[$i] = $i; return getOptionPanel( array( wfMsg( 'ow_transaction_from_transaction' ) => getSuggest( 'from-transaction', 'transaction', array(), $fromTransactionId, getTransactionLabel( $fromTransactionId ), array( 0, 2, 3 ) ), wfMsg( 'ow_transaction_count' ) => getSelect( 'transaction-count', $countOptions, $transactionCount ), wfMsg( 'ow_transaction_user' ) => getTextBox( 'user-name', $userName ), wfMsg( 'ow_transaction_show_rollback' ) => getCheckBox( 'show-roll-back-options', $showRollBackOptions ) ) ); }
<tr> <td colspan="2" class="required"><label for="shop_lng">经度:</label></td> </tr> <tr class="noborder"> <td class="vatop rowform"><input name="shop_lng" id="shop_lng" class="txt" type="text" value="<?php echo $data_array[0]['shop_lng']; ?> "></td> <td class="vatop tips">合作商家坐标的经度</td> </tr> <tr> <td colspan="2" class="required"><label for="class">所属分类:</label></td> </tr> <tr class="noborder"> <td class="vatop rowform"> <?php echo getSelect($data_array[0]['class']); ?> </td> <td class="vatop tips">商家所属的分类</td> </tr> <tr> <td colspan="2" class="required"><label for="fuwu">服务:</label></td> </tr> <tr class="noborder"> <td class="vatop rowform"><input name="fuwu" id="fuwu" class="txt" type="text" value="<?php echo $data_array[0]['fuwu']; ?> "></td> <td class="vatop tips">服务评分,满分为10分,最少0分。</td> </tr> <tr>
function drawForm($getvars = array(), $searchtypes = -1) { global $g_options, $db; if (!is_array($searchtypes)) { $searchtypes = array('player' => 'Player Names', 'uniqueid' => 'Player' . $this->uniqueid_string_plural); if ($g_options['Mode'] != 'LAN' && isset($_SESSION['loggedin']) && $_SESSION['acclevel'] >= 80) { $searchtypes['ip'] = 'Player IP Addresses'; } $searchtypes['clan'] = 'Clan Names'; } ?> <div class="block"> <?php printSectionTitle('Find a Player or Clan'); ?> <div class="subblock"> <form method="get" action="<?php echo $g_options['scripturl']; ?> "> <?php foreach ($getvars as $var => $value) { echo '<input type="hidden" name="' . htmlspecialchars($var, ENT_QUOTES) . '" value="' . htmlspecialchars($value, ENT_QUOTES) . "\" />\n"; } ?> <table class="data-table" style="width:30%;"> <tr valign="middle" class="bg1"> <td nowrap="nowrap" style="width:30%;">Search For:</td> <td style="width:70%;"> <input type="text" name="q" size="20" maxlength="128" value="<?php echo htmlspecialchars($this->query, ENT_QUOTES); ?> " style="width:300px;" /> </td> </tr> <tr valign="middle" class="bg1"> <td nowrap="nowrap" style="width:30%;">In:</td> <td style="width:70%;"> <?php echo getSelect('st', $searchtypes, $this->type); ?> </td> </tr> <tr valign="middle" class="bg1"> <td nowrap="nowrap" style="width:30%;">Game:</td> <td style="width:70%;"> <?php $games = array(); $games[''] = '(All)'; $result = $db->query("\r\n\t\t\t\t\t\t\t\t\t\tSELECT\r\n\t\t\t\t\t\t\t\t\t\t\thlstats_Games.code,\r\n\t\t\t\t\t\t\t\t\t\t\thlstats_Games.name\r\n\t\t\t\t\t\t\t\t\t\tFROM\r\n\t\t\t\t\t\t\t\t\t\t\thlstats_Games\r\n\t\t\t\t\t\t\t\t\t\tWHERE\r\n\t\t\t\t\t\t\t\t\t\t\thlstats_Games.hidden = '0'\r\n\t\t\t\t\t\t\t\t\t\tORDER BY\r\n\t\t\t\t\t\t\t\t\t\t\thlstats_Games.name\r\n\t\t\t\t\t\t\t\t\t"); while ($rowdata = $db->fetch_row($result)) { $games[$rowdata[0]] = $rowdata[1]; } echo getSelect('game', $games, $this->game); ?> </td> </tr> <tr class="bg1"> <td colspan="3" style="text-align:center;"> <input type="submit" value=" Find Now " class="submit" /> </td> </tr> </table> </td> </tr> </table> </form> </div> </div><br /><br /> <?php }
function draw($value) { global $g_options; ?> <tr style="vertical-align:middle;"> <td class="bg1" style="width:45%;"><?php echo $this->title . ':'; ?> </td> <td class="bg1" style="width:55%;"><?php switch ($this->type) { case 'textarea': echo "<textarea name=\"{$this->name}\" cols=35 rows=4 wrap=\"virtual\">" . htmlspecialchars($value) . '</textarea>'; break; case 'select': // for manual datasource in format "key/value;key/value" or "key;key" foreach (explode(';', $this->datasource) as $v) { if (preg_match('/\\//', $v)) { list($a, $b) = explode('/', $v); $coldata[$a] = $b; } else { $coldata[$v] = $v; } } echo getSelect($this->name, $coldata, $value); break; default: echo "<input type=\"text\" name=\"{$this->name}\" size=35 value=\"" . htmlspecialchars($value) . "\" class=\"textbox\" />"; break; } ?> </td> </tr> <?php }
<tr> <td class="labelcell" style="padding-bottom:10px">Preventista:</td> <td style="padding-bottom:10px"> <?php $params = array(); $params['sql'] = "SELECT * FROM preventistas WHERE id_registro_estado=6"; $params['name'] = "preventista"; $params['id'] = "preventista"; $params['class'] = "smallfieldcell"; if ($oRequestData['behavior'] == 'load') { $params['selected'] = $oData['id_preventista']; } else { $params['selected'] = 0; } $params['id_table'] = "id_preventista"; $params['column_table'] = "nombre_preventista"; echo getSelect($params); ?> </td> </tr> <tr><td colspan="2"><hr style="background-color:#EBEAEA; border:medium none; color:#5A83BA; height:1px; "/></td></tr> <tr> <td style="padding-bottom:10px" colspan="2"><input type="button" class="button" onclick="aceptar();" value="guardar"> <input type="button" id="volver" class="button" onclick="back();" value="volver"></td> </tr> </table> </div> </form> </body> </html>
<?php } ?> </ul> </div> </div> <div id="nv"> <ul id="mnv"> <?php do { ?> <li><a href="?p=<?php echo $row_rsMainNav['pg_id']; ?> "<?php getSelect($row_rsMainNav['pg_id']); ?> ><?php echo $row_rsMainNav['pg_link']; ?> </a></li> <?php } while ($row_rsMainNav = mysql_fetch_assoc($rsMainNav)); ?> </ul> </div> <div id="wr"> <div id="cnt"> <p class="pt"><?php echo $row_rsContent['pg_title']; ?>
function userDetailsHtml($userInfo, $header = "USER INFO") { $numOfSpaces = 5; $email = $userInfo['email']; $nationality = $userInfo['nationality']; $fName = $userInfo['firstName']; $lName = $userInfo['lastName']; $dob = $userInfo['dob']; $middleNames = $userInfo['middleName']; $aliases = $userInfo['aliasName']; $strHtml = "<div class='userInfo'>"; $strHtml .= "<h1>{$header}" . getSpaces(3); if ($header === "MY INFO") { $strHtml .= "<i class='animated swing infinite fa fa-pencil-square-o' id='editMe'></i>"; } $strHtml .= "</h1>"; $strHtml .= "<div class='userInfoDetails'>"; $strHtml .= "<div class='emailEdit'>Email: {$email}</div>" . getSpaces($numOfSpaces) . "<div class='fNameEdit'>" . "First Name: {$fName}</div>" . getSpaces($numOfSpaces) . "<div class='lNameEdit'>Last Name: {$lName}</div>" . getSpaces($numOfSpaces) . "<div class='dobEdit'>DOB: {$dob}</div>" . getSpaces($numOfSpaces); $strHtml .= "<div class='nationEdit'>Nationality: {$nationality}</div>" . getSpaces($numOfSpaces); $strHtml .= "</br><table style='margin-top: 8px' '><tr><td></td><td width='200px'>"; if (count($middleNames) > 0) { $strHtml .= "<div class='dummyEdit'>Middle Name(s): </td><td width='200px'>" . getSelect($middleNames) . "</div>"; } else { $strHtml .= "<div class='dummyEdit'>Middle Name(s): N/A</div>"; } $strHtml .= "</td><td width='200px'>"; if (count($aliases) > 0) { $strHtml .= "<div class='dummyEdit'>Aliase(s): </td><td width='200px'>" . getSelect($aliases) . "</div>"; } else { $strHtml .= "<div class='dummyEdit'>Aliase(s): N/A</div>"; } $strHtml .= "</td><td></td></tr></table></div></div>"; return $strHtml; }
<div id="nv"> <ul id="mnv"> <li><a href="../admin/pages_list.php"<?php getSelect('pages_list.php'); ?> >list of pages</a></li> <li><a href="../admin/pages_add.php"<?php getSelect('pages_add.php'); ?> >create new page</a></li> <li><a href="../admin/nav_order.php"<?php getSelect('nav_order.php'); ?> >navigation</a></li> <li><a href="../admin/email_password.php"<?php getSelect('email_password.php'); ?> >email and password</a></li> <li><a href="logout.php">logout</a></li> </ul> </div> <div id="wr"> <div id="cnt"><!-- InstanceBeginEditable name="tmp_edit_title" --> <p class="pt">Edit page</p> <form action="<?php echo $editFormAction; ?> " method="post" name="form1" id="form1"> <table border="0" cellpadding="0" cellspacing="0" id="tbl_insert"> <?php if (isset($pg_link)) {
$score = $_GET['score']; //use functions to insert new recordds and select top-10 $result_insert = getInsert($db, $name, $score); $result_select = getSelect($db); // html echo "<table id=\"scoreTable\" >\n"; while ($row = mysql_fetch_array($result_select, MYSQL_ASSOC)) { echo "\t<tr id='{$row['name']}'>\n"; foreach ($row as $key => $value) { echo "\t\t<td>{$value}</td>\n"; } echo "\t</tr>\n"; } echo "</table>\n"; } else { if ($record == 'start') { //show highscores at new game //select top-10 $result_select = getSelect($db); // html echo "<table id=\"scoreTable\" >\n"; while ($row = mysql_fetch_array($result_select, MYSQL_ASSOC)) { echo "\t<tr>\n"; foreach ($row as $key) { echo "\t\t<td>{$key}</td>\n"; } echo "\t</tr>\n"; } echo "</table>\n"; } }
function printForm() { // create ARTIST selectbox // create query variable include "variables.php"; include "db_connection_info.php"; $sqluse = "USE albums"; $sql = "SELECT artistID, artistName FROM yang_ning_artists ORDER BY artistName"; connect(); $result = mysql_query($sqluse, $conn); // assign query results to a variable $curArtists = mysql_query($sql, $conn) or die("<br>Error in printForm() getting info for Artist select: " . mysql_error()); // generate a select box of artists $selArtist = getSelect('selArt', $curArtists); mysql_close(); // print out form(s), using invisible field to submit a flag echo <<<HERE \t\t\t<h6 style='text-align:center'><em>Music Master</em></h6> \t\t\t<form name='addArtist1' id='addArtist1' action='' method='POST' > \t\t\t<h3 style="color:green;">Add a new Artist</h3> \t\t\t<h1>Artist's Name: <input type='text' name='artist' size='25' maxlength='25'/></h1> \t\t\t<input type='text' name='switch' value='2' style='display:none'/> \t\t\t<h1><button type='submit' value='addArtist'>Submit Artist</button></h1> \t\t\t</form> \t\t\t<h1>------------------------------------------</h1> \t\t\t<form name='addAlbum1' id='addAlbum1' action='' method='POST' > \t\t\t<h3 style="color:blue;">Add a new Album</h3> \t\t\t<h1>Title: <input type='text' name='album' size='25' maxlength='25'/></h1> \t\t\t<h1>Artist: {$selArtist}</h1> \t\t\t<h1>Year Released: <input type='text' name='year' size='4' maxlength='4'/></h1> \t\t\t \t\t\t<h4>Note: if your artist does not appear in the dropbox, please submit artist before album</h4> \t\t\t<input type='text' name='switch' value='3' style='display:none'/> \t\t\t<h1><button type='submit' value='addAlbum'>Submit Album</button></h1> \t\t\t</form> \t\t\t<h1>------------------------------------------</h1> \t\t\t<form name='makeQuery1' id='makeQuery1' action='' method='POST' > \t\t\t<h3 style="color:yellow;">Search Music</h3> \t\t\t<h1>Search For: <input type='text' name='lookFor' size='25' maxlength='25'/></h1> \t\t\t<input type='text' name='switch' value='4' style='display:none'/> \t\t\t<h1><button type='submit' value='makeQuery'>Go Look</button></h1> \t\t\t</form> \t\t\t<h1>------------------------------------------</h1> \t\t\t<form name='collection1' id='collection1' action='' method='POST' > \t\t\t<input type='text' name='switch' value='5' style='display:none'/> \t\t\t<h1><button type='submit' value='collection'>See Album Collection</button></h1> \t\t\t</form> \t\t\t<h1>------------------------------------------</h1> \t\t\t<form name='revert1' id='revert1' action='' method='POST' > \t\t\t<input type='text' name='switch' value='6' style='display:none'/> \t\t\t<h1><button type='submit' value='revert'>Restore Basic Collection</button></h1> \t\t\t</form> HERE; }
function getPaginator($text, $type = null, $user, $group, $page, $directory, $other) { $select = getSelect($text, $type, $user, $group, $page, $directory, $other); return Zend_Paginator::factory($select); }