Skip to content

Commit 006c042

Browse files
author
rah1x
committed
cleanup 1
1 parent 43395c5 commit 006c042

15 files changed

+2699
-241
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<script>document.getElementById('f2').elements['preview_personalize'][0].checked='checked';</script>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<script>document.getElementById('category_id').value='<?php echo $empt['category_id']; ?>';</script>
2+
3+
4+
--------------------------------------------------------------
5+
if (logicsol.recTerminal.selectedIndex == 1){
6+
logicsol.terminal.value = "Forward Express\nC/o Atlanta Packaging Inc\n1619 Laurel Ave N.W\nAtlanta, GA 30318\nTel # 404 355 4609";
7+
}
Lines changed: 279 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,279 @@
1+
<?php
2+
//var_dump($_POST);
3+
if(isset($_POST['todo']) && ($_POST['todo']=='del'))
4+
{
5+
if($_POST['p_id']!='')
6+
{
7+
$res = false;
8+
$res = mysql_exec("delete from brh_products where p_id='{$_POST['p_id']}'", 'save');
9+
10+
if($res!=false){
11+
echo "<script>alert('The Card was successfully Deleted.');</script>";
12+
} else {
13+
echo "<script>alert('ERROR deleting the selected Card !!');</script>";
14+
}
15+
}
16+
}//end del.....
17+
18+
if(isset($_POST['todo']) && ($_POST['todo']=='status'))
19+
{
20+
if($_POST['p_id']!='')
21+
{
22+
$res = false;
23+
$res = mysql_exec("update brh_products set prod_status={$_POST['op1']} where p_id='{$_POST['p_id']}'", 'save');
24+
25+
if($res!=false){
26+
echo "<script>alert('The Status was successfully updated.');</script>";
27+
} else {
28+
echo "<script>alert('ERROR updating the selected Card !!');</script>";
29+
}
30+
}
31+
}//end del.....
32+
33+
if(isset($_POST['todo']) && ($_POST['todo']=='sort'))
34+
{
35+
if(stristr($_POST['op1'], 'c_id')!=false)
36+
{
37+
# category id
38+
$c_id_t = explode(':', $_POST['op1']);
39+
$c_id = $c_id_t[1];
40+
41+
# sub cat id
42+
$sc_id = 0;
43+
if($_POST['op2']!=''){
44+
$sc_id_t = explode(':', $_POST['op2']);
45+
$sc_id = $sc_id_t[1];
46+
}
47+
48+
$sort_data = $_POST['op3'];
49+
$sort_data = str_replace('p[]', '$p[]', $sort_data);
50+
$sort_data = str_replace('d', "'", $sort_data);
51+
$sort_data = str_replace('&', "';", $sort_data);
52+
$sort_data .="';";
53+
54+
$res = false;
55+
if(strlen($sort_data)>=5)
56+
{
57+
$p=array();
58+
eval($sort_data);
59+
if(count($p)>0)
60+
{
61+
62+
$p_cnt = count($p);
63+
$pos = $p_cnt;
64+
65+
function c_map($a){
66+
global $p, $pos;
67+
$r = $a;
68+
$r_t = explode('_', $a);
69+
70+
$ret = array('id'=>$r_t[0], 'pos'=>$pos--);
71+
return $ret;
72+
}
73+
74+
$p2 = array_map('c_map', $p);
75+
$query_up = "INSERT INTO brh_products (p_id, prod_sort_order) VALUES ";
76+
77+
$qr_tmp = ''; $l = 0;
78+
foreach($p2 as $v)
79+
{
80+
$qr_tmp .= "('{$v['id']}','{$v['pos']}')";
81+
82+
if(($l+1)<count($p2))
83+
$qr_tmp .= ',';
84+
85+
$l++;
86+
}
87+
88+
$query_up .= $qr_tmp." ON DUPLICATE KEY UPDATE p_id=VALUES(p_id), prod_sort_order=VALUES(prod_sort_order)";
89+
//var_dump($p_cnt, $query_up); die();
90+
91+
if($qr_tmp!='')
92+
$res = mysql_exec($query_up, 'save');
93+
//die(mysql_error());
94+
}
95+
}
96+
97+
if($res!=false){
98+
echo "<script>alert('The cards have been successfully re-arranged.');</script>";
99+
} else {
100+
echo "<script>alert('ERROR updating the selected Category !!');</script>";
101+
}
102+
}
103+
}//end sort.....
104+
//////////////////////////////////////////////////////////////////////
105+
106+
$where = '';
107+
if($cat['c_id']==4)
108+
{
109+
$where = "and p.iscalendar='1'";
110+
}
111+
112+
if(isset($_GET['sub_id']))
113+
$cards_qry = "select * from brh_products as p where p.prod_category='{$cat['c_id']}' and p.prod_subcategory='{$cat['sc_id']}' {$where} order by prod_sort_order desc";
114+
else
115+
$cards_qry = "select * from brh_products as p where p.prod_category='{$cat['c_id']}' {$where} order by prod_sort_order desc";
116+
$cards = mysql_exec($cards_qry);
117+
//echo $cards_qry;
118+
119+
$sc_id_dx = 0;
120+
if(isset($cat['sc_id']))
121+
$sc_id_dx = $cat['sc_id'];
122+
123+
if($cards){
124+
$i=1;
125+
?>
126+
<style>
127+
.col_st{
128+
min-width:151px;
129+
<?php
130+
if(stristr($browser, 'msie')!=false)
131+
echo "style=\"width:expression(this.width<141? 141:'auto' + 'px');\"";
132+
else if(stristr($browser, 'safari')!=false)
133+
echo "width:151px;";
134+
?>
135+
}
136+
</style>
137+
138+
139+
<div style="display:none;">
140+
<form action="" method="post" id="card_form">
141+
<input type="hidden" name="todo" value="">
142+
<input type="hidden" name="p_id" value="">
143+
<input type="hidden" name="op1" value="">
144+
<input type="hidden" name="op2" value="">
145+
<input type="hidden" name="op3" value="">
146+
</form></div>
147+
148+
<div id="page_desc" style="height:26px;">The folowing are the cards in the <?php echo $cat_title; ?> category. Move mouse over the images to see the action links. Drag to reOrder.</div>
149+
150+
<div id="message" style="display:none;"></div>
151+
152+
<div id="sort_btn1" style="display:none; height:26px;">
153+
<input type="button" value="Save Sort Order" class="btn_x" onclick="save('card_form', '<?php echo $cat['c_id']; ?>', '<?php echo $sc_id_dx; ?>')" style="width:140px;"></div>
154+
<br />
155+
156+
<div id="drag">
157+
<table cellpadding=0 cellspacing=0 id="table1">
158+
159+
<colgroup class="col_st">
160+
<col class="col_st"/>
161+
<col class="col_st"/>
162+
<col class="col_st"/>
163+
<col class="col_st"/>
164+
<col class="col_st"/>
165+
</colgroup>
166+
167+
<tr>
168+
<?php
169+
foreach($cards as $v)
170+
{
171+
## Number
172+
$card_number = $v['prod_image'];
173+
$c_t1 = explode('.', $card_number);
174+
$card_number = cut_str($c_t1[0], 15);
175+
176+
## Name
177+
$card_name2 = '';
178+
$card_name = format_str($v['prod_name']);
179+
if($card_name!='')
180+
$card_name2 = '<b>'.str_replace(' ', '&nbsp;', cut_str($card_name, 15)).'</b><br />';
181+
182+
##Status
183+
$status='active';
184+
if($v['prod_status']==0){
185+
$status='deactive';
186+
$new_status = 1;
187+
}else{
188+
$new_status = 0;
189+
}
190+
191+
echo "<td style='padding:0px; width:1px;' valign=top>";
192+
echo "<div id=\"d{$v['p_id']}\" class=\"drag t1\" style=\"border:none !important;\">";
193+
echo "<div style='padding:0 15px 30px 0; font-size:10px;' onmouseover=\"toogle_div('del_div_', '{$i}'); toogle_div('edit_div_', '{$i}'); toogle_div('status_div_', '{$i}');\" onmouseout=\"toogle_div('del_div_', '0'); toogle_div('edit_div_', '0'); toogle_div('status_div_', '0');\">";
194+
195+
echo "<div id='del_div_{$i}' style='display:none; position:absolute; z-index:2; margin:3px;'><img src=\"images/del.png\" style='cursor:pointer;' onclick=\"form_it('del', '{$v['p_id']}', '{$card_number}');\" title=\"Click here to Delete\"></div>";
196+
echo "<div id='edit_div_{$i}' style='display:none; position:absolute; z-index:2; margin:4px 3px 3px 25px;'><img src=\"images/edit2.png\" style='cursor:pointer;' onclick=\"location.href='edit_products.php?{$qr_x}card={$card_number}&pid={$v['p_id']}';\" title=\"Click here to Edit\"></div>";
197+
echo "<div id='status_div_{$i}' style='display:none; position:absolute; z-index:2; margin:5px 3px 3px 45px;'><img src=\"images/toogle.png\" style='cursor:pointer;' onclick=\"form_it('status', '{$v['p_id']}', '{$card_number}', '{$new_status}');\" title=\"Click here to Toggle Status\"></div>";
198+
199+
echo "<img src=\"../images/cards/{$v['prod_image_small']}\" style=\"max-height:300px; max-width:150px; ";
200+
if(stristr($browser, 'msie')!=false) echo "width:expression(this.width>140? 140:'auto' + 'px'); height:expression(this.height>300? 300:'auto' + 'px');";
201+
echo "\" border=0 title=\"{$card_name}\">";
202+
echo "<br />{$card_name2}";
203+
echo "<img src=\"images/{$status}.png\" style=\"margin-bottom:-5px; margin-left:-3px;\">{$card_number}";
204+
//echo "<br />{$v['p_id']}";
205+
206+
echo "</div>";
207+
echo "</div>";
208+
echo "</td>";
209+
210+
if($i%5==0)
211+
echo "</tr><tr>";
212+
213+
$i++;
214+
}//end foreach...
215+
?>
216+
</tr></table></div>
217+
218+
<div id="sort_btn2" style="display:none;">
219+
<input type="button" value="Save Sort Order" class="btn_x" onclick="save('card_form', '<?php echo $cat['c_id']; ?>', '<?php echo $sc_id_dx; ?>')" style="width:140px;"></div><br />
220+
221+
<style>
222+
.drag{border:none !important};
223+
</style>
224+
<?php
225+
}
226+
else
227+
{
228+
echo "There are no cards in this category !!";
229+
}
230+
?>
231+
232+
<script type="text/javascript" language="javascript">
233+
var total = <?php echo $i--; ?>;
234+
function toogle_div(div_i, cur)
235+
{
236+
for(ii=1; ii<=total; ii++)
237+
{
238+
var d = document.getElementById(div_i+''+ii);
239+
240+
if(d!=null)
241+
d.style.display='none';
242+
}//end for...
243+
244+
var c = document.getElementById(div_i+''+cur);
245+
246+
if(c!=null)
247+
c.style.display='';
248+
249+
}//end func....
250+
251+
252+
function form_it(type, id, card, op_1)
253+
{
254+
if(type=='del')
255+
{
256+
var conf = false;
257+
conf = confirm('You are about to DELETE this card ['+card+']. Click OK if you are sure.');
258+
259+
if(conf==true)
260+
{
261+
form = document.getElementById('card_form');
262+
form.todo.value=type;
263+
form.p_id.value=id;
264+
form.submit();
265+
}
266+
}
267+
else if(type=='status')
268+
{
269+
form = document.getElementById('card_form');
270+
form.todo.value=type;
271+
form.p_id.value=id;
272+
form.op1.value=op_1;
273+
form.submit();
274+
}
275+
276+
}//end func....
277+
278+
//load_x();
279+
</script>

0 commit comments

Comments
 (0)