~cyrenity/zivios/devel

« back to all changes in this revision

Viewing changes to application/modules/openafs/views/scripts/service/volmountpoints.phtml

  • Committer: Faraz Khan
  • Date: 2008-09-15 13:29:33 UTC
  • Revision ID: fkhan@zivios.org-20080915132933-d27jml5l29xw4gsr
Initial release to bazaar, code in sync with 0.5.0-release

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php
 
2
/**
 
3
 * Copyright (c) 2008 Zivios, LLC.
 
4
 *
 
5
 * This file is part of Zivios.
 
6
 *
 
7
 * Zivios is free software: you can redistribute it and/or modify
 
8
 * it under the terms of the GNU General Public License as published by
 
9
 * the Free Software Foundation, either version 3 of the License, or
 
10
 * (at your option) any later version.
 
11
 *
 
12
 * Zivios is distributed in the hope that it will be useful,
 
13
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
15
 * GNU General Public License for more details.
 
16
 *
 
17
 * You should have received a copy of the GNU General Public License
 
18
 * along with Zivios.  If not, see <http://www.gnu.org/licenses/>.
 
19
 *
 
20
 * @package             mod_openafs
 
21
 * @copyright   Copyright (c) 2008 Zivios, LLC. (http://www.zivios.org)
 
22
 * @license             http://www.zivios.org/legal/license
 
23
 * @version             $Id: volmountpoints.phtml 919 2008-08-25 11:45:23Z fkhan $
 
24
 * @lastchangeddate $LastChangedDate: 2008-08-25 17:45:23 +0600 (Mon, 25 Aug 2008) $
 
25
 **/
 
26
 
 
27
?>
 
28
 
 
29
<table border="0" width="100%" align="center">
 
30
<tr><td colspan="2"><b>Edit Mount Points</b></td></tr>
 
31
<?php
 
32
if (!empty($this->mountPoints)) {
 
33
        $c = 1;
 
34
        foreach ($this->mountPoints as $mp => $mpt) {
 
35
                if (strtolower($mpt) == "rw") {
 
36
                        $rw = 'CHECKED';
 
37
                        $ro = '';
 
38
                } else {
 
39
                        $ro = 'CHECKED';
 
40
                        $rw = '';
 
41
                }
 
42
 
 
43
                $mpa = explode("/", $mp);
 
44
                $mpid = '';
 
45
                for ($x=3; $x < count($mpa); $x++) {
 
46
                        $mpid .= $mpa[$x];
 
47
                        if ($x < count ($mpa)-1)
 
48
                                $mpid .= "/";
 
49
                }
 
50
 
 
51
        echo
 
52
        '<tr id="mpdiv'.$c.'">
 
53
                <td width="350" NOWRAP>
 
54
                <form id="femp'.$c.'">
 
55
                <span id="editmp'.$c.'">' . $mp . '</span>
 
56
                <span id="f_editmp'.$c.'" style="display: none;">
 
57
                /afs/.' . $this->obj->getproperty('emsafscell') . '<input size="26" maxlength="64" type="text" name="nmp" value="' . $mpid . '" /><br />
 
58
 
 
59
                <label for="MountPointType">Mount Point Type:</label>
 
60
                        <input type="radio" value="rw" name="vtype" '.$rw.'/> RW
 
61
                        <input type="radio" value="ro" name="vtype" '.$ro.'/> RO <br />
 
62
 
 
63
                <label for="releaseBaseVol">Release base volume:</label>
 
64
                        <input type="checkbox" value="1" name="releasebasevol" CHECKED /> <br />
 
65
 
 
66
                        <input type="hidden" name="omp" value="' . $mp . '" />
 
67
                        <input type="hidden" name="ompcompare" value="'.$mpid.'" />
 
68
                        <input type="hidden" name="ovtype" value="'.strtolower($mpt).'" />
 
69
                        <input type="hidden" name="operate_dn" value="' . $this->obj->getdn() . '" />
 
70
                        <input type="hidden" name="voldn" value="' . $this->volEntry->getdn() . '" />
 
71
                        <input type="hidden" name="updateRequestFor" value="updatevolmountpoint" />
 
72
                        <input type="hidden" name="utype" value="update" />
 
73
                </span>
 
74
                </form>
 
75
                </td>
 
76
                <td NOWRAP>
 
77
                <span id="emp'.$c.'"><a href="#" onclick="javascript:editMountPoint(\'emp'.$c.'\',\'editmp'.$c.'\',\'ump'.$c.'\',\'f_editmp'.$c.'\');">Edit</a></span>
 
78
                <span id="ump'.$c.'" style="display: none;"><a href="#" onclick="javascript:updateMountPoint(\'femp'.$c.'\', \'emp'.$c.'\',\'editmp'.$c.'\',\'ump'.$c.'\',\'f_editmp'.$c.'\');">Save</a></span>
 
79
                | <a href="#" onClick="javascript:deleteMountPoint(\''.$mp.'\', \'optrst\');">Delete</a>
 
80
                </td>
 
81
        </tr>';
 
82
        $c++;
 
83
        }
 
84
} else {
 
85
        echo '<tr><td>No Mountpoint Set</td></tr>';
 
86
}
 
