This commit is contained in:
Andrew Bauer 2017-05-10 08:08:55 -05:00
commit f5c09d5a0b
22 changed files with 370 additions and 160 deletions

4
.eslintignore Normal file
View File

@ -0,0 +1,4 @@
web/api/lib
web/skins/classic/js/jquery-1.11.3.js
web/skins/classic/js/jquery.js
web/tools/mootools

29
.eslintrc.js Normal file
View File

@ -0,0 +1,29 @@
"use strict";
module.exports = {
"env": {
"browser": true,
},
"extends": ["google"],
"rules": {
"brace-style": "off",
"camelcase": "off",
"comma-dangle": "off",
"key-spacing": "off",
"max-len": "off",
"new-cap": ["error", {
capIsNewExceptions: ["Error", "Warning", "Debug", "Polygon_calcArea", "Play", "Stop"],
newIsCapExceptionPattern: "^Asset\.."
}],
"no-array-constructor": "off",
"no-caller": "off",
"no-new-object": "off",
"no-unused-vars": "off",
"no-var": "off",
"object-curly-spacing": "off",
"prefer-rest-params": "off",
"quotes": "off",
"require-jsdoc": "off",
"spaced-comment": "off",
},
};

View File

@ -287,19 +287,19 @@ To build the latest master snapshot:
:: ::
./do_debian_package.sh `lsb_release -a 2>/dev/null | grep Codename | awk '{print $2}'` `date +%Y%m%d`01 local master ./do_debian_package.sh --snapshot=NOW --branch=master --type=local
To build the latest stable release: To build the latest stable release:
:: ::
./do_debian_package.sh `lsb_release -a 2>/dev/null | grep Codename | awk '{print $2}'` `date +%Y%m%d`01 local stable ./do_debian_package.sh --snapshot=stable --type=local
Note that the ``lsb_release -a 2>/dev/null | grep Codename | awk '{print $2}'`` Note that the distribution will be guessed using ``lsb_release -a 2>/dev/null | grep Codename | awk '{print $2}'``
part simply extracts your distribution name - like "vivid", "trusty" etc. You which simply extracts your distribution name - like "vivid", "trusty" etc. You
can always replace it by your distro name if you know it. As far as the script can always specify it using --distro=your distro name if you know it. As far as the script
goes, it checks if your distro is "trusty" in which case it pulls in pre-systemd goes, it checks if your distro is "trusty" in which case it pulls in pre-systemd
release configurations and if its not "trusty" it assumes its based on systemd release configurations and if its not "trusty" it assumes its based on systemd
and pulls in systemd related config files. and pulls in systemd related config files.

View File

