Subversion Repositories ezclasspec

[/] [trunk/] [index.php] - Blame information for rev 7

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1 EirikJ
<?php
2
 
3
include_once('classes/contentclass.php');
4
 
5
$class = new contentClass;
6
 
7
// handle file import
8
$class->handleImport();
9
 
10
// if data has been posted
11
if(isset($_POST['data']))
12
{
13
        // if the user wants to clear all data
14
        if(isset($_POST['Clear']))
15
        {
16
                $data = array();
17
                $class->storeData($data);
18
        }
19
        else
20
        {
21
                $data = $_POST['data'];        
22
        }
23
}
24
 
25
// if no data has been posted
26
else
27
{
28
        // retrieve data
29
        $data = $class->retrieveData();
30
}
31
 
32
// handle new data
33
$data = $class->handleNewData($data);
34
 
35
// handle remove
36
$data = $class->handleRemove($_POST, $data);
37
 
38
// if we want identifiers created
39
if(isset($_POST['CreateIdentifiers']))
40
{
41
        // create identifiers
42
        $data = $class->createIdentifiers($data);
43
}
44
 
45
// update attribute order list
46
$data = $class->updateAttributeOrder($data);
47
 
48
// store data
49
$class->storeData($data);
50
 
51
// if the data should be exported
52
if(isset($_POST['Export']))
53
{
54
        $filename = date("YmdHi") . ' ' . $data['site'] . '.ezclasses';
55
 
56
        header('Content-type: text/html');
57
        header("Content-Disposition: attachment; filename=\"$filename\"");
58
        echo json_encode($data);
59
        exit();
60
}
61
 
62
?>
63
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
64
<html xmlns="http://www.w3.org/1999/xhtml">
65
<head>
66
        <title>eZ Publish Content Class spec</title>
67 7 EirikJ
        <link type="text/css" href="lib/bootstrap/css/bootstrap.min.css" rel="stylesheet" media="all"/>
68 1 EirikJ
        <link type="text/css" href="css/main.css" rel="stylesheet" media="all"/>
69
        <link type="text/css" href="css/nyroModal.css" rel="stylesheet" media="all"/>
70 7 EirikJ
        <script type="text/javascript" src="lib/bootstrap/js/bootstrap.min.js"></script>
71 1 EirikJ
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
72 7 EirikJ
        <script type="text/javascript" src="js/jquery-1.4.3.min.js"></script>
73
        <script type="text/javascript" src="js/jquery.tablednd_0_5.js"></script>
74
        <script type="text/javascript" src="js/jquery.nyroModal-1.6.2.min.js"></script>
75
        <script type="text/javascript">
76
          $(document).ready(function() {
77 1 EirikJ
 
78 7 EirikJ
                // set focus on the new attribute of the class for which we most recenly added an attribute
79
                $('#attribute-<?php echo $class->getFocusClass(); ?>-new .attribute_name').focus();
80 1 EirikJ
 
81 7 EirikJ
                // initialise drag-and-drop functionality for the table
82
                $('table').tableDnD({
83
                onDrop: function(table, row) {
84
                    // alert($.tableDnD.serialize());
85
                    $('form').submit();
86
                },
87
                dragHandle: "dragHandle"
88
            });
89 1 EirikJ
 
90 7 EirikJ
 
91
          });
92
        </script>
93
</head>
94
<body>
95 1 EirikJ
 
96 7 EirikJ
<form action="" method="post" class="form-inline">
97 1 EirikJ
 
98 7 EirikJ
<div class="container-fluid">
99
  <div class="row-fluid">
100
        <div class="span9">
101
                <div class="well">
102
                        <input type="submit" class="btn btn-primary" name="Save" value="Save" />
103
                        <input type="submit" class="btn" name="CreateIdentifiers" value="Create identifiers" />
104
                        <input type="submit" class="btn" name="RemovedSelected" value="Remove selected" />
105
                        <input type="submit" class="btn" name="Export" value="Export" />
106
                        <a href="parts/import.php" class="nyroModal btn">Import</a>
107
                        <a href="view.php" class="btn">Print</a>
108
                        <input type="submit" class="btn btn-danger" name="Clear" value="Clear all" />
109
                </div>
110
        </div>
111
        <div class="span3">
112
                <div class="well">
113
                        <fieldset>
114
                                <input type="text" name="data[site]" placeholder="Site name" tabindex="<?php echo $class->getTabIndex(); ?>" value="<?php if(isset($data['site'])) {echo $data['site'];} ?>" />
115
                        </fieldset>
116
                </div>
117
        </div>
118
  </div>
119
  <div class="row-fluid">
120
    <div class="span9">
121
 
122
        <?php
123 1 EirikJ
 
124 7 EirikJ
        // for each existing class
125
        if(isset($data['class_list']) and count($data['class_list']) > 0)
126 1 EirikJ
        {
127 7 EirikJ
                foreach($data['class_list'] as $key => $dataSingle)
128
                {
129
                        echo $class->formOutputClass($key, $dataSingle);
130
                }
131 1 EirikJ
        }
132
 
133 7 EirikJ
        // output a blank line to add new classes
134
        echo $class->formOutputClass();
135 1 EirikJ
 
136 7 EirikJ
        ?>
137
        </div>
138
        <div class="span3">
139
      <div class="well sidebar-nav">
140
        <?php
141
                echo $class->outputTOC($data);
142
                ?>
143
      </div><!--/.well -->
144
    </div><!--/span-->
145
 </div>
146
</div>
147 1 EirikJ
 
148
</form>
149 7 EirikJ
</body>
150
</html>