87
?>
 
88
</table>
 
89
 
 
90
<hr size="1" />
 
91
 
 
92
<form method="post" action="#" onsubmit="return false;" id="addmountpoint">
 
93
<fieldset>
 
94
<legend>Add Volume Mountpoint</legend>
 
95
<div class="notice">Path leading up to your mount point <b>must</b> exist</div>
 
96
<label for="MountPoint">/afs/.<?php echo $this->obj->getProperty("emsafscell");?>/ </label>
 
97
        <input type="text" name="newmountpoint" value="" maxlength="64" size="32" /><br />
 
98
<label for="MountPointAccess">Mount Point Type:</label>
 
99
        <input type="radio" value="rw" name="vtype" CHECKED /> RW
 
100
        <input type="radio" value="ro" name="vtype" /> RO <br />
 
101
<label for="releaseBaseVol">Release base volume:</label>
 
102
        <input type="checkbox" value="1" name="releasebasevol" CHECKED /> <br />
 
103
 
 
104
        <input type="submit" name="anmp" value="Add Mountpoint"
 
105
                onclick="javascript:callAfsFormAction('addmountpoint', '/openafs/server/addmountpoint', 'optrst');" />
 
106
                <input type="hidden" name="operate_dn" value="<?php echo $this->obj->getdn(); ?>" />
 
107
                <input type="hidden" name="voldn" value="<?php echo $this->volEntry->getdn(); ?>" />
 
108
                <input type="hidden" name="addRequestFor" value="addvolmountpoint" />
 
109
                <input type="hidden" name="utype" value="add" />
 
110
</fieldset>
 
111
</form>
 
112
 
 
113
 
 
114
<script language="javascript">
 
115
/**
 
116
 * Show EditMountPoint Options
 
117
 */
 
118
editMountPoint = function (emp, editmp, ump, f_editmp)
 
119
{
 
120
 
 
121
        Element.hide(emp);
 
122
        Element.hide(editmp);
 
123
        Element.show(ump);
 
124
        Element.show(f_editmp);
 
125
}
 
126
 
 
127
updateMountPoint = function (fdiv, emp, editmp, ump, f_editmp)
 
128
{
 
129
        var f = $(fdiv);
 
130
        var voltype = Form.getInputs(fdiv,'radio','vtype').find(function(radio) {
 
131
                return radio.checked;
 
132
        }).value;
 
133
 
 
134
        if (f.nmp.value.strip() == f.ompcompare.value && voltype == f.ovtype.value) {
 
135
                /**
 
136
                 * Cancel update and reset fields to orig values
 
137
                 */
 
138
                Element.hide(ump);
 
139
                Element.hide(f_editmp);
 
140
                Element.show(emp);
 
141
                Element.show(editmp);
 
142
                return false;
 
143
        } else {
 
144
                /**
 
145
                 * Update the mountpoint.
 
146
                 */
 
147
                callAfsFormAction(f, "/openafs/server/updateMountPoint", "optrst");
 
148
                return false;
 
149
        }
 
150
}
 
151
 
 
152
deleteMountPoint = function (mp, div)
 
153
{
 
154
        var msg = "You are about to remove a mount point from the AFS filesystem.";
 
155
        var url = "/openafs/server/deletemountpoint";
 
156
 
 
157
        msg += " \n\nAre you certain you wish to continue?";
 
158
 
 
159
        if (!confirm(msg))
 
160
       return false;
 
161
 
 
162
        var data = {voldn: '<?php echo $this->volEntry->getdn(); ?>', mp: mp, operate_dn: '<?php echo $this->obj->getdn(); ?>'};
 
163
        rpc = Object.toJSON(data);
 
164
 
 
165
        var ma = new Ajax.Updater (
 
166
                {success: div},
 
167
                url,
 
168
                {
 
169
                        method: 'get',
 
170
                        parameters: 'mr='+rpc,
 
171
                        evalScripts: true,
 
172
                        onLoading: function(request) {
 
173
                                showNotify()
 
174
                        },
 
175
                        onComplete:function(request) {
 
176
                                hideNotify()
 
177
                        },
 
178
                }
 
179
        );
 
180
}
 
181
</script>
 
 
b'\\ No newline at end of file'