Merge pull request #2704 from connortechnology/fix_2702

general clean of onvif probe view.  Use buttons instead of inputs and…
This commit is contained in:
Isaac Connor 2019-09-11 09:18:27 -04:00 committed by GitHub
commit 94f2dccae5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 32 additions and 47 deletions

View File

@ -24,12 +24,12 @@ function gotoStep2( element ) {
function configureButtons(element) { function configureButtons(element) {
var form = element.form; var form = element.form;
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

@ -41,7 +41,7 @@ function execONVIF( $cmd ) {
Please the following command from a command line for more information:<br/><br/>$shell_command" Please the following command from a command line for more information:<br/><br/>$shell_command"
); );
} else { } else {
ZM\Logger::Debug( "Results from probe: " . implode( '<br/>', $output ) ); ZM\Logger::Debug('Results from probe: '.implode('<br/>', $output));
} }
return $output; return $output;
@ -141,20 +141,6 @@ if ( !isset($_REQUEST['step']) || ($_REQUEST['step'] == '1') ) {
$ip = $matches[1]; $ip = $matches[1];
} }
$host = $ip; $host = $ip;
/*
if ( isset($monitors[$ip]) )
{
$monitor = $monitors[$ip];
$sourceString .= " (".$monitor['Name'].")";
}
else
{
$sourceString .= " - ".translate('Available');
}
$cameras[$sourceDesc] = $sourceString;
}
*/
// $sourceDesc = htmlspecialchars(serialize($camera['monitor']));
$sourceDesc = base64_encode(json_encode($camera['monitor'])); $sourceDesc = base64_encode(json_encode($camera['monitor']));
$sourceString = $camera['model'].' @ '.$host.' using version '.$camera['monitor']['SOAP']; $sourceString = $camera['model'].' @ '.$host.' using version '.$camera['monitor']['SOAP'];
$cameras[$sourceDesc] = $sourceString; $cameras[$sourceDesc] = $sourceString;
@ -179,28 +165,27 @@ if ( !isset($_REQUEST['step']) || ($_REQUEST['step'] == '1') ) {
</p> </p>
<p> <p>
<label for="probe"><?php echo translate('DetectedCameras') ?></label> <label for="probe"><?php echo translate('DetectedCameras') ?></label>
<?php echo htmlSelect('probe', $cameras, null, array('onchange'=>'configureButtons(this)')); ?> <?php echo htmlSelect('probe', $cameras, null, array('data-on-change-this'=>'configureButtons')); ?>
</p> </p>
<p> <p>
<?php echo translate('OnvifCredentialsIntro') ?> <?php echo translate('OnvifCredentialsIntro') ?>
</p> </p>
<p> <p>
<label for="username"><?php echo translate('Username') ?></label> <label for="Username"><?php echo translate('Username') ?></label>
<input type="text" name="username" value="" onChange="configureButtons(this)"/> <input type="text" name="Username" data-on-change-this="configureButtons"/>
</p> </p>
<p> <p>
<label for="password"><?php echo translate('Password') ?></label> <label for="Password"><?php echo translate('Password') ?></label>
<input type="password" name="password" value="" onChange="configureButtons(this)"/> <input type="password" name="Password" data-on-change-this="configureButtons"/>
</p> </p>
<div id="contentButtons"> <div id="contentButtons">
<input type="button" value="<?php echo translate('Cancel') ?>" data-on-click="closeWindow"/> <button type="button" data-on-click="closeWindow"><?php echo translate('Cancel') ?></button>
<input type="submit" name="nextBtn" value="<?php echo translate('Next') ?>" data-on-click-this="gotoStep2" disabled="disabled"/> <button type="button" name="nextBtn" data-on-click-this="gotoStep2" disabled="disabled"><?php echo translate('Next') ?></button>
</div> </div>
</form> </form>
</div> </div>
</div> </div>
</body> </body>
</html>
<?php <?php
//==== STEP 2 ============================================================ //==== STEP 2 ============================================================
@ -221,7 +206,7 @@ if ( !isset($_REQUEST['step']) || ($_REQUEST['step'] == '1') ) {
//print $monitor['Host'].", ".$_REQUEST['username'].", ".$_REQUEST['password']."<br/>"; //print $monitor['Host'].", ".$_REQUEST['username'].", ".$_REQUEST['password']."<br/>";
$detprofiles = probeProfiles($monitor['Host'], $monitor['SOAP'], $_REQUEST['username'], $_REQUEST['password']); $detprofiles = probeProfiles($monitor['Host'], $monitor['SOAP'], $_REQUEST['Username'], $_REQUEST['Password']);
foreach ( $detprofiles as $profile ) { foreach ( $detprofiles as $profile ) {
$monitor = $camera['monitor']; $monitor = $camera['monitor'];
@ -258,18 +243,18 @@ if ( !isset($_REQUEST['step']) || ($_REQUEST['step'] == '1') ) {
</p> </p>
<p> <p>
<label for="probe"><?php echo translate('DetectedProfiles') ?></label> <label for="probe"><?php echo translate('DetectedProfiles') ?></label>
<?php echo htmlSelect('probe', $profiles, null, array('onchange'=>'configureButtons(this)')); ?> <?php echo htmlSelect('probe', $profiles, null, array('data-on-change-this'=>'configureButtons')); ?>
</p> </p>
<div id="contentButtons"> <div id="contentButtons">
<input type="button" name="prevBtn" value="<?php echo translate('Prev') ?>" data-on-click-this="gotoStep1"/> <button type="button" name="prevBtn" data-on-click-this="gotoStep1"><?php echo translate('Prev') ?></button>
<input type="button" value="<?php echo translate('Cancel') ?>" data-on-click="closeWindow"/> <button type="button" data-on-click="closeWindow"><?php echo translate('Cancel') ?></button>
<input type="submit" name="saveBtn" value="<?php echo translate('Save') ?>" data-on-click-this="submitCamera" disabled="disabled"/> <button type="button" name="saveBtn" data-on-click-this="submitCamera" disabled="disabled"><?php echo translate('Save') ?></button>
</div> </div>
</form> </form>
</div> </div>
</div> </div>
</body> </body>
</html>
<?php <?php
} // end if step 1 or 2 } // end if step 1 or 2
?> ?>
</html>