@ -8,88 +8,272 @@ exit;
fi fi
for i in "$@"
do
case $i in
-b=*|--branch=*)
BRANCH="${i#*=}"
shift # past argument=value
;;
-d=*|--distro=*)
DISTRO="${i#*=}"
shift # past argument=value
;;
-i=*|--interactive=*)
INTERACTIVE="${i#*=}"
shift # past argument=value
;;
-r=*|--release=*)
RELEASE="${i#*=}"
shift
;;
-s=*|--snapshot=*)
SNAPSHOT="${i#*=}"
shift # past argument=value
;;
-t=*|--type=*)
TYPE="${i#*=}"
shift # past argument=value
;;
-u=*|--urgency=*)
URGENCY="${i#*=}"
shift # past argument=value
;;
-f=*|--fork=*)
GITHUB_FORK="${i#*=}"
shift # past argument=value
;;
-v=*|--version=*)
PACKAGE_VERSION="${i#*=}"
shift
;;
--default)
DEFAULT=YES
shift # past argument with no value
;;
*)
# unknown option
read -p "Unknown option $i, continue? (Y|n)"
[[ $REPLY == [yY] ]] && { echo "continuing..."; } || exit 1;
;;
esac
done
DATE=`date -R` DATE=`date -R`
DISTRO=$1
SNAPSHOT=$2
if [ "$SNAPSHOT" == "stable" ]; then
SNAPSHOT="";
fi;
TYPE=$3
if [ "$TYPE" == "" ]; then if [ "$TYPE" == "" ]; then
TYPE="source"; echo "Defaulting to source build"
TYPE="source";
fi; fi;
BRANCH=$4
if [ "$DISTRO" == "" ]; then
DISTRO=`lsb_release -a 2>/dev/null | grep Codename | awk '{print $2}'`;
echo "Defaulting to $DISTRO for distribution";
else
echo "Building for $DISTRO";
fi;
# Release is a special mode... it uploads to the release ppa and cannot have a snapshot
if [ "$RELEASE" != "" ]; then
if [ "$SNAPSHOT" != "" ]; then
echo "Releases cannot have a snapshot.... exiting."
exit 0;
fi
if [ "$GITHUB_FORK" != "" ] && [ "$GITHUB_FORK" != "ZoneMinder" ]; then
echo "Releases cannot have a fork ($GITHUB_FORK).... exiting."
exit 0;
fi
BRANCH="release-$RELEASE"
else
if [ "$GITHUB_FORK" == "" ]; then
echo "Defaulting to ZoneMinder upstream git"
GITHUB_FORK="ZoneMinder"
fi;
if [ "$SNAPSHOT" == "stable" ]; then
if [ "$BRANCH" == "" ]; then
BRANCH=$(git describe --tags $(git rev-list --tags --max-count=1));
echo "Latest stable branch is $BRANCH";
fi;
else
if [ "$BRANCH" == "" ]; then
echo "Defaulting to master branch";
BRANCH="master";
fi;
if [ "$SNAPSHOT" == "NOW" ]; then
SNAPSHOT=`date +%Y%m%d%H%M%S`;
fi;
fi;
fi
if [ ! -d 'zoneminder_release' ]; then # Instead of cloning from github each time, if we have a fork lying around, update it and pull from there instead.
git clone https://github.com/ZoneMinder/ZoneMinder.git zoneminder_release if [ ! -d "${GITHUB_FORK}_zoneminder_release" ]; then
if [ -d "${GITHUB_FORK}_ZoneMinder.git" ]; then
echo "Using local clone ${GITHUB_FORK}_ZoneMinder.git to pull from."
cd "${GITHUB_FORK}_ZoneMinder.git"
echo "git pull..."
git pull
echo "git checkout $BRANCH"
git checkout $BRANCH
echo "git pull..."
git pull
cd ../
echo "git clone ${GITHUB_FORK}_ZoneMinder.git ${GITHUB_FORK}_zoneminder_release"
git clone "${GITHUB_FORK}_ZoneMinder.git" "${GITHUB_FORK}_zoneminder_release"
else
echo "git clone https://github.com/$GITHUB_FORK/ZoneMinder.git ${GITHUB_FORK}_zoneminder_release"
git clone "https://github.com/$GITHUB_FORK/ZoneMinder.git" "${GITHUB_FORK}_zoneminder_release"
fi
else
echo "release dir already exists. Please remove it."
exit 0;
fi; fi;
if [ "$BRANCH" != "" ]; then
cd zoneminder_release
if [ "$BRANCH" == "stable" ]; then
BRANCH=$(git describe --tags $(git rev-list --tags --max-count=1));
echo "Latest stable branch is $BRANCH";
fi cd "${GITHUB_FORK}_zoneminder_release"
git checkout $BRANCH if [ $RELEASE ]; then
cd ../ git checkout $RELEASE
else
git checkout $BRANCH
fi; fi;
VERSION=`cat zoneminder_release/version` cd ../
VERSION=`cat ${GITHUB_FORK}_zoneminder_release/version`
if [ $VERSION == "" ]; then if [ $VERSION == "" ]; then
exit 1; exit 1;
fi; fi;
echo "Doing $TYPE release zoneminder_$VERSION-$DISTRO-$SNAPSHOT"; if [ "$SNAPSHOT" != "stable" ] && [ "$SNAPSHOT" != "" ]; then
mv zoneminder_release zoneminder_$VERSION-$DISTRO-$SNAPSHOT.orig VERSION="$VERSION~$SNAPSHOT";
cd zoneminder_$VERSION-$DISTRO-$SNAPSHOT.orig
git submodule init
git submodule update --init --recursive
if [ $DISTRO == "trusty" ]; then
ln -sf distros/ubuntu1204 debian
else
ln -sf distros/ubuntu1604 debian
fi; fi;
# Auto-install all ZoneMinder's depedencies using the Debian control file DIRECTORY="zoneminder_$VERSION";
sudo apt-get install devscripts equivs echo "Doing $TYPE release $DIRECTORY";
sudo mk-build-deps -ir ./debian/control mv "${GITHUB_FORK}_zoneminder_release" "$DIRECTORY.orig";
cd "$DIRECTORY.orig";
if [ -z `hostname -d` ] ; then git submodule init
AUTHOR="`getent passwd $USER | cut -d ':' -f 5 | cut -d ',' -f 1` <`whoami`@`hostname`.local>" git submodule update --init --recursive
if [ "$DISTRO" == "trusty" ] || [ "$DISTRO" == "precise" ]; then
mv distros/ubuntu1204 debian
else else
AUTHOR="`getent passwd $USER | cut -d ':' -f 5 | cut -d ',' -f 1` <`whoami`@`hostname`>" if [ "$DISTRO" == "wheezy" ]; then
mv distros/debian debian
else
mv distros/ubuntu1604 debian
fi;
fi;
if [ "$DEBEMAIL" != "" ] && [ "$DEBFULLNAME" != "" ]; then
AUTHOR="$DEBFULLNAME <$DEBEMAIL>"
else
if [ -z `hostname -d` ] ; then
AUTHOR="`getent passwd $USER | cut -d ':' -f 5 | cut -d ',' -f 1` <`whoami`@`hostname`.local>"
else
AUTHOR="`getent passwd $USER | cut -d ':' -f 5 | cut -d ',' -f 1` <`whoami`@`hostname`>"
fi
fi fi
if [ "$URGENCY" = "" ]; then
URGENCY="medium"
fi;
if [ "$SNAPSHOT" == "stable" ]; then
cat <<EOF > debian/changelog cat <<EOF > debian/changelog
zoneminder ($VERSION-$DISTRO-$SNAPSHOT) $DISTRO; urgency=medium zoneminder ($VERSION-$DISTRO${PACKAGE_VERSION}) $DISTRO; urgency=$URGENCY
* Release $VERSION
-- $AUTHOR $DATE
EOF
else
cat <<EOF > debian/changelog
zoneminder ($VERSION-$DISTRO${PACKAGE_VERSION}) $DISTRO; urgency=$URGENCY
* *
-- $AUTHOR $DATE -- $AUTHOR $DATE
EOF EOF
#rm -rf .git fi;
#rm .gitignore
#cd ../ rm -rf .git
#tar zcf zoneminder_$VERSION-$DISTRO.orig.tar.gz zoneminder_$VERSION-$DISTRO-$SNAPSHOT.orig rm .gitignore
#cd zoneminder_$VERSION-$DISTRO-$SNAPSHOT.orig cd ../
tar zcf $DIRECTORY.orig.tar.gz $DIRECTORY.orig
cd $DIRECTORY.orig
if [ $TYPE == "binary" ]; then if [ $TYPE == "binary" ]; then
debuild # Auto-install all ZoneMinder's depedencies using the Debian control file
sudo apt-get install devscripts equivs
sudo mk-build-deps -ir ./debian/control
echo "Status: $?"
DEBUILD=debuild
else else
if [ $TYPE == "local" ]; then if [ $TYPE == "local" ]; then
debuild -i -us -uc -b # Auto-install all ZoneMinder's depedencies using the Debian control file
else sudo apt-get install devscripts equivs
debuild -S -sa sudo mk-build-deps -ir ./debian/control
fi; echo "Status: $?"
DEBUILD="debuild -i -us -uc -b"
else
DEBUILD="debuild -S -sa"
fi;
fi;
if [ "$DEBSIGN_KEYID" != "" ]; then
DEBUILD="$DEBUILD -k$DEBSIGN_KEYID"
fi
$DEBUILD
if [ $? -ne 0 ]; then
echo "Error status code is: $?"
echo "Build failed.";
exit $?;
fi; fi;
cd ../ cd ../
if [ "$INTERACTIVE" != "no" ]; then
read -p "Do you want to keep the checked out version of Zoneminder (incase you want to modify it later) [y/N]"
[[ $REPLY == [yY] ]] && { mv $DIRECTORY zoneminder_release; echo "The checked out copy is preserved in zoneminder_release"; } || { rm -fr $DIRECTORY; echo "The checked out copy has been deleted"; }
echo "Done!"
else
rm -fr $DIRECTORY; echo "The checked out copy has been deleted";
fi
read -p "Do you want to keep the checked out version of Zoneminder (incase you want to modify it later) [y/N]" if [ $TYPE == "binary" ]; then
[[ $REPLY == [yY] ]] && { mv zoneminder_$VERSION-$DISTRO-$SNAPSHOT.orig zoneminder_release; echo "The checked out copy is preserved in zoneminder_release"; } || { rm -fr zoneminder_$VERSION-$DISTRO-$SNAPSHOT.orig; echo "The checked out copy has been deleted"; } if [ "$INTERACTIVE" != "no" ]; then
echo "Done!" echo "Not doing dput since it's a binary release. Do you want to install it? (Y/N)"
read install
if [ "$install" == "Y" ]; then
sudo dpkg -i $DIRECTORY*.deb
fi;
if [ "$DISTRO" == "jessie" ]; then
echo "Do you want to upload this binary to zmrepo? (y/N)"
read install
if [ "$install" == "Y" ]; then
scp "zoneminder_*-${VERSION}-${DISTRO}*" "zmrepo@zmrepo.connortechnology.com:debian/${BRANCH}/mini-dinstall/incoming/"
fi;
fi;
fi;
else
SC="zoneminder_${VERSION}-${DISTRO}${PACKAGE_VERSION}_source.changes";
PPA="";
if [ "$RELEASE" != "" ]; then
PPA="ppa:iconnor/zoneminder";
else
if [ "$BRANCH" == "" ]; then
PPA="ppa:iconnor/zoneminder-master";
else
PPA="ppa:iconnor/zoneminder-$BRANCH";
fi;
fi;
dput="Y";
if [ "$INTERACTIVE" != "no" ]; then
echo "Ready to dput $SC to $PPA ? Y/N...";
read dput
fi
if [ "$dput" == "Y" -o "$dput" == "y" ]; then
dput $PPA $SC
fi;
fi;

