2008-07-14 21:54:50 +08:00
|
|
|
<?php
|
|
|
|
//
|
|
|
|
// ZoneMinder web options view file, $Date$, $Revision$
|
2008-07-25 17:48:16 +08:00
|
|
|
// Copyright (C) 2001-2008 Philip Coombes
|
2008-07-14 21:54:50 +08:00
|
|
|
//
|
|
|
|
// This program is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU General Public License
|
|
|
|
// as published by the Free Software Foundation; either version 2
|
|
|
|
// of the License, or (at your option) any later version.
|
|
|
|
//
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
// along with this program; if not, write to the Free Software
|
|
|
|
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
//
|
|
|
|
|
|
|
|
if ( !canView( 'System' ) )
|
|
|
|
{
|
2008-09-26 17:47:20 +08:00
|
|
|
$view = "error";
|
2008-07-14 21:54:50 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2008-10-09 17:15:53 +08:00
|
|
|
$canEdit = canEdit( 'System' );
|
|
|
|
|
2008-07-14 21:54:50 +08:00
|
|
|
$tabs = array();
|
|
|
|
$tabs['system'] = $SLANG['System'];
|
|
|
|
$tabs['config'] = $SLANG['Config'];
|
|
|
|
$tabs['paths'] = $SLANG['Paths'];
|
|
|
|
$tabs['web'] = $SLANG['Web'];
|
|
|
|
$tabs['images'] = $SLANG['Images'];
|
|
|
|
$tabs['debug'] = $SLANG['Debug'];
|
|
|
|
$tabs['network'] = $SLANG['Network'];
|
|
|
|
$tabs['mail'] = $SLANG['Email'];
|
|
|
|
$tabs['ftp'] = $SLANG['FTP'];
|
|
|
|
$tabs['x10'] = $SLANG['X10'];
|
|
|
|
$tabs['highband'] = $SLANG['HighBW'];
|
|
|
|
$tabs['medband'] = $SLANG['MediumBW'];
|
|
|
|
$tabs['lowband'] = $SLANG['LowBW'];
|
|
|
|
$tabs['phoneband'] = $SLANG['PhoneBW'];
|
|
|
|
if ( ZM_OPT_USE_AUTH )
|
|
|
|
$tabs['users'] = $SLANG['Users'];
|
|
|
|
|
2008-09-26 17:47:20 +08:00
|
|
|
if ( isset($_REQUEST['tab']) )
|
|
|
|
$tab = validHtmlStr($_REQUEST['tab']);
|
|
|
|
else
|
|
|
|
$tab = "system";
|
2008-07-14 21:54:50 +08:00
|
|
|
|
|
|
|
$focusWindow = true;
|
|
|
|
|
|
|
|
xhtmlHeaders( __FILE__, $SLANG['Options'] );
|
|
|
|
?>
|
|
|
|
<body>
|
|
|
|
<div id="page">
|
|
|
|
<div id="header">
|
|
|
|
<h2><?= $SLANG['Options'] ?></h2>
|
|
|
|
</div>
|
|
|
|
<div id="content">
|
|
|
|
<ul class="tabList">
|
|
|
|
<?php
|
|
|
|
foreach ( $tabs as $name=>$value )
|
|
|
|
{
|
2008-09-26 17:47:20 +08:00
|
|
|
if ( $tab == $name )
|
2008-07-14 21:54:50 +08:00
|
|
|
{
|
|
|
|
?>
|
|
|
|
<li class="active"><?= $value ?></li>
|
|
|
|
<?php
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
?>
|
2008-09-26 17:47:20 +08:00
|
|
|
<li><a href="?view=<?= $view ?>&tab=<?= $name ?>"><?= $value ?></a></li>
|
2008-07-14 21:54:50 +08:00
|
|
|
<?php
|
|
|
|
}
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
</ul>
|
2008-07-18 22:53:44 +08:00
|
|
|
<div class="clear"></div>
|
2008-07-14 21:54:50 +08:00
|
|
|
<?php
|
2008-09-26 17:47:20 +08:00
|
|
|
if ( $tab == "users" )
|
2008-07-14 21:54:50 +08:00
|
|
|
{
|
|
|
|
?>
|
|
|
|
<form name="userForm" method="post" action="<?= $_SERVER['PHP_SELF'] ?>">
|
2008-09-26 17:47:20 +08:00
|
|
|
<input type="hidden" name="view" value="<?= $view ?>"/>
|
|
|
|
<input type="hidden" name="tab" value="<?= $tab ?>"/>
|
2008-07-14 21:54:50 +08:00
|
|
|
<input type="hidden" name="action" value="delete"/>
|
|
|
|
<table id="contentTable" class="major userTable" cellspacing="0">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th class="colUsername"><?= $SLANG['Username'] ?></th>
|
|
|
|
<th class="colLanguage"><?= $SLANG['Language'] ?></th>
|
|
|
|
<th class="colEnabled"><?= $SLANG['Enabled'] ?></th>
|
|
|
|
<th class="colStream"><?= $SLANG['Stream'] ?></th>
|
|
|
|
<th class="colEvents"><?= $SLANG['Events'] ?></th>
|
|
|
|
<th class="colControl"><?= $SLANG['Control'] ?></th>
|
|
|
|
<th class="colMonitors"><?= $SLANG['Monitors'] ?></th>
|
|
|
|
<th class="colSystem"><?= $SLANG['System'] ?></th>
|
|
|
|
<th class="colBandwidth"><?= $SLANG['Bandwidth'] ?></th>
|
|
|
|
<th class="colMonitor"><?= $SLANG['Monitor'] ?></th>
|
|
|
|
<th class="colMark"><?= $SLANG['Mark'] ?></th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
<?php
|
|
|
|
$sql = "select * from Monitors order by Sequence asc";
|
|
|
|
$monitors = array();
|
|
|
|
foreach( dbFetchAll( $sql ) as $monitor )
|
|
|
|
{
|
|
|
|
$monitors[$monitor['Id']] = $monitor;
|
|
|
|
}
|
|
|
|
|
|
|
|
$sql = "select * from Users";
|
|
|
|
foreach( dbFetchAll( $sql ) as $row )
|
|
|
|
{
|
|
|
|
$userMonitors = array();
|
|
|
|
if ( !empty($row['MonitorIds']) )
|
|
|
|
{
|
|
|
|
foreach ( split( ",", $row['MonitorIds'] ) as $monitorId )
|
|
|
|
{
|
|
|
|
$userMonitors[] = $monitors[$monitorId]['Name'];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
<tr>
|
2008-10-09 17:15:53 +08:00
|
|
|
<td class="colUsername"><?= makePopupLink( '?view=user&uid='.$row['Id'], 'zmUser', 'user', validHtmlStr($row['Username']).($user['Username']==$row['Username']?"*":""), $canEdit ) ?></td>
|
2008-09-26 17:47:20 +08:00
|
|
|
<td class="colLanguage"><?= $row['Language']?validHtmlStr($row['Language']):'default' ?></td>
|
2008-07-14 21:54:50 +08:00
|
|
|
<td class="colEnabled"><?= $row['Enabled']?$SLANG['Yes']:$SLANG['No'] ?></td>
|
2008-09-26 17:47:20 +08:00
|
|
|
<td class="colStream"><?= validHtmlStr($row['Stream']) ?></td>
|
|
|
|
<td class="colEvents"><?= validHtmlStr($row['Events']) ?></td>
|
|
|
|
<td class="colControl"><?= validHtmlStr($row['Control']) ?></td>
|
|
|
|
<td class="colMonitors"><?= validHtmlStr($row['Monitors']) ?></td>
|
|
|
|
<td class="colSystem"><?= validHtmlStr($row['System']) ?></td>
|
2008-07-14 21:54:50 +08:00
|
|
|
<td class="colBandwidth"><?= $row['MaxBandwidth']?$bwArray[$row['MaxBandwidth']]:' ' ?></td>
|
|
|
|
<td class="colMonitor"><?= $row['MonitorIds']?(join( ", ", $userMonitors )):" " ?></td>
|
2008-10-09 17:15:53 +08:00
|
|
|
<td class="colMark"><input type="checkbox" name="markUids[]" value="<?= $row['Id'] ?>" onclick="configureDeleteButton( this );"<?php if ( !$canEdit ) { ?> disabled="disabled"<?php } ?>/></td>
|
2008-07-14 21:54:50 +08:00
|
|
|
</tr>
|
|
|
|
<?php
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
<div id="contentButtons">
|
2008-09-01 22:05:06 +08:00
|
|
|
<input type="button" value="<?= $SLANG['AddNewUser'] ?>" onclick="createPopup( '?view=user&uid=0', 'zmUser', 'user' );"<?php if ( !canEdit( 'System' ) ) { ?> disabled="disabled"<?php } ?>/><input type="submit" name="deleteBtn" value="<?= $SLANG['Delete'] ?>" disabled="disabled"/><input type="button" value="<?= $SLANG['Cancel'] ?>" onclick="closeWindow();"/>
|
2008-07-14 21:54:50 +08:00
|
|
|
</div>
|
|
|
|
</form>
|
|
|
|
<?php
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-09-26 17:47:20 +08:00
|
|
|
if ( $tab == "system" )
|
2008-07-14 21:54:50 +08:00
|
|
|
{
|
2008-09-26 17:47:20 +08:00
|
|
|
$configCats[$tab]['ZM_LANG_DEFAULT']['Hint'] = join( '|', getLanguages() );
|
2008-07-14 21:54:50 +08:00
|
|
|
}
|
|
|
|
?>
|
|
|
|
<form name="optionsForm" method="post" action="<?= $_SERVER['PHP_SELF'] ?>">
|
2008-09-26 17:47:20 +08:00
|
|
|
<input type="hidden" name="view" value="<?= $view ?>"/>
|
|
|
|
<input type="hidden" name="tab" value="<?= $tab ?>"/>
|
2008-07-14 21:54:50 +08:00
|
|
|
<input type="hidden" name="action" value="options"/>
|
|
|
|
<table id="contentTable" class="major optionTable" cellspacing="0">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th><?= $SLANG['Name'] ?></th>
|
|
|
|
<th><?= $SLANG['Description'] ?></th>
|
|
|
|
<th><?= $SLANG['Value'] ?></th>
|
|
|
|
</tr>
|
2008-07-18 00:59:25 +08:00
|
|
|
</thead>
|
|
|
|
<tbody>
|
2008-07-14 21:54:50 +08:00
|
|
|
<?php
|
2008-09-26 17:47:20 +08:00
|
|
|
$configCat = $configCats[$tab];
|
2008-07-14 21:54:50 +08:00
|
|
|
foreach ( $configCat as $name=>$value )
|
|
|
|
{
|
2009-02-19 22:17:33 +08:00
|
|
|
$shortName = preg_replace( '/^ZM_/', '', $name );
|
|
|
|
$optionPromptText = !empty($OLANG[$shortName])?$OLANG[$shortName]:$value['Prompt'];
|
2008-07-14 21:54:50 +08:00
|
|
|
?>
|
|
|
|
<tr>
|
2009-02-19 22:17:33 +08:00
|
|
|
<td><?= $shortName ?></td>
|
|
|
|
<td><?= validHtmlStr($optionPromptText) ?> (<?= makePopupLink( '?view=optionhelp&option='.$name, 'zmOptionHelp', 'optionhelp', '?' ) ?>)</td>
|
2008-07-14 21:54:50 +08:00
|
|
|
<?php
|
|
|
|
if ( $value['Type'] == "boolean" )
|
|
|
|
{
|
|
|
|
?>
|
2009-02-19 22:17:33 +08:00
|
|
|
<td><input type="checkbox" id="<?= $name ?>" name="newConfig[<?= $name ?>]" value="1"<?php if ( $value['Value'] ) { ?> checked="checked"<?php } ?><?= $canEdit?'':' disabled="disabled"' ?>/></td>
|
2008-07-14 21:54:50 +08:00
|
|
|
<?php
|
|
|
|
}
|
|
|
|
elseif ( preg_match( "/\|/", $value['Hint'] ) )
|
|
|
|
{
|
|
|
|
?>
|
|
|
|
<td class="nowrap">
|
|
|
|
<?php
|
|
|
|
$options = split( "\|", $value['Hint'] );
|
|
|
|
if ( count( $options ) > 3 )
|
|
|
|
{
|
|
|
|
?>
|
2009-02-19 22:17:33 +08:00
|
|
|
<select name="newConfig[<?= $name ?>] ?>"<?= $canEdit?'':' disabled="disabled"' ?>>
|
2008-07-14 21:54:50 +08:00
|
|
|
<?php
|
|
|
|
foreach ( $options as $option )
|
|
|
|
{
|
|
|
|
?>
|
|
|
|
<option value="<?= $option ?>"<?php if ( $value['Value'] == $option ) { echo ' selected="selected"'; } ?>><?= htmlentities($option) ?></option>
|
|
|
|
<?php
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
</select>
|
|
|
|
<?php
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
foreach ( $options as $option )
|
|
|
|
{
|
|
|
|
?>
|
2009-02-19 22:17:33 +08:00
|
|
|
<span><input type="radio" id="<?= $name.'_'.preg_replace( '/[^a-zA-Z0-9]/', '', $option ) ?>" name="newConfig[<?= $name ?>]" value="<?= $option ?>"<?php if ( $value['Value'] == $option ) { ?> checked="checked"<?php } ?><?= $canEdit?'':' disabled="disabled"' ?>/> <?= $option ?></span>
|
2008-07-14 21:54:50 +08:00
|
|
|
<?php
|
|
|
|
}
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
</td>
|
|
|
|
<?php
|
|
|
|
}
|
|
|
|
elseif ( $value['Type'] == "text" )
|
|
|
|
{
|
|
|
|
?>
|
2009-02-19 22:17:33 +08:00
|
|
|
<td><textarea id="<?= $name ?>" name="newConfig[<?= $name ?>]" rows="5" cols="40"<?= $canEdit?'':' disabled="disabled"' ?>><?= validHtmlStr($value['Value']) ?></textarea></td>
|
2008-07-14 21:54:50 +08:00
|
|
|
<?php
|
|
|
|
}
|
|
|
|
elseif ( $value['Type'] == "integer" )
|
|
|
|
{
|
|
|
|
?>
|
2009-02-19 22:17:33 +08:00
|
|
|
<td><input type="text" id="<?= $name ?>" name="newConfig[<?= $name ?>]" value="<?= validHtmlStr($value['Value']) ?>" class="small"<?= $canEdit?'':' disabled="disabled"' ?>/></td>
|
2008-07-14 21:54:50 +08:00
|
|
|
<?php
|
|
|
|
}
|
|
|
|
elseif ( $value['Type'] == "hexadecimal" )
|
|
|
|
{
|
|
|
|
?>
|
2009-02-19 22:17:33 +08:00
|
|
|
<td><input type="text" id="<?= $name ?>" name="newConfig[<?= $name ?>]" value="<?= validHtmlStr($value['Value']) ?>" class="medium"<?= $canEdit?'':' disabled="disabled"' ?>/></td>
|
2008-07-14 21:54:50 +08:00
|
|
|
<?php
|
|
|
|
}
|
|
|
|
elseif ( $value['Type'] == "decimal" )
|
|
|
|
{
|
|
|
|
?>
|
2009-02-19 22:17:33 +08:00
|
|
|
<td><input type="text" id="<?= $name ?>" name="newConfig[<?= $name ?>]" value="<?= validHtmlStr($value['Value']) ?>" class="small"<?= $canEdit?'':' disabled="disabled"' ?>/></td>
|
2008-07-14 21:54:50 +08:00
|
|
|
<?php
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
?>
|
2009-02-19 22:17:33 +08:00
|
|
|
<td><input type="text" id="<?= $name ?>" name="newConfig[<?= $name ?>]" value="<?= validHtmlStr($value['Value']) ?>" class="large"<?= $canEdit?'':' disabled="disabled"' ?>/></td>
|
2008-07-14 21:54:50 +08:00
|
|
|
<?php
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
</tr>
|
|
|
|
<?php
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
<div id="contentButtons">
|
2008-10-09 17:15:53 +08:00
|
|
|
<input type="submit" value="<?= $SLANG['Save'] ?>"<?= $canEdit?'':' disabled="disabled"' ?>/><input type="button" value="<?= $SLANG['Cancel'] ?>" onclick="closeWindow();"/>
|
2008-07-14 21:54:50 +08:00
|
|
|
</div>
|
|
|
|
</form>
|
|
|
|
<?php
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</body>
|
|
|
|
</html>
|