예제 #1
0
 public function parse($orig_name)
 {
     global $CORE;
     ob_start();
     if (is_action()) {
         try {
             $name = post('name');
             if (!$name) {
                 throw new FieldInputError('name', l('Please provide a map name.'));
             }
             if (!preg_match(MATCH_MAP_NAME, $name)) {
                 throw new FieldInputError('name', l('This is not a valid map name (need to match [M])', array('M' => MATCH_MAP_NAME)));
             }
             if (count($CORE->getAvailableMaps('/^' . $name . '$/')) > 0) {
                 throw new FieldInputError('name', l('A map with this name already exists.'));
             }
             // Read the old config
             $MAPCFG = new GlobalMapCfg($orig_name);
             $MAPCFG->readMapConfig();
             // Create a new map config
             $NEW = new GlobalMapCfg($name);
             $NEW->createMapConfig();
             foreach ($MAPCFG->getMapObjects() as $object_id => $cfg) {
                 $NEW->addElement($cfg['type'], $cfg, $perm = true, $object_id);
             }
             success(l('The map has been created.'));
             reload(cfg('paths', 'htmlbase') . '/frontend/nagvis-js/index.php?mod=Map&show=' . $name, 1);
         } catch (FieldInputError $e) {
             form_error($e->field, $e->msg);
         } catch (NagVisException $e) {
             form_error(null, $e->message());
         } catch (Exception $e) {
             if (isset($e->msg)) {
                 form_error(null, $e->msg);
             } else {
                 throw $e;
             }
         }
     }
     echo $this->error;
     echo '<div class="simple_form">' . N;
     js_form_start('to_new_map');
     input('name');
     submit(l('Save'));
     focus('name');
     // Keep the view parameters the users has set
     $params = ltrim(req('view_params'), '&');
     if ($params) {
         $parts = explode('&', $params);
         foreach ($parts as $part) {
             list($key, $val) = explode('=', $part);
             hidden($key, $val);
         }
     }
     form_end();
     echo '</div>' . N;
     return ob_get_clean();
 }
예제 #2
0
function checkrequired_name_empty($sForm, $sName, $sLabel)
{
    if (this . document . $sForm . $sName . value == "") {
        alert("The form is incomplete please make sure you have entered all the information marked with *\n\nPlease enter the {$sLabel}.\n\n");
        this . document . $sForm . $sName . focus();
        $sForm . $sName . focus();
        //This focuses the cursor on the empty field
        return false;
    }
    return true;
}
예제 #3
0
 function js_foco()
 {
     document . form1 . login . focus();
 }