View File

@ -115,4 +115,4 @@ window.onerror =
function( message, url, line ) function( message, url, line )
{ {
logReport( "ERR", message, url, line ); logReport( "ERR", message, url, line );
} };

View File

@ -116,7 +116,7 @@ function setupOverlays()
overlay.getElements('.overlayCloser').each( overlay.getElements('.overlayCloser').each(
function( closer ) function( closer )
{ {
closer.addEvent( 'click', function() { overlay.element.hide(); } ) closer.addEvent( 'click', function() { overlay.element.hide(); } );
} }
); );
overlay.overlayShow = function() { overlay.element.show(); }; overlay.overlayShow = function() { overlay.element.show(); };

View File

@ -33,7 +33,7 @@ var popupSizes = {
'device': { 'width': 260, 'height': 150 }, 'device': { 'width': 260, 'height': 150 },
'devices': { 'width': 400, 'height': 240 }, 'devices': { 'width': 400, 'height': 240 },
'donate': { 'width': 500, 'height': 280 }, 'donate': { 'width': 500, 'height': 280 },
'event': { 'addWidth': 108, 'minWidth': 496, 'addHeight': 230, minHeight: 540 }, 'event': { 'addWidth': 108, 'minWidth': 496, 'addHeight': 230, 'minHeight': 540 },
'eventdetail': { 'width': 600, 'height': 220 }, 'eventdetail': { 'width': 600, 'height': 220 },
'events': { 'width': 960, 'height': 780 }, 'events': { 'width': 960, 'height': 780 },
'export': { 'width': 400, 'height': 340 }, 'export': { 'width': 400, 'height': 340 },

View File

@ -33,7 +33,7 @@ var popupSizes = {
'device': { 'width': 260, 'height': 150 }, 'device': { 'width': 260, 'height': 150 },
'devices': { 'width': 400, 'height': 240 }, 'devices': { 'width': 400, 'height': 240 },
'donate': { 'width': 500, 'height': 280 }, 'donate': { 'width': 500, 'height': 280 },
'event': { 'addWidth': 108, 'minWidth': 496, 'addHeight': 230, minHeight: 540 }, 'event': { 'addWidth': 108, 'minWidth': 496, 'addHeight': 230, 'minHeight': 540 },
'eventdetail': { 'width': 600, 'height': 220 }, 'eventdetail': { 'width': 600, 'height': 220 },
'events': { 'width': 960, 'height': 780 }, 'events': { 'width': 960, 'height': 780 },
'export': { 'width': 400, 'height': 340 }, 'export': { 'width': 400, 'height': 340 },

View File

@ -33,7 +33,7 @@ var popupSizes = {
'device': { 'width': 260, 'height': 150 }, 'device': { 'width': 260, 'height': 150 },
'devices': { 'width': 400, 'height': 240 }, 'devices': { 'width': 400, 'height': 240 },
'donate': { 'width': 500, 'height': 280 }, 'donate': { 'width': 500, 'height': 280 },
'event': { 'addWidth': 108, 'minWidth': 496, 'addHeight': 230, minHeight: 540 }, 'event': { 'addWidth': 108, 'minWidth': 496, 'addHeight': 230, 'minHeight': 540 },
'eventdetail': { 'width': 600, 'height': 220 }, 'eventdetail': { 'width': 600, 'height': 220 },
'events': { 'width': 1080, 'height': 780 }, 'events': { 'width': 1080, 'height': 780 },
'export': { 'width': 400, 'height': 340 }, 'export': { 'width': 400, 'height': 340 },

View File

@ -31,11 +31,11 @@ function checkSize() {
var h = window.outerHeight; var h = window.outerHeight;
var prevH = h; var prevH = h;
if (h > screen.availHeight) if (h > screen.availHeight)
h = screen.availHeight; h = screen.availHeight;
if (w > screen.availWidth) if (w > screen.availWidth)
w = screen.availWidth; w = screen.availWidth;
if (w != prevW || h != prevH) if (w != prevW || h != prevH)
window.resizeTo(w,h); window.resizeTo(w, h);
} }
} }
@ -56,7 +56,7 @@ function getPopupSize( tag, width, height )
if ( popupSize.width && popupSize.height ) if ( popupSize.width && popupSize.height )
{ {
if ( width || height ) if ( width || height )
Warning( "Ignoring passed dimensions "+width+"x"+height+" when getting popup size for tag '"+tag+"'" ); Warning( "Ignoring passed dimensions "+width+"x"+height+" when getting popup size for tag '"+tag+"'" );
return( popupSize ); return( popupSize );
} }
if ( popupSize.addWidth ) if ( popupSize.addWidth )

