Project

General

Profile

Statistics
| Branch: | Revision:

colonymech / docs / www / colonyscout / internal / assembly_edit2.php @ f59acf11

History | View | Annotate | Download (1.91 KB)

1
<script>
2
jQuery(function($){
3
        $('h1.editableText, h2.editableText, p.editableText').editableText({
4
                newlinesEnabled: false
5
        });
6
        
7
        $.editableText.defaults.newlinesEnabled = true;
8

9
        $('div.editableText').editableText();
10
        
11
        $('.editableText').change(function(){
12
                var newValue = $(this).html();
13
                alert(newValue);
14
        });
15
});
16
</script>
17

    
18
<script type="text/javascript">
19
$(document).ready(function() {
20
    // Initialise the table
21
    $("#table-1").tableDnD();
22
});
23
</script>
24

    
25
<style>
26
.h2 {font-family:georgia;font-size:20px;}
27
.edit-step-title {height:60px;width:70px;text-align:center;background:url('images/drag_button.png') no-repeat;color:#FF6600;vertical-align:top;}
28
.editableText {cursor:text;}
29
</style>
30

    
31
<?php
32
        if(!isset($_GET['q'])) {
33
                echo "<h1 style=\"color:#FF6600;\">Please search for a part..</h1>";
34

    
35
        } else {
36

    
37
        //must already be logged in
38
        $get_assembly_sql = "SELECT * FROM assemblyinstructions WHERE id='".$_GET['q']."' LIMIT 1";
39
        $get_assembly_res = mysqli_query($GLOBALS['mysqli'], $get_assembly_sql) or die(mysqli_error($GLOBALS['mysqli']));
40

    
41
        while ($r = mysqli_fetch_array($get_assembly_res)) {
42
                $assm["data"]                =        $r;
43
        }
44
?>        
45

    
46
<div  style="overflow:hidden;">        
47
        <div class="box-row">
48
        <h1><?php echo $assm['data']['Name']; ?></h1>
49
        </div>
50
        
51
        <table id="table-1">
52
<?php
53
        $get_assembly_sql = "SELECT * FROM assemblysteps WHERE AssemblyID=\"".$_GET['q']."\" ORDER BY StepNo ASC";
54
        $get_assembly_res = mysqli_query($GLOBALS['mysqli'], $get_assembly_sql) or die(mysqli_error($GLOBALS['mysqli']));
55
                                
56
        if (mysqli_num_rows($get_assembly_res)>0) {
57
                while ($r = mysqli_fetch_array($get_assembly_res)) {
58
                        echo "
59
                        <tr id=\"".$r['StepNo']."\">
60
                                <td width=\"80\" class=\"edit-step-title\"><div class=\"h2\">Step ".$r['StepNo']."</div>
61
                                </td>
62
                                <td><div class=\"h2 editableText\">".$r['StepTitle']."</div>
63
                                        <div class=\"editableText\">".$r['Content']."</div>
64
                                </td>
65
                        </tr>
66
                        ";
67
                }
68
        }
69
?>
70
                </table>
71
                                        
72
                                </div>
73
</div>
74

    
75
<?php
76
}
77
?>