Запись [f:_dev/_cb_list.php] < dev.sky.1.001
Версия 1.000
001 002 003 004 005 006 007 008 009 010 011 012 013 014 015 016 017 018 019 020 021 022 023 024 025 026 027 028 029 030 031 032 033 034 035 036 037 038 039 040 041 042 043 044 045 046 047 048 049 050 051 052 053 054 055 056 057 058 059 060 061 062 063 064 065 066 067 068 069 070 071 072 073 074 075 076 077 078 079 080 081 082 083 084 085 086 087 088 089 090 091 092 093 094 095 096 097 098 099 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 | <?php defined('START') and AUTH_OK or die; $useds = ['---', 'used', 'not used']; function set_10($v) { global $p_dev_t; isset($p_dev_t) or $p_dev_t = []; return array_search($v, $p_dev_t) !== false ? 1 : 0; } if ($_POST) { if (isset($p_id)) sqlf("delete from _dev_codebase where id in (%s)", $p_id); if (isset($p_r)) set([ 'u_cb_ini_filter' => $u_cb_ini_filter = implode('', array_map('set_10', array_keys($cbr_types))), 'u_cb_ini_rubric' => $u_cb_ini_rubric = (int)$p_r, 'u_cb_ini_text' => $u_cb_ini_text = $p_s, 'u_cb_ini_unot' => $u_cb_ini_unot = (int)$p_u, ]); } if (!$PVAL) set('u_cb_list', '?' . $_SERVER['QUERY_STRING']); $pack = $cat = ''; $sql_part = 'from _dev_codebase where '; $sql_part .= $u_cb_ini_unot ? "used=".($u_cb_ini_unot == 1 ? 1 : 0) : 1; $sql_part .= $u_cb_ini_rubric == '-1' ? '' : " and rubric_id=$u_cb_ini_rubric"; $sql_part .= $u_cb_ini_text === '' ? '' : " and code like '%".($_POST ? $u_cb_ini_text : escape($u_cb_ini_text, true))."%'"; if ($_POST) $u_cb_ini_text = stripslashes($u_cb_ini_text); if ($PVAL and $ch = $PVAL[0] and $PVAL = substr($PVAL, 1)) { $list = $ch == 'c' ? 'childs' : ($ch == 'p' ? 'parents' : ''); if ($list) { $list = trim(cell($PVAL, 'c', "ifnull($list,0)"), ','); $sql_part .= " and id in ($list)"; } elseif ($ch == 'g') { $pack = ' > package: <b>' . trim(cell($PVAL, 'p', 'name'), ',') . '</b>'; $sql_part .= " and package_id=$PVAL"; } } $p = $i = 0; $chks = str_split($u_cb_ini_filter); $tf = []; foreach ($cbr_types as $key => $val) { if ($chk = $chks[$i] ? ' checked' : '') array_push($tf, "'$key'"); $cat .= pad(2).'<label><input'.$chk.' type="checkbox" name="dev_t[]" value="'.$key.'" /><small>' . "$val</small></label>"; if ($key == 'x') $cat .= '<br>'; $i++; } if ($tf && $u_cb_ini_filter !== '1111111111') $sql_part .= ' and left(name, 1) in (' . implode(',', $tf) . ')'; list ($html, $p) = pagination(sql("+select count(1) $sql_part"), $u_items_per_page); $sql = "select * $sql_part order by id limit $p, $u_items_per_page"; echo str_replace('%TITLE%', 'page ' . (1 + $p / $u_items_per_page) . " - $TITLE", $start_html) ?> <div style="float:right;margin-right:50px"><span style="color:red">+</span><a href="?cb_edit=new">add new record</a></div> <u><b>CODEBASE</b></u> explorer (LIST)<?="$pack $html"?> <hr> <form method="post" id="f1"> <div style="float:left;width:70"><b>Filter:</b></div> <div style="float:left;width:530px;background:lightblue"><?=$cat?></div> <div style="float:left;width:150px"> <?=pad(2)?><label><input type="checkbox" onclick="chk_all(this)" />check all</label><br> <?=pad(2)?><label><input type="checkbox" onclick="inv_all(this)" />invert</label> </div> <div style="float:left">Rubric: <select name="r"><option value="-1">---<?=option($u_cb_ini_rubric, $dev_rubrics)?></select></div> <div style="clear:both"> <?=pad(7)?>Search text: <input name="s" id="search" value="<?=$u_cb_ini_text?>" /> <a href="javascript:clear_search()" id="clear"><img src="?img=13.clear.gif" /></a> <?=pad()?>Used or not: <select name="u"><?=option($u_cb_ini_unot, $useds)?></select> <?=pad(20)?><input type="submit" value="Search" /> </div> </form> </div><!-- fixed --> <div id="utbl"> <div id="list"><form method="post"> <div class="line q" style="background:#ddd;height:25px;line-height:25px;border-top:1px solid #222;border-bottom:1px solid #bbb;font-weight:bold"> <div class="r1"><span style="background:" title="">use</span> <span>ver.</span></div> ID, record name</div> <?php $lines = [50000 => 'red', 10000 => 'green', 1000 => 'blue']; $id = $p ? sql("+select id $sql_part order by id limit " . --$p . ", 1") : 0; for ($i = 0, $q = sql($sql); eval(fetch); $i++): $status = explode(' ', $r_status, 7); if (isset($status[6])) $r_comment = sprintf(span_r, strcut($status[6], 50)); $code = substr($r_name, 0, 1); in_array($code, $cbr_typ0) and $r_name = sprintf(span_r, $code) . ":" . substr($r_name, 2); $chk = $r_id < 50001 ? '' : '<div class="r1" style="text-align:right"><input type="checkbox" class="delchk" name="id[]" value="'.$r_id.'" /></div>'; $rubric = $r_id > 50000 ? $r_dt_upd : ($r_rubric_id < 2 ? '' : $dev_rubrics[$r_rubric_id]); ?> <div class="line"<?=@$lines[$r_id] ? sprintf(' style="border-bottom:3px solid %s"', $lines[$r_id]) : ''?>> <div class="r1"><?=$chk?> <span style="background:<?=$r_used?'#0f0':'#ddd'?>" title="<?=$r_used?'used in app':'not used in app'?>"> </span> <span title="<?="$r_dt $r_dt_upd"?>"><?=$r_version?></span> <?if($r_parents)printf('<a href="?cb_list=p%d" style="text-decoration:none">parents</a>', $r_id)?> | <?if($r_childs)printf('<a href="?cb_list=c%d" style="text-decoration:none">childs</a>', $r_id)?> </div> <div class="l1"> <div style="float:right"><?=$rubric?> </div> <small<?=1 + $id == $r_id ? '' : ' style="border-bottom:1px solid #0f0"'?>> <?=preg_replace("/^(0+)/", "<span style=\"color:#aaa\">$1</span>", pad00($id = $r_id, 5))?> </small> <a href="?cb_show=<?=$r_id?>" class="nd"><?=$r_name?></a><?if($r_changed):?><b style="color:red">*</b><?endif?> <?=$r_comment?> </div><div style="clear:both;font-size:0;height:0"></div> </div> <?endfor?> <?if(!$i):?><div id="no-records">No records found</div><?endif?> <?if($chk):?><div class="fr"><input type="submit" value="delete checked" /> <a href="javascript:invert()">invert all rows</a></div><?endif?> <small><br><b>parents</b> records use <b>some record</b> inside, <b>some record</b> used inside other <b>childs</b> records</small> </form></div><!-- list --> </div><!-- utbl --> <style type="text/css"> .line { clear: both; border-bottom: 1px solid #ddd; padding: 2px 0; } .r1 { float: right; width: 40%; } .l1 { float: left; width: 60%; } .nd { text-decoration: none } #clear {position:relative; top:3px;} #clear:hover {background-color: #fff;} .delchk {position:relative; top: 2px; margin:0; } </style> <script type="text/javascript"> var b = document.getElementsByTagName('input'); function clear_search() { $('search').value = ''; $('f1').submit(); } function chk_all(o) { var b = document.getElementsByTagName('INPUT'); for(var i = 0; i < b.length; i++) if(b[i].name == 'dev_t[]') b[i].checked = o.checked; } function inv_all(o) { chk = o; for(var i = 0; i < b.length; i++) if(b[i].name == 'dev_t[]') b[i].checked = !b[i].checked; window.setTimeout('chk.checked=false', 100); } function invert() { for(var i = 0; i < b.length; i++) if(b[i].name == 'id[]') b[i].checked = !b[i].checked; } var chk; obj = document.getElementsByTagName('div'); for (var i = 0; i < obj.length; i++) if (obj[i].className == 'line') { obj[i].onmouseover = function() { this.style.background = 'eef'; } obj[i].onmouseout = function() { this.style.background = 'fff'; } } function key_Esc() { document.location.href='<?=$u_help?>' } <?php if (!$i && $p != 0): ?>document.location.href = 'dev.php?cb_list'<?endif?> </script> |