View File

@ -25,15 +25,14 @@ function setButtonStates( element )
function addMonitor( element) function addMonitor( element)
{ {
var form = element.form;
var form = element.form; var dupParam;
var dupParam; var monitorId=-1;
var monitorId=-1; if (form.addBtn.value == jsTranslatedCloneText)
if (form.addBtn.value == jsTranslatedCloneText)
{ {
// get the value of the first checkbox // get the value of the first checkbox
for ( var i = 0; i < form.elements.length; i++ ) for ( var i = 0; i < form.elements.length; i++ )
{ {
if ( form.elements[i].type == "checkbox" ) if ( form.elements[i].type == "checkbox" )
{ {
if ( form.elements[i].checked ) if ( form.elements[i].checked )
@ -42,10 +41,10 @@ function addMonitor( element)
break; break;
} }
} }
} }
} }
dupParam = (monitorId == -1 ) ? '': '&dupId='+monitorId; dupParam = (monitorId == -1 ) ? '': '&dupId='+monitorId;
createPopup( '?view=monitor'+dupParam, 'zmMonitor0','monitor' ); createPopup( '?view=monitor'+dupParam, 'zmMonitor0', 'monitor' );
} }
function editMonitor( element ) function editMonitor( element )
@ -85,8 +84,8 @@ function reloadWindow()
function initPage() function initPage()
{ {
jsTranslatedAddText = translatedAddText; jsTranslatedAddText = translatedAddText;
jsTranslatedCloneText = translatedCloneText; jsTranslatedCloneText = translatedCloneText;
reloadWindow.periodical( consoleRefreshTimeout ); reloadWindow.periodical( consoleRefreshTimeout );
if ( showVersionPopup ) if ( showVersionPopup )
createPopup( '?view=version', 'zmVersion', 'version' ); createPopup( '?view=version', 'zmVersion', 'version' );

View File

@ -26,7 +26,7 @@ function controlCmd( control, event, xtell, ytell )
var x = xEvent.page.x - l; var x = xEvent.page.x - l;
var y = xEvent.page.y - t; var y = xEvent.page.y - t;
if ( xtell ) if ( xtell )
{ {
var xge = parseInt( (x*100)/coords.width ); var xge = parseInt( (x*100)/coords.width );
if ( xtell == -1 ) if ( xtell == -1 )
@ -35,7 +35,7 @@ function controlCmd( control, event, xtell, ytell )
xge = 2*(50 - xge); xge = 2*(50 - xge);
locParms += "&xge="+xge; locParms += "&xge="+xge;
} }
if ( ytell ) if ( ytell )
{ {
var yge = parseInt( (y*100)/coords.height ); var yge = parseInt( (y*100)/coords.height );
if ( ytell == -1 ) if ( ytell == -1 )

View File

@ -19,6 +19,5 @@ function validateForm( form ) {
return( false ); return( false );
} }
return( true ); return( true );
} }

View File

@ -25,7 +25,7 @@ function changeReplayMode()
{ {
var replayMode = $('replayMode').get('value'); var replayMode = $('replayMode').get('value');
Cookie.write( 'replayMode', replayMode, { duration: 10*365 }) Cookie.write( 'replayMode', replayMode, { duration: 10*365 });
refreshWindow(); refreshWindow();
} }
@ -38,7 +38,7 @@ var lastEventId = 0;
function getCmdResponse( respObj, respText ) function getCmdResponse( respObj, respText )
{ {
if ( checkStreamForErrors( "getCmdResponse" ,respObj ) ) if ( checkStreamForErrors( "getCmdResponse", respObj ) )
return; return;
if ( streamCmdTimer ) if ( streamCmdTimer )
@ -477,7 +477,7 @@ function checkFrames( eventId, frameId, loadImage )
if ( !$('eventThumb'+fid) ) if ( !$('eventThumb'+fid) )
{ {
var img = new Element( 'img', { 'id': 'eventThumb'+fid, 'src': 'graphics/transparent.gif', 'alt': fid, 'class': 'placeholder' } ); var img = new Element( 'img', { 'id': 'eventThumb'+fid, 'src': 'graphics/transparent.gif', 'alt': fid, 'class': 'placeholder' } );
img.addEvent( 'click', function () { eventData['frames'][fid] = null; checkFrames( eventId, fid ) } ); img.addEvent( 'click', function() { eventData['frames'][fid] = null; checkFrames( eventId, fid ); } );
frameQuery( eventId, fid, loadImage && (fid == frameId) ); frameQuery( eventId, fid, loadImage && (fid == frameId) );
var imgs = $('eventThumbs').getElements( 'img' ); var imgs = $('eventThumbs').getElements( 'img' );
var injected = false; var injected = false;
@ -689,7 +689,7 @@ function drawProgressBar()
var offset = parseInt((index*eventData.Length)/$$(cells).length); var offset = parseInt((index*eventData.Length)/$$(cells).length);
$(cell).setProperty( 'title', '+'+secsToTime(offset)+'s' ); $(cell).setProperty( 'title', '+'+secsToTime(offset)+'s' );
$(cell).removeEvent( 'click' ); $(cell).removeEvent( 'click' );
$(cell).addEvent( 'click', function(){ streamSeek( offset ); } ); $(cell).addEvent( 'click', function() { streamSeek( offset ); } );
barWidth += $(cell).getCoordinates().width; barWidth += $(cell).getCoordinates().width;
} }
); );

View File

@ -9,7 +9,6 @@ if ( refreshParent )
} }
function configureButtons( element ) { function configureButtons( element ) {
if ( canEditGroups ) { if ( canEditGroups ) {
var form = element.form; var form = element.form;
form.saveBtn.disabled = (element.value == 0); form.saveBtn.disabled = (element.value == 0);

View File

@ -22,7 +22,7 @@ var logTimeout = maxSampleTime;
var firstLoad = true; var firstLoad = true;
var initialDisplayLimit = 200; var initialDisplayLimit = 200;
var sortReversed = false; var sortReversed = false;
var filterFields = [ 'Component', 'ServerId', 'Pid', 'Level', 'File', 'Line']; var filterFields = ['Component', 'ServerId', 'Pid', 'Level', 'File', 'Line'];
var options = {}; var options = {};
function buildFetchParms( parms ) function buildFetchParms( parms )
@ -68,7 +68,7 @@ function logResponse( respObj )
maxLogTime = log.TimeKey; maxLogTime = log.TimeKey;
if ( !minLogTime || log.TimeKey < minLogTime ) if ( !minLogTime || log.TimeKey < minLogTime )
minLogTime = log.TimeKey; minLogTime = log.TimeKey;
var row = logTable.push( [ { content: log.DateTime, properties: { style: 'white-space: nowrap' }}, log.Component, log.Server, log.Pid, log.Code, log.Message, log.File, log.Line ] ); var row = logTable.push( [{ content: log.DateTime, properties: { style: 'white-space: nowrap' }}, log.Component, log.Server, log.Pid, log.Code, log.Message, log.File, log.Line] );
delete log.Message; delete log.Message;
row.tr.store( 'log', log ); row.tr.store( 'log', log );
if ( log.Level <= -3 ) if ( log.Level <= -3 )
@ -81,7 +81,7 @@ function logResponse( respObj )
row.tr.addClass( 'log-dbg' ); row.tr.addClass( 'log-dbg' );
if ( !firstLoad ) if ( !firstLoad )
{ {
var color = document.defaultView.getComputedStyle(row.tr,null).getPropertyValue('color'); var color = document.defaultView.getComputedStyle(row.tr, null).getPropertyValue('color');
var colorParts = color.match(/^rgb.*\((\d+),\s*(\d+),\s*(\d+)/); var colorParts = color.match(/^rgb.*\((\d+),\s*(\d+),\s*(\d+)/);
rowOrigColor = '#' + parseInt(colorParts[1]).toString(16) + parseInt(colorParts[2]).toString(16) + parseInt(colorParts[3]).toString(16); rowOrigColor = '#' + parseInt(colorParts[1]).toString(16) + parseInt(colorParts[2]).toString(16) + parseInt(colorParts[3]).toString(16);
new Fx.Tween( row.tr, { duration: 10000, transition: Fx.Transitions.Sine } ).start( 'color', '#6495ED', rowOrigColor ); new Fx.Tween( row.tr, { duration: 10000, transition: Fx.Transitions.Sine } ).start( 'color', '#6495ED', rowOrigColor );
@ -90,15 +90,15 @@ function logResponse( respObj )
); );
options = respObj.options; options = respObj.options;
updateFilterSelectors(); updateFilterSelectors();
$('lastUpdate').set('text',respObj.updated); $('lastUpdate').set('text', respObj.updated);
$('logState').set('text',respObj.state); $('logState').set('text', respObj.state);
$('logState').removeClass('ok'); $('logState').removeClass('ok');
$('logState').removeClass('alert'); $('logState').removeClass('alert');
$('logState').removeClass('alarm'); $('logState').removeClass('alarm');
$('logState').addClass(respObj.state); $('logState').addClass(respObj.state);
$('totalLogs').set('text',respObj.total); $('totalLogs').set('text', respObj.total);
$('availLogs').set('text',respObj.available); $('availLogs').set('text', respObj.available);
$('displayLogs').set('text',logCount); $('displayLogs').set('text', logCount);
if ( firstLoad ) if ( firstLoad )
{ {
if ( logCount < displayLimit ) if ( logCount < displayLimit )
@ -151,7 +151,7 @@ function clearLog()
logCount = 0; logCount = 0;
logTimeout = maxSampleTime; logTimeout = maxSampleTime;
displayLimit = initialDisplayLimit; displayLimit = initialDisplayLimit;
$('displayLogs').set('text',logCount); $('displayLogs').set('text', logCount);
options = {}; options = {};
logTable.empty(); logTable.empty();
} }
@ -285,7 +285,7 @@ function updateFilterSelectors()
); );
} }
if ( filter[key] ) if ( filter[key] )
selector.set('value',filter[key]); selector.set('value', filter[key]);
} }
); );
} }
@ -315,13 +315,13 @@ function initPage()
if ( sortReversed ) if ( sortReversed )
startIndex = displayLimit; startIndex = displayLimit;
else else
startIndex = 0;; startIndex = 0;
for ( var i = startIndex; logCount > displayLimit; i++ ) for ( var i = startIndex; logCount > displayLimit; i++ )
{ {
rows[i].destroy(); rows[i].destroy();
logCount--; logCount--;
} }
$('displayLogs').set('text',logCount); $('displayLogs').set('text', logCount);
} }
} }
); );

