Subversion-Projekte lars-tiefland.content-management

Revision

Revision 1 | Details | Vergleich mit vorheriger | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 1
<?
2
    $self = basename( $PHP_SELF );
3
    $DB = "artikel";
4
    define( "modul_name", "online_shop" );
5
    define( "tool_name", "artikel" );
2 lars 6
    require_once "connect2.php";
7
    require_once "show_dir.php";
1 lars 8
    session_start();
9
 
10
    // $charset laden um die jeweiligen ISO-Zeichensätzte zu laden.
2 lars 11
    require_once "charset.php";
1 lars 12
    require_once "language_pack.php";
13
 
14
    if ( $action )
15
    {
16
        unset( $_POST[action] );
17
        $row = array_keys( $_POST );
18
        if ( $_POST["upd_artikel"] == 1 )
19
        {
20
            unset( $_POST["upd_artikel"] );
21
            foreach ( array_keys( $$row[0] ) as $ID )
22
            {
23
                unset( $query_row );
24
                foreach ( $row as $elem )
25
                {
2 lars 26
                    if ( $elem == "artikel_status" || $elem == "artikel" || $elem ==
27
                        "del_artikel" || $elem == "upd_artikel" )
1 lars 28
                    {
29
                        continue;
30
                    }
2 lars 31
                    if ( $elem == "staffel" )
32
                    {
33
                        foreach ( $_POST["staffel"][$ID] as $p_index => $staffel )
34
                        {
35
                            $staffel = serialize($staffel);
36
                            $sql="UPDATE
37
                                    preise
38
                                SET
39
                                    staffel='$staffel'
40
                                WHERE
41
                                    preis_index = $p_index
42
                                AND
43
                                    artikel_id = $ID
44
                            ";
45
                            mysql_query($sql);
46
                        }
47
                        //exit;
48
                        continue;
49
                    }
1 lars 50
                    $buffer = $$elem;
51
                    if ( ereg( "^preis", $elem ) )
52
                    {
53
                        if ( ereg( "%$", $buffer[$ID] ) )
54
                        {
55
                            $buffer[$ID] = abs( $buffer[$ID] ) * ( -1 );
56
                        }
57
                    }
58
                    if ( $elem != "zubehoer_anzeigen_artikel" )
59
                    {
2 lars 60
                        $query_row[] = $elem . "='" . mysql_real_escape_string( $buffer[$ID] ) .
61
                            "'";
1 lars 62
                    }
63
                    else
64
                    {
65
                        $sql_d = "
66
                            DELETE FROM
67
                                shop_link_table
68
                            WHERE
69
                                Father=$ID
70
                            AND
71
                                Verwendung='a2a'
72
                        ";
73
                        mysql_query( $sql_d );
74
                        $z = explode( ",", $buffer[$ID] );
75
                        foreach ( $z as $z_val )
76
                        {
77
                            trim( $z_val );
78
                            if ( $z_val )
79
                            {
80
                                $sql_i = "
81
                                    INSERT INTO
82
                                        shop_link_table
83
                                    VALUES
84
                                    (
85
                                        $ID,
86
                                        $z_val,
87
                                        'a2a'
88
                                    )
89
                                ";
90
                                mysql_query( $sql_i );
91
                            }
92
                        }
93
                    }
94
                }
95
                if ( $ret = isset( $_SESSION["quick_edit_config.php"]["artikel_properties"]["zubehoer_anzeigen_artikel"] ) )
96
                {
97
                }
2 lars 98
                $query_row[] = "letzte_Aenderung_von='$PHP_AUTH_USER'";
1 lars 99
                $query = "
100
                    UPDATE
101
                        artikel
2 lars 102
                    SET
103
                    " . implode( ", ", $query_row ) . "
1 lars 104
                    WHERE
105
                        ID = $ID
106
                    AND
107
                        language = '$language'
108
                ";
109
 
110
                $result = mysql_query( $query ) or die( mysql_errno() . ": " .
111
                    mysql_error() . "<hr>$query<hr>" );
112
            }
113
        }
114
        if ( is_array( $_POST["artikel"] ) && $_POST["del_artikel"] == 1 )
115
        {
116
            $sql = "
117
                UPDATE
118
                    artikel
119
                SET
120
                    Father=-2,
121
                    letzte_Aenderung_von='$PHP_AUTH_USER'
122
                WHERE
123
                    ID IN (" . implode( ", ", $_POST["artikel"] ) . ")
124
                AND
125
                    language='$language'
126
            ";
127
            //echo $sql;
128
            mysql_query( $sql );
129
        }
130
        header( "Location:waren_tool.php" );
131
    }
132
 
133
    /* Bestimmen der Zielverzeichnisse */
134
    switch ( $_SESSION["quick_edit_config.php"]["nav_status_overide"] )