예제 #4
0
파일: ViewAck.php 프로젝트: rbarraud/nagvis
 public function parse()
 {
     global $CORE, $_BACKEND, $AUTH;
     ob_start();
     $map = req('map');
     if (!$map || count($CORE->getAvailableMaps('/^' . $map . '$/')) == 0) {
         throw new NagVisException(l('Please provide a valid map name.'));
     }
     $object_id = req('object_id');
     if (!$object_id || !preg_match(MATCH_OBJECTID, $object_id)) {
         throw new NagVisException(l('Please provide a valid object id.'));
     }
     $MAPCFG = new GlobalMapCfg($map);
     $MAPCFG->skipSourceErrors();
     $MAPCFG->readMapConfig();
     if (!$MAPCFG->objExists($object_id)) {
         throw new NagVisException(l('The object does not exist.'));
     }
     $backendIds = $MAPCFG->getValue($object_id, 'backend_id');
     foreach ($backendIds as $backendId) {
         if (!$_BACKEND->checkBackendFeature($backendId, 'actionAcknowledge', false)) {
             return '<div class=err>' . l('The requested feature is not available for this backend. ' . 'The MKLivestatus backend supports this feature.') . '</div>';
         }
     }
     if (is_action()) {
         try {
             $type = $MAPCFG->getValue($object_id, 'type');
             if ($type == 'host') {
                 $spec = $MAPCFG->getValue($object_id, 'host_name');
             } else {
                 $spec = $MAPCFG->getValue($object_id, 'host_name') . ';' . $MAPCFG->getValue($object_id, 'service_description');
             }
             $comment = post('comment');
             if (!$comment) {
                 throw new FieldInputError('comment', l('You need to provide a comment.'));
             }
             $sticky = get_checkbox('sticky');
             $notify = get_checkbox('notify');
             $persist = get_checkbox('persist');
             // Now send the acknowledgement
             foreach ($backendIds as $backendId) {
                 $BACKEND = $_BACKEND->getBackend($backendId);
                 $BACKEND->actionAcknowledge($type, $spec, $comment, $sticky, $notify, $persist, $AUTH->getUser());
             }
             success(l('The problem has been acknowledged.'));
             js('window.setTimeout(function() {' . 'popupWindowClose(); refreshMapObject(null, \'' . $object_id . '\');}, 2000);');
         } catch (FieldInputError $e) {
             form_error($e->field, $e->msg);
         } catch (NagVisException $e) {
             form_error(null, $e->message());
         } catch (Exception $e) {
             if (isset($e->msg)) {
                 form_error(null, $e->msg);
             } else {
                 throw $e;
             }
         }
     }
     echo $this->error;
     js_form_start('acknowledge');
     echo '<label>' . l('Comment');
     input('comment');
     echo '</label>';
     echo '<label>';
     checkbox('sticky', cfg('global', 'dialog_ack_sticky'));
     echo l('Sticky') . '</label>';
     echo '<label>';
     checkbox('notify', cfg('global', 'dialog_ack_notify'));
     echo l('Notify contacts') . '</label>';
     echo '<label>';
     checkbox('persist', cfg('global', 'dialog_ack_persist'));
     echo l('Persist comment') . '</label>';
     submit(l('Acknowledge'));
     form_end();
     focus('comment');
     return ob_get_clean();
 }
예제 #5
0
  <?php 
    focusjs('search', 'search');
    focusjs('btn', 'btn');
    ?>
  <div class="col-md-3 col-sm-1"></div>
  <div class="col-md-4 col-sm-8"><input class="search" <?php 
    focus('search');
    ?>
 autocomplete="off" type="text" title="type here" id="search" name="v" placeholder="Type here..." accesskey="t"/></div>
  <div class="col-md-2 col-sm-2">
<button <?php 
    focus('btn');
    ?>
 type="submit" id="btn" class="btn" value="search" accesskey="s"><p>Search</p></button>
  <!-- <input <?php 
    focus('btn');
    ?>
 type="submit" id="btn" class="btn" value="search" accesskey="s"/>   -->

  </div>
  <div class="col-md-3 col-sm-1"></div>
  </form>
  </div>
  </div>


 <div class="container-fluid">
  <div class="row">

<?php 
    echo '<script>
예제 #6
0
?>
href="http://henshaws.org.uk/what-we-offer/arts-and-crafts-centre/  ">
        <img src="<?php 
echo $folder;
?>
img/ACC.jpg" alt="Arts & Crafts Centre"/><br>Arts & Crafts Centre</a>
        </div></li></div>


        <div class="smallshadow"><li><div id="community" class="pop">
<?php 
focusjs('community', 'pop');
?>

<a <?php 
focus('community');
?>
href="http://henshaws.org.uk/what-we-offer/courses-and-training/  ">
        <img src="<?php 
echo $folder;
?>
img/community.jpg" alt="Community Services"/><br>Community Services</a>
        </div></li></div>
</ul>



<p>Henshaws is a registered charity (No.221888) and relies on the generous donations of our supporters</p>

</div>
예제 #7
0

 <?php 
//custom display for institution require close window button
if ($ip == "195.194.187.26x") {
    //if ($ip=="195.72.35.110") {
    ?>

  <div class="control-shadow">
   <li>
    <?php 
    focusjs('close', 'control-link');
    ?>
      <div id="close" class="control-link">
        <a <?php 
    focus(close);
    ?>
 href="" onclick="closeme();">
          <img src="../img/media_close.png" alt="Close Window">
          </br>Close Window
        </a>
      </div>
    </li>
  </div> 
  
<?php 
}
//HTML5 for mobile devices
if ($mobile) {
    ?>