View File

@ -15,7 +15,7 @@ function Monitor( index, monitorData )
this.start = function( delay ) this.start = function( delay )
{ {
this.streamCmdTimer = this.streamCmdQuery.delay( delay, this ); this.streamCmdTimer = this.streamCmdQuery.delay( delay, this );
} };
this.setStateClass = function( element, stateClass ) this.setStateClass = function( element, stateClass )
{ {
@ -29,7 +29,7 @@ function Monitor( index, monitorData )
element.removeClass( 'idle' ); element.removeClass( 'idle' );
element.addClass( stateClass ); element.addClass( stateClass );
} }
} };
this.getStreamCmdResponse = function( respObj, respText ) this.getStreamCmdResponse = function( respObj, respText )
{ {
@ -93,15 +93,14 @@ function Monitor( index, monitorData )
console.error( respObj.message ); console.error( respObj.message );
// Try to reload the image stream. // Try to reload the image stream.
if ( stream ) if ( stream )
stream.src = stream.src.replace(/rand=\d+/i,'rand='+Math.floor((Math.random() * 1000000) )); stream.src = stream.src.replace(/rand=\d+/i, 'rand='+Math.floor((Math.random() * 1000000) ));
} }
var streamCmdTimeout = statusRefreshTimeout; var streamCmdTimeout = statusRefreshTimeout;
if ( this.alarmState == STATE_ALARM || this.alarmState == STATE_ALERT ) if ( this.alarmState == STATE_ALARM || this.alarmState == STATE_ALERT )
streamCmdTimeout = streamCmdTimeout/5; streamCmdTimeout = streamCmdTimeout/5;
this.streamCmdTimer = this.streamCmdQuery.delay( streamCmdTimeout, this ); this.streamCmdTimer = this.streamCmdQuery.delay( streamCmdTimeout, this );
this.lastAlarmState = this.alarmState; this.lastAlarmState = this.alarmState;
} };
this.streamCmdQuery = function( resent ) this.streamCmdQuery = function( resent )
{ {
@ -109,7 +108,7 @@ function Monitor( index, monitorData )
//console.log( this.connKey+": Resending" ); //console.log( this.connKey+": Resending" );
//this.streamCmdReq.cancel(); //this.streamCmdReq.cancel();
this.streamCmdReq.send( this.streamCmdParms+"&command="+CMD_QUERY ); this.streamCmdReq.send( this.streamCmdParms+"&command="+CMD_QUERY );
} };
this.streamCmdReq = new Request.JSON( { url: this.server_url, method: 'get', timeout: AJAX_TIMEOUT, onSuccess: this.getStreamCmdResponse.bind( this ), onTimeout: this.streamCmdQuery.bind( this, true ), link: 'cancel' } ); this.streamCmdReq = new Request.JSON( { url: this.server_url, method: 'get', timeout: AJAX_TIMEOUT, onSuccess: this.getStreamCmdResponse.bind( this ), onTimeout: this.streamCmdQuery.bind( this, true ), link: 'cancel' } );