135
    {
136
        case 'off': // geöffnete Ordner
137
            $dirs = $_SESSION["tree.php"]["nav_status"];
138
            break;
139
        case - 1: // Alle Artikel
140
            $dirs = array( "-1" => "" );
141
            break;
142
        case 'select': // Alles unterhalb von
143
            $dirs = $_SESSION["quick_edit_config.php"]["nav_status_overide_selected"];
144
            break;
145
    }
146
?>
147
<html>
148
<head>
149
<title><? echo $webs[kunde_bezeichnung]
150
?>: Redaktionssystem</title>
151
<meta http-equiv="Content-Type" content="text/html; charset=<? echo $charset
152
?>">
153
<link rel="stylesheet" type="text/css" href="redaktion.css">
154
<style type="text/css">
155
A:link {font-family: Arial, Helvetica, sans-serif; font-size: 10pt; color: #000000}
156
A:visited {font-family: Arial, Helvetica, sans-serif; font-size: 10pt; color: #333333}
157
A:active {font-family: Arial, Helvetica, sans-serif; font-size: 10pt; color: #CC0000}
158
A:hover {font-family: Arial, Helvetica, sans-serif; font-size: 10pt; color: #669933}
159
p {font-family: Arial, Helvetica, sans-serif; font-size: 10pt; color: #000096}
160
p.error {font-family: Arial, Helvetica, sans-serif; font-size: 10pt; color: #000000; font-weight: bold}
161
span {font-family: Arial, Helvetica, sans-serif; font-size: 10pt}
162
span.blue {font-family: Arial, Helvetica, sans-serif; color: #FFFFFF; background-color:#0000A0; font-size: 10pt}
163
span.small {font-family: Arial, Helvetica, sans-serif; font-size: 8pt; text-decoration: none}
164
td {font-family: Arial, Helvetica, sans-serif; font-size: 10pt}
165
td.timeout {font-family: Arial, Helvetica, sans-serif; font-size: 10pt; color: #FF0000;}
166
td.small {font-family: Arial, Helvetica, sans-serif; font-size: 8pt}
167
td.headline {font-family: Arial, Helvetica, sans-serif; font-size: 10pt; color: #FFFFFF; font-weight: bold}
168
td.haupt {font-family: Arial, Helvetica, sans-serif; font-size: 10pt; font-weight: bold}
169
td.selectet_language {border: 1px outset; border-color: #CCCCCC #999999 #999999 #CCCCCC}
170
input {font-family: Arial, Helvetica, sans-serif; font-size: 8pt}
171
select {font-family: Arial, Helvetica, sans-serif; font-size: 8pt}
172
textarea {font-family: Arial, Helvetica, sans-serif; font-size: 8pt}.button {  border-style: outset; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; cursor: auto; width: 100%}
173
</style>
174
<script language="JavaScript">
175
<!--
176
function killkomma(w)
177
{
178
 return w.replace(/,/,'.');
179
}
180
//-->
181
</script>
182
<meta name="description" content="Redaktionssystem">
183
<meta name="author" content="Webagentur Niewerth">
184
<meta name="robots" content="noindex">
185
<script type="text/javascript" language="javascript">
186
    function del_item(a_id)
187
    {
188
        var trash = document.getElementById('trash');
189
        var letzteReihe = trash.rows.length;
190
        var iteration = letzteReihe;
191
        var reihe = trash.insertRow(letzteReihe);
192
 
193
        var zelle1 = reihe.insertCell(0);
194
        var zelle2 = reihe.insertCell(1);
195
        var zelle3 = reihe.insertCell(2);
196
 
197
        var artikel = document.createElement('input');
198
        artikel.setAttribute('type', 'hidden');
199
        artikel.setAttribute('name', 'artikel[]');
200
        artikel.setAttribute('value', a_id);
201
 
202
        var artikel_id = document.createElement('input');
203
        artikel_id.setAttribute('type', 'text');
204
        artikel_id.setAttribute('value', a_id);
205
        artikel_id.setAttribute('readonly', 'readonly');
206
        artikel_id.setAttribute('disabled', 'disabled');
207
        artikel_id.setAttribute('size', 10);
208
 
209
        var loeschen = document.createElement('input');
210
        loeschen.setAttribute('type', 'image');
211
        loeschen.setAttribute('src', '/dokumente/gfx/delete_record.gif');
212
        loeschen.onclick = new Function ("restore_item(this,'artikel_"+a_id+"')");
213
        loeschen.setAttribute('alt', "Artikel "+a_id+" wiederherstellen");
214
        loeschen.setAttribute('title', "Artikel "+a_id+" wiederherstellen");
215
 
216
        zelle1.setAttribute('id', iteration);
217
        zelle1.appendChild(artikel);
218
 
219
        zelle2.setAttribute('id', iteration);
220
        zelle2.appendChild(artikel_id);
221
 
222
        zelle3.setAttribute('id', iteration);
223
        zelle3.appendChild(loeschen);
224
 
225
        document.getElementById("artikel_"+a_id).style.display='none';
226
        document.getElementById('trash_used').value=1;
227
    }
228
    function restore_item(x, a_id)
229
    {
230
        while (x.tagName.toLowerCase() !='tr')
231
        {
232
            if(x.parentElement)
233
            {
234
                x=x.parentElement;
235
            }
236
            else if(x.parentNode)
237
            {
238
                x=x.parentNode;
239
            }
240
            else
241
            {
242
                return;
243
            }
244
        }
245
        var rowNum=x.rowIndex;
246
        while (x.tagName.toLowerCase() !='table')
247
        {
248
            if(x.parentElement)
249
            {
250
                x=x.parentElement;
251
            }
252
            else if(x.parentNode)
253
            {
254
                x=x.parentNode;
255
            }
256
            else
257
            {
258
                return;
259
            }
260
        }
261
        x.deleteRow(rowNum);
262
        anz=x.rows.length;
263
        if(anz==0)
264
        {
265
            document.getElementById('trash_used').value=0;
266
        }
2 lars 267
        document.getElementById(a_id).style.display='';
1 lars 268
    }
269
 
270
    function check_del()
271
    {
272
        ret=true;
273
        ret1=false;
274
        ret2=false;
275
        ret1=ret1=confirm('Wollen Sie alle Änderungen speichern ?');
276
        if(ret1)
277
        {
278
            document.getElementById('upd_artikel').value=1;
279
        }
280
        if(document.getElementById('trash_used').value==1)
281
        {
282
            ret2=confirm("Sollen die als gelöscht markierten Artikel tatsächlich gelöscht werden?\nACHTUNG: Dies kann NICHT rückgängig gemacht werden!");
283
            if(ret2)
284
            {
285
                document.getElementById('del_artikel').value=1;
286
            }
287
        }
288
        if(ret1==false&&ret2==false)
289
        {
290
            ret=false;
291
        }
292
        return ret;
293
    }
294
</script>
295
<script type="text/javascript" language="javascript" src="/js/jquery-1.6.4.min.js"></script>
296
<script type="text/javascript" language="javascript" src="/js/jquery-ui-1.8.9.custom.min.js"></script>
297
<?php
298
    if ( file_exists( "../css/$site/jquery-ui.custom.css" ) )
299
    {
300
        $css_file = "/css/$site/jquery-ui.custom.css";
301
    }
302
    else
303
    {
304
        $css_file = "/css/ui-darkness/jquery-ui.custom.css";
305
    }
306
?>
307
<link rel="stylesheet" href="<?= $css_file;
308
?>" />
309
<script type="text/javascript" language="javascript">
310
    $(function(){
311
        $('.edit_desc').button({
312
            icons:
313
            {
314
                primary: "ui-icon-pencil"
315
            }
316
        }).click(edit_desc);
317
        $('#edit_desc_dialog').dialog("destroy").dialog({
318
            autoOpen:false,
319
            modal: true,
320
            //height:270,
321
            width:700,
322
            height:500,
323
            resizable:true,
324
            buttons:
325
            {
326
                speichern: function()
327
                {
328
                    $.post("/Online-Shop/edit_desc.php",$('#edit_desc_form').serializeArray(), function(html){
2 lars 329
                        //alert(html);
1 lars 330
                    });
331
                    $(this).dialog("close");
332
                },
333
                abbrechen: function()
334
                {
335
                    $(this).dialog("close");
336
                }
337
            }
338
        })
339
        function edit_desc()
340
        {
341
            id=this.id;
342
            id=id.split("_");
343
            id=id[2];
344
            $('#edit_desc_dialog').load("/Online-Shop/get_desc.php?item="+id).dialog("open");
345
            return false;
346
        }
347
    });
348
</script>
349
</head>
350
 
351
<body bgcolor="#<? echo $webs[bgcolor_seite];
352
?>" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" text="#000000">
353
<form method="post" action="<? echo $self
354
?>" name="schnell" onsubmit="return check_del();">
355
  <table width="100%" border="0" cellspacing="0" cellpadding="3">
356
    <tr>
357
        <td align="center" bgcolor="#<? echo $webs[bgcolor_links]
358
?>">
359
            <img src="../images/navigation/trashcan.gif" title="Artikel löschen" alt="Artikel löschen">
360
        </td>
361
        <td align="center" bgcolor="#<? echo $webs[bgcolor_links]
362
?>">
363
            <font color="#<? echo $webs[font_color_links]
364
?>"><b>ID</b></font>
365
        </td>
366
<?
2 lars 367
    foreach ( $_SESSION["quick_edit_config.php"]["artikel_properties"] as $Feld =>
368
        $f_name )
1 lars 369
    {
370
        if ( isset( $user_rechte[modul_name][tool_name][$Feld] ) )
371
        {
372
?>
373
      <td align="center" bgcolor="#<? echo $webs["bgcolor_links"]
2 lars 374
?>" nobr><font color="#<? echo $webs["font_color_links"]
1 lars 375
?>"><b>
376
        &nbsp;<?
377
 
378
            $fname = $web_rechte[modul_name][tool_name][$Feld];
379
            if ( ( $fname ) /*			and
380
                (
381
                !strrpos($web_rechte[modul_name][tool_name][$Feld],";")
382
                )*/ )
383
            {
384
                if ( $fname[0] == "!" )
385
                {
386
                    $fname = substr( $fname, 1 );
2 lars 387
                }
388
                elseif ( stristr( $fname, ';' ) )
1 lars 389
                {
390
                    if ( stristr( $Feld, 'eigenschaft' ) )
391
                    {
392
                        $namen = explode( ";", $fname );
393
                        $fname = $namen[0];
394
                    }
395
                    else
396
                    {
397
                        $fname = $Feld;
398
                    }
399
                }
400
                echo $fname;
401
            }
402
            else
403
            {
404
                echo $f_name;
405
            }
406
?>&nbsp;</b></font></td><?
407
 
408
        }
409
    }
410
?>
411
  </tr>
412
<?
2 lars 413
    if ( is_array( $dirs ) )
1 lars 414
    {
2 lars 415
        foreach ( $dirs as $dir => $dirname )
416
        {
417
            show_dir( $dir, $dirname );
418
        }
419
 
1 lars 420
    }
421
 
422
    //	show_dir(-1,"");
423
 
424
?>
425
    <tr>
426
      <td bgcolor="#<? echo $webs[bgcolor_links]
2 lars 427
?>" align="right" colspan="<? echo count( $_SESSION["quick_edit_config.php"][artikel_properties] ) +
428
    2
1 lars 429
?>">
430
        <input type="hidden" id="trash_used" value="0">
431
        <input type="hidden" name="upd_artikel" id="upd_artikel" value="0">
432
        <input type="hidden" name="del_artikel" id="del_artikel" value="0">
433
        <input type="hidden" name="artikel_status" value="<? echo $HTTP_POST_VARS[artikel_status]
434
?>">
435
        <input type="submit" name="action" value="&Auml;nderung &uuml;bernehmen">
436
        <input type="reset" name="reset" value="Zur&uuml;cksetzen" onclick="confirm('Wollen Sie alle Änderungen verwerfen ?')">
437
      </td>
438
  </tr>
439
</table>
440
<table id="trash">
441
</table>
442
</form>
443
<div id="edit_desc_dialog" title="Beschreibung editieren">
444
</div>
2 lars 445
        <script src="/js/common.js"></script>
446
        <script src="/js/jquery-1.4.2.min.js"></script>
447
        <script src="/js/jquery-ui-1.8.1.custom.min.js"></script>
448
        <script>
449
            $(function()
450
            {
451
                $('.reiter').tabs();
452
                $('.new_staffel').click(add_staffel);
453
                $('.delete').click(del_staffel);
454
            });
455
            function add_staffel()
456
            {
457
                arr=this.id.split('_');
458
                nr=arr[3];
459
                a_id=arr[2];
460
                elems=$('.tr_staffel_'+a_id+'_'+nr).length;
461
                next_id=Math.abs(elems+1);
462
                arr[0]="table";
463
                table_id=arr.join('_');
464
                del_id='del_staffel_'+a_id+'_'+nr+'_'+next_id;
465
                r_html='<tr id="tr_staffel_'+a_id+'_'+nr+'_'+next_id+'" class="tr_staffel_'+a_id+'_'+nr+'"><td>ab: <input type="text" name="staffel['+a_id+']['+nr+'][menge][]" value=""></td><td>Preis: <input type="text" name="staffel['+a_id+']['+nr+'][preis][]" value="" onkeyup="killkomma_neu(this);" onblur="this.value=killkomma(this.value);"></td><td><img src="../dokumente/gfx/delete_record.gif" style="cursor:pointer" id="'+del_id+'" class="delete"></td></tr>';
466
                $('#'+table_id).append(r_html);
467
                $('#'+del_id).click(del_staffel);
468
            }
469
 
470
            function del_staffel()
471
            {
472
                arr=this.id.split('_');
473
                arr[0]="tr";
474
                tr_id=arr.join('_');
475
                $('#'+tr_id).remove();
476
            }
477
        </script>
1 lars 478
</body>