File: edit_layer.php

package info (click to toggle)
webcalendar 0.9.45-4sarge7
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 2,888 kB
  • ctags: 4,775
  • sloc: php: 16,990; sql: 1,272; perl: 777; sh: 120; makefile: 45
file content (108 lines) | stat: -rw-r--r-- 3,641 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
<?php
include_once 'includes/init.php';

if ( $allow_view_other != 'Y' ) {
  print_header ();
  etranslate("You are not authorized");
  print_trailer ();
  exit;
}

$updating_public = false;
if ( $is_admin && ! empty ( $public ) && $public_access == "Y" ) {
  $updating_public = true;
  $layer_user = "__public__";
} else {
  $layer_user = $login;
}

load_user_layers ( $layer_user, 1 );

$INC = array('js/edit_layer.php');
print_header($INC);
?>

<h2><?php
if ( $updating_public )
  echo translate($PUBLIC_ACCESS_FULLNAME) . " ";
if ( ! empty ( $layers[$id]['cal_layeruser'] ) )
  etranslate("Edit Layer");
else
  etranslate("Add Layer");
?>&nbsp;<img src="help.gif" alt="<?php etranslate("Help")?>" class="help" onclick="window.open ( 'help_layers.php', 'cal_help', 'dependent,menubar,scrollbars,height=400,width=400,innerHeight=420,outerWidth=420' );" /></h2>

<form action="edit_layer_handler.php" method="post" onsubmit="return valid_form(this);" name="prefform">

<?php if ( $updating_public ) { ?>
	<input type="hidden" name="public" value="1" />
<?php } ?>

<table style="border-width:0px;">
<?php
if ( $single_user == "N" ) {
  $userlist = get_my_users ();
  if ($nonuser_enabled == "Y" ) {
    $nonusers = get_nonuser_cals ();
    $userlist = ($nonuser_at_top == "Y") ? array_merge($nonusers, $userlist) : array_merge($userlist, $nonusers);
  }
  $num_users = 0;
  $size = 0;
  $users = "";
  for ( $i = 0; $i < count ( $userlist ); $i++ ) {
    if ( $userlist[$i]['cal_login'] != $layer_user ) {
      $size++;
      $users .= "<option value=\"" . $userlist[$i]['cal_login'] . "\"";
      if ( ! empty ( $layers[$id]['cal_layeruser'] ) ) {
        if ( $layers[$id]['cal_layeruser'] == $userlist[$i]['cal_login'] )
          $users .= " selected=\"selected\"";
      } 
      $users .= ">" . $userlist[$i]['cal_fullname'] . "</option>\n";
    }
  }
  if ( $size > 50 )
    $size = 15;
  else if ( $size > 5 )
    $size = 5;
  if ( $size >= 1 ) {
	print "<tr><td style=\"vertical-align:top; font-weight:bold;\">\n<label for=\"layeruser\">" .
      translate("Source") . ":</label></td><td>\n";
    print "<select name=\"layeruser\" id=\"layeruser\" size=\"1\">$users\n";
    print "</select>\n";
    print "</td></tr>\n";
  }
}
?>

<tr><td>
	<label for="layercolor"><?php etranslate("Color")?>:</label></td><td>
	<input type="text" name="layercolor" id="layercolor" size="7" maxlength="7" value="<?php echo empty ( $layers[$id]['cal_color'] ) ? "" :  $layers[$id]['cal_color']; ?>" />
	<input type="button" onclick="selectColor('layercolor')" value="<?php etranslate("Select")?>..." />
</td></tr>

<tr><td style="font-weight:bold;">
	<?php etranslate("Duplicates")?>:</td><td>
	<label><input type="checkbox" name="dups" value="Y" <?php if ( ! empty ( $layers[$id]['cal_dups'] ) && $layers[$id]['cal_dups'] == 'Y') echo " checked=\"checked\""; ?> />&nbsp;<?php etranslate("Show layer events that are the same as your own")?></label>
</td></tr>

<tr><td colspan="2">
	<input type="submit" value="<?php etranslate("Save")?>" />
</td></tr>
<?php
// If a layer already exists put a 'Delete Layer' link
if ( ! empty ( $layers[$id]['cal_layeruser'] ) ) { ?>
<tr><td>
	<br /><a href="del_layer.php?id=<?php echo $id; if ( $updating_public ) echo "&amp;public=1"; ?>" onclick="return confirm('<?php etranslate("Are you sure you want to delete this layer?")?>');"><?php etranslate("Delete layer")?></a><br />
</td></tr>
<?php
}  // end 'Delete Layer' link
?>
</table>

<?php if ( ! empty ( $layers[$id]['cal_layeruser'] ) )
	echo "<input type=\"hidden\" name=\"id\" value=\"$id\" />\n";
?>
</form>

<?php print_trailer(); ?>
</body>
</html>