View File

@ -31,7 +31,7 @@ function configureButtons( element )
if(form.elements.namedItem("nextBtn")) { if(form.elements.namedItem("nextBtn")) {
form.nextBtn.disabled = (form.probe.selectedIndex==0) || form.nextBtn.disabled = (form.probe.selectedIndex==0) ||
(form.username == "") || (form.username == null) || (form.username == "") || (form.username == null) ||
(form.password == "") || (form.password == null); (form.password == "") || (form.password == null);
} }
if(form.elements.namedItem("saveBtn")) { if(form.elements.namedItem("saveBtn")) {
form.saveBtn.disabled = (form.probe.selectedIndex==0); form.saveBtn.disabled = (form.probe.selectedIndex==0);

View File

@ -1,6 +1,5 @@
function checkState( element ) function checkState( element )
{ {
var form = element.form; var form = element.form;
var minIndex = running?2:1; var minIndex = running?2:1;
@ -23,9 +22,8 @@ function checkState( element )
if (element.value.toLowerCase() == 'default' ) if (element.value.toLowerCase() == 'default' )
{ {
form.saveBtn.disabled = false; form.saveBtn.disabled = false;
form.deleteBtn.disabled = true; form.deleteBtn.disabled = true;
} }
} }
function saveState( element ) function saveState( element )

View File

@ -114,10 +114,10 @@ function loadEventImage( imagePath, eid, fid, width, height )
var imageSrc = $('imageSrc'); var imageSrc = $('imageSrc');
imageSrc.setProperty( 'src', imagePrefix+imagePath ); imageSrc.setProperty( 'src', imagePrefix+imagePath );
imageSrc.removeEvent( 'click' ); imageSrc.removeEvent( 'click' );
imageSrc.addEvent( 'click', showEvent.pass( [ eid, fid, width, height ] ) ); imageSrc.addEvent( 'click', showEvent.pass( [eid, fid, width, height] ) );
var eventData = $('eventData'); var eventData = $('eventData');
eventData.removeEvent( 'click' ); eventData.removeEvent( 'click' );
eventData.addEvent( 'click', showEvent.pass( [ eid, fid, width, height ] ) ); eventData.addEvent( 'click', showEvent.pass( [eid, fid, width, height] ) );
} }
function tlZoomBounds( minTime, maxTime ) function tlZoomBounds( minTime, maxTime )

