~ubuntu-branches/ubuntu/raring/webcalendar/raring

« back to all changes in this revision

Viewing changes to edit_remotes.php

  • Committer: Bazaar Package Importer
  • Author(s): Rafael Laboissiere
  • Date: 2009-06-09 06:26:24 UTC
  • mfrom: (18.2.3 karmic)
  • Revision ID: james.westby@ubuntu.com-20090609062624-9n9xea2ftpipmg38
Tags: 1.2.0+dfsg-4
* debian/patches/06_send-reminder-paths.diff: Adjust patch to help
  translate.php to find the translation files under /etc/webcalendar.
  Thanks to Dale and Cheryl Schroeder for the help on debugging this
  (really, closes: #531312).
* debian/patches/16_no-blink-public-access-title.diff: New patch for
  avoiding the blinking title when changing the Public Access title in
  English-US.txt

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php
 
2
/* Allows a user to specify a remote calendar by URL that can be imported
 
3
 * manually into the NUC calendar specified. The user will also be allowed to
 
4
 * create a layer to display this calendar on top of their own calendar.
 
5
 *
 
6
 * @author Ray Jones <rjones@umces.edu>
 
7
 * @copyright Craig Knudsen, <cknudsen@cknudsen.com>, http://www.k5n.us/cknudsen
 
8
 * @license http://www.gnu.org/licenses/gpl.html GNU GPL
 
9
 * @version $Id: edit_remotes.php,v 1.17.2.4 2007/11/12 20:47:48 umcesrjones Exp $
 
10
 * @package WebCalendar
 
11
 * @subpackage Edit Remotes
 
12
 *
 
13
 * Security
 
14
 * $REMOTES_ENABLED must be enabled under System Settings and if
 
15
 * if UAC is enabled, then the user must be allowed to ACCESS_IMPORT.
 
16
*/
 
17
include_once 'includes/init.php';
 
18
print_header ( array ( 'js/edit_remotes.php/false', 'js/visible.php' ),
 
19
  '', '', true );
 
20
 
 
21
$error = '';
 
22
 
 
23
if ( ! $NONUSER_PREFIX )
 
24
  $error = translate ( 'NONUSER_PREFIX not set' );
 
25
 
 
26
if ( $REMOTES_ENABLED != 'Y' || ( access_is_enabled () && !
 
27
      access_can_access_function ( ACCESS_IMPORT ) ) )
 
28
  $error = print_not_auth (11);
 
29
 
 
30
if ( $error ) {
 
31
  echo print_error ( $error ) . '
 
32
  </body>
 
33
</html>';
 
34
  exit;
 
35
}
 
36
$add = getValue ( 'add' );
 
37
$nid = getValue ( 'nid' );
 
38
 
 
39
// Adding/Editing remote calendar.
 
40
if ( ( $add == '1' || ! empty ( $nid ) ) && empty ( $error ) ) {
 
41
  $userlist = get_nonuser_cals ( $login, true );
 
42
 
 
43
  if ( empty ( $nid ) ) {
 
44
    $id_display = '<input type="text" name="nid" id="nid" size="20" '
 
45
     . 'maxlength="20" onchange="check_name();" /> '
 
46
     . translate ( 'word characters only' );
 
47
    $lableStr = translate ( 'Add Remote Calendar' );
 
48
  } else {
 
49
    $nid = clean_html ( $nid );
 
50
    nonuser_load_variables ( $nid, 'remotestemp_' );
 
51
 
 
52
    $button = translate ( 'Save' );
 
53
                $buttonAction = 'Save';
 
54
    $id_display = $nid . ' <input type="hidden" name="nid" id="nid" value="'
 
55
     . $nid . '" />';
 
56
    $lableStr = translate ( 'Edit Remote Calendar' );
 
57
    $remotestemp_login = substr ( $remotestemp_login, strlen ( $NONUSER_PREFIX ) );
 
58
  }
 
59
 
 
60
  $button = translate ( 'Add' );
 
61
        $buttonAction = 'Add';
 
62
  $calIdStr = translate ( 'Calendar ID' );
 
63
  $colorStr = translate ( 'Color' );
 
64
  $confirmStr = str_replace ( 'XXX', translate ( 'entry' ),
 
65
    translate ( 'Are you sure you want to delete this XXX?' ) );
 
66
  $createLayerStr = translate ( 'Create Layer' );
 
67
  $deleteStr = translate ( 'Delete' );
 
68
  $firstNameStr = translate ( 'First Name' );
 
69
  $lastNameStr = translate ( 'Last Name' );
 
70
  $reloadStr = translate ( 'Reload' );
 
71
  $requiredStr = translate ( 'Required to View Remote Calendar' );
 
72
  $selectStr = translate ( 'Select' );
 
73
  $urlStr = translate ( 'URL' );
 
74
 
 
75
  $firstNameValue = ( empty ( $remotestemp_firstname )
 
76
    ? '' : htmlspecialchars ( $remotestemp_firstname ) );
 
77
  $lastNameValue = ( empty ( $remotestemp_lastname )
 
78
    ? '' : htmlspecialchars ( $remotestemp_lastname ) );
 
79
  $urlValue = ( empty ( $remotestemp_url )
 
80
    ? '' : htmlspecialchars ( $remotestemp_url ) );
 
81
 
 
82
  echo <<<EOT
 
83
    <h2>{$lableStr}</h2>
 
84
    <form action="edit_remotes_handler.php" method="post" name="prefform"
 
85
      onsubmit="return valid_form( this );">
 
86
      <table cellspacing="0" cellpadding="2">
 
87
        <tr>
 
88
          <td><label for="calid">{$calIdStr}:</label></td>
 
89
          <td colspan="3">{$id_display}</td>
 
90
        </tr>
 
91
        <tr>
 
92
          <td><label for="nfirstname">{$firstNameStr}:</label></td>
 
93
          <td colspan="3"><input type="text" name="nfirstname" id="nfirstname"
 
94
            size="20" maxlength="25" value="{$firstNameValue}" /></td>
 
95
        </tr>
 
96
        <tr>
 
97
          <td><label for="nlastname">{$lastNameStr}:</label></td>
 
98
          <td colspan="3"><input type="text" name="nlastname" id="nlastname"
 
99
            size="20" maxlength="25" value="{$lastNameValue}" /></td>
 
100
        </tr>
 
101
        <tr>
 
102
          <td><label for="nurl">{$urlStr}:</label></td>
 
103
          <td colspan="3"><input type="text" name="nurl" id="nurl" size="75"
 
104
            maxlength="255" value="{$urlValue}" /></td>
 
105
        </tr>
 
106
EOT;
 
107
  if ( empty ( $nid ) ) {
 
108
    echo <<<EOT
 
109
        <tr>
 
110
          <td><label for="nlayer">{$createLayerStr}:</label></td>
 
111
          <td colspan="3">
 
112
            <input type="hidden" name="reload" id="reload" value="true" />
 
113
            <input type="checkbox" name="nlayer" id="nlayer" value="Y"
 
114
              onchange="toggle_layercolor();" />{$requiredStr}
 
115
          </td>
 
116
        </tr>
 
117
        <tr id="nlayercolor" style="visibility:hidden" >
 
118
          <td>
 
119
EOT;
 
120
    echo print_color_input_html ( 'layercolor', $colorStr, '#000000' ) . '
 
121
          </td>
 
122
        </tr>';
 
123
  }
 
124
  echo <<<EOT
 
125
      </table>
 
126
      <input type="hidden" name="nadmin" id="nadmin" value="{$login}" />
 
127
      <input type="submit" name="{$buttonAction}" value="{$button}" />
 
128
EOT;
 
129
 
 
130
  if ( ! empty ( $nid ) )
 
131
    echo <<<EOT
 
132
      <input type="submit" name="delete" value="{$deleteStr}"
 
133
        onclick="return confirm( '{$confirmStr}' )" />
 
134
      <input type="submit" name="reload" value="{$reloadStr}" />
 
135
EOT;
 
136
 
 
137
  echo '
 
138
    </form>';
 
139
}
 
140
echo print_trailer ( false, true, true );
 
141
 
 
142
?>