View File

@ -40,7 +40,7 @@ function changeScale()
streamImg.style.width = newWidth + "px"; streamImg.style.width = newWidth + "px";
streamImg.style.height = newHeight + "px"; streamImg.style.height = newHeight + "px";
streamImg.src = streamImg.src.replace(/scale=\d+/i,'scale='+scale); streamImg.src = streamImg.src.replace(/scale=\d+/i, 'scale='+scale);
} else { } else {
console.error("No element found for liveStream."); console.error("No element found for liveStream.");
} }
@ -210,11 +210,11 @@ function getStreamCmdResponse( respObj, respText )
} }
} }
else { else {
checkStreamForErrors("getStreamCmdResponse",respObj);//log them checkStreamForErrors("getStreamCmdResponse", respObj);//log them
// Try to reload the image stream. // Try to reload the image stream.
var streamImg = document.getElementById('liveStream'); var streamImg = document.getElementById('liveStream');
if ( streamImg ) if ( streamImg )
streamImg.src = streamImg.src.replace(/rand=\d+/i,'rand='+Math.floor((Math.random() * 1000000) )); streamImg.src = streamImg.src.replace(/rand=\d+/i, 'rand='+Math.floor((Math.random() * 1000000) ));
} }
var streamCmdTimeout = statusRefreshTimeout; var streamCmdTimeout = statusRefreshTimeout;
@ -372,7 +372,7 @@ function getStatusCmdResponse( respObj, respText )
setAlarmState( respObj.monitor.Status ); setAlarmState( respObj.monitor.Status );
} }
else else
checkStreamForErrors("getStatusCmdResponse",respObj); checkStreamForErrors("getStatusCmdResponse", respObj);
var statusCmdTimeout = statusRefreshTimeout; var statusCmdTimeout = statusRefreshTimeout;
if ( alarmState == STATE_ALARM || alarmState == STATE_ALERT ) if ( alarmState == STATE_ALARM || alarmState == STATE_ALERT )
@ -391,7 +391,7 @@ var alarmCmdFirst = true;
function getAlarmCmdResponse( respObj, respText ) function getAlarmCmdResponse( respObj, respText )
{ {
checkStreamForErrors("getAlarmCmdResponse",respObj); checkStreamForErrors("getAlarmCmdResponse", respObj);
} }
function cmdDisableAlarms() function cmdDisableAlarms()
@ -477,26 +477,26 @@ function getEventCmdResponse( respObj, respText )
var cells = row.getElements( 'td' ); var cells = row.getElements( 'td' );
var link = new Element( 'a', { 'href': '#', 'events': { 'click': createEventPopup.pass( [ event.Id, '&trms=1&attr1=MonitorId&op1=%3d&val1='+monitorId+'&page=1', event.Width, event.Height ] ) } }); var link = new Element( 'a', { 'href': '#', 'events': { 'click': createEventPopup.pass( [event.Id, '&trms=1&attr1=MonitorId&op1=%3d&val1='+monitorId+'&page=1', event.Width, event.Height] ) } });
link.set( 'text', event.Id ); link.set( 'text', event.Id );
link.inject( row.getElement( 'td.colId' ) ); link.inject( row.getElement( 'td.colId' ) );
link = new Element( 'a', { 'href': '#', 'events': { 'click': createEventPopup.pass( [ event.Id, '&trms=1&attr1=MonitorId&op1=%3d&val1='+monitorId+'&page=1', event.Width, event.Height ] ) } }); link = new Element( 'a', { 'href': '#', 'events': { 'click': createEventPopup.pass( [event.Id, '&trms=1&attr1=MonitorId&op1=%3d&val1='+monitorId+'&page=1', event.Width, event.Height] ) } });
link.set( 'text', event.Name ); link.set( 'text', event.Name );
link.inject( row.getElement( 'td.colName' ) ); link.inject( row.getElement( 'td.colName' ) );
row.getElement( 'td.colTime' ).set( 'text', event.StartTime ); row.getElement( 'td.colTime' ).set( 'text', event.StartTime );
row.getElement( 'td.colSecs' ).set( 'text', event.Length ); row.getElement( 'td.colSecs' ).set( 'text', event.Length );
link = new Element( 'a', { 'href': '#', 'events': { 'click': createFramesPopup.pass( [ event.Id, event.Width, event.Height ] ) } }); link = new Element( 'a', { 'href': '#', 'events': { 'click': createFramesPopup.pass( [event.Id, event.Width, event.Height] ) } });
link.set( 'text', event.Frames+'/'+event.AlarmFrames ); link.set( 'text', event.Frames+'/'+event.AlarmFrames );
link.inject( row.getElement( 'td.colFrames' ) ); link.inject( row.getElement( 'td.colFrames' ) );
link = new Element( 'a', { 'href': '#', 'events': { 'click': createFramePopup.pass( [ event.Id, '0', event.Width, event.Height ] ) } }); link = new Element( 'a', { 'href': '#', 'events': { 'click': createFramePopup.pass( [event.Id, '0', event.Width, event.Height] ) } });
link.set( 'text', event.AvgScore+'/'+event.MaxScore ); link.set( 'text', event.AvgScore+'/'+event.MaxScore );
link.inject( row.getElement( 'td.colScore' ) ); link.inject( row.getElement( 'td.colScore' ) );
link = new Element( 'a', { 'href': '#', 'title': deleteString, 'events': { 'click': function( e ) { deleteEvent( e, event.Id ); }.bind( link ), 'mouseover': highlightRow.pass( row ), 'mouseout': highlightRow.pass( row ) } }); link = new Element( 'a', { 'href': '#', 'title': deleteString, 'events': { 'click': function( e ) { deleteEvent( e, event.Id ); }, 'mouseover': highlightRow.pass( row ), 'mouseout': highlightRow.pass( row ) } });
link.set( 'text', 'X' ); link.set( 'text', 'X' );
link.inject( row.getElement( 'td.colDelete' ) ); link.inject( row.getElement( 'td.colDelete' ) );
@ -537,7 +537,7 @@ function getEventCmdResponse( respObj, respText )
} }
} }
else else
checkStreamForErrors("getEventCmdResponse",respObj); checkStreamForErrors("getEventCmdResponse", respObj);
var eventCmdTimeout = eventsRefreshTimeout; var eventCmdTimeout = eventsRefreshTimeout;
if ( alarmState == STATE_ALARM || alarmState == STATE_ALERT ) if ( alarmState == STATE_ALARM || alarmState == STATE_ALERT )
@ -581,7 +581,7 @@ function controlCmd( control, event, xtell, ytell )
var x = xEvent.page.x - l; var x = xEvent.page.x - l;
var y = xEvent.page.y - t; var y = xEvent.page.y - t;
if ( xtell ) if ( xtell )
{ {
var xge = parseInt( (x*100)/coords.width ); var xge = parseInt( (x*100)/coords.width );
if ( xtell == -1 ) if ( xtell == -1 )
@ -590,7 +590,7 @@ function controlCmd( control, event, xtell, ytell )
xge = 2*(50 - xge); xge = 2*(50 - xge);
locParms += "&xge="+xge; locParms += "&xge="+xge;
} }
if ( ytell ) if ( ytell )
{ {
var yge = parseInt( (y*100)/coords.height ); var yge = parseInt( (y*100)/coords.height );
if ( ytell == -1 ) if ( ytell == -1 )

View File

@ -353,7 +353,7 @@ function updateActivePoint( index )
$('newZone[Points]['+index+'][y]').value = y; $('newZone[Points]['+index+'][y]').value = y;
zone['Points'][index].x = x; zone['Points'][index].x = x;
zone['Points'][index].y = y; zone['Points'][index].y = y;
var Point = $('zonePoly').points.getItem(index); var Point = $('zonePoly').points.getItem(index);
Point.x =x; Point.x =x;
Point.y =y; Point.y =y;
updateArea(); updateArea();
@ -384,7 +384,7 @@ function delPoint( index )
function limitPointValue( point, loVal, hiVal ) function limitPointValue( point, loVal, hiVal )
{ {
point.value = constrainValue(point.value, loVal, hiVal) point.value = constrainValue(point.value, loVal, hiVal);
} }
function updateArea( ) { function updateArea( ) {
@ -393,7 +393,6 @@ function updateArea( ) {
var form = $('zoneForm'); var form = $('zoneForm');
form.elements['newZone[Area]'].value = area; form.elements['newZone[Area]'].value = area;
if ( form.elements['newZone[Units]'].value == 'Percent' ) { if ( form.elements['newZone[Units]'].value == 'Percent' ) {
form.elements['newZone[TempArea]'].value = Math.round( area/monitorArea*100 ); form.elements['newZone[TempArea]'].value = Math.round( area/monitorArea*100 );
} else if ( form.elements['newZone[Units]'].value == 'Pixels' ) { } else if ( form.elements['newZone[Units]'].value == 'Pixels' ) {
form.elements['newZone[TempArea]'].value = area; form.elements['newZone[TempArea]'].value = area;
@ -411,7 +410,7 @@ function updateX( index )
point.setStyle( 'left', x+'px' ); point.setStyle( 'left', x+'px' );
zone['Points'][index].x = x; zone['Points'][index].x = x;
var Point = $('zonePoly').points.getItem(index); var Point = $('zonePoly').points.getItem(index);
Point.x = x; Point.x = x;
} }
@ -424,7 +423,7 @@ function updateY( index )
point.setStyle( 'top', y+'px' ); point.setStyle( 'top', y+'px' );
zone['Points'][index].y = y; zone['Points'][index].y = y;
var Point = $('zonePoly').points.getItem(index); var Point = $('zonePoly').points.getItem(index);
Point.y = y; Point.y = y;
} }
@ -568,11 +567,11 @@ function getStreamCmdResponse( respObj, respText ) {
streamCmdPlay( false ); streamCmdPlay( false );
} }
} else { } else {
checkStreamForErrors("getStreamCmdResponse",respObj);//log them checkStreamForErrors("getStreamCmdResponse", respObj);//log them
// Try to reload the image stream. // Try to reload the image stream.
var streamImg = document.getElementById('liveStream'); var streamImg = document.getElementById('liveStream');
if ( streamImg ) if ( streamImg )
streamImg.src = streamImg.src.replace(/rand=\d+/i,'rand='+Math.floor((Math.random() * 1000000) )); streamImg.src = streamImg.src.replace(/rand=\d+/i, 'rand='+Math.floor((Math.random() * 1000000) ));
} }
var streamCmdTimeout = statusRefreshTimeout; var streamCmdTimeout = statusRefreshTimeout;
@ -630,7 +629,7 @@ function getStatusCmdResponse( respObj, respText ) {
setAlarmState( respObj.monitor.Status ); setAlarmState( respObj.monitor.Status );
} }
else else
checkStreamForErrors("getStatusCmdResponse",respObj); checkStreamForErrors("getStatusCmdResponse", respObj);
var statusCmdTimeout = statusRefreshTimeout; var statusCmdTimeout = statusRefreshTimeout;
if ( alarmState == STATE_ALARM || alarmState == STATE_ALERT ) if ( alarmState == STATE_ALARM || alarmState == STATE_ALERT )