Toggle Status

Sets the read status to the opposite of the current status
514619
public function toggleStatus()
    {
        $messageMapper = ($this->container->dataMapper)('MessageMapper');

        $messageId = $this->request->getParsedBodyParam('id');
        $message = $messageMapper->findById($messageId);
        if ($message->isRead === 'Y') {
            $messageMapper->markAsUnread($messageId);
        } else {
            $messageMapper->markAsRead($messageId);
        }

        // Set the response type
        if ($this->request->isXhr()) {
            $r = $this->response->withHeader('Content-Type', 'application/json');
            return $r->write(json_encode(["status" => "success"]));
        }

        return $this->redirect('adminMessages');
    }
1242390
def toggle(self, event=None):
        """"""
        if self.choice.get() == "yes":
            self.rbno.select()
        else:
            self.rbyes.select()
        self.widgetEdited()
1319222
def is_switched_on(self, refresh=False):
        
        if refresh:
            self.refresh()
        val = self.get_value('Armed')
        return val == '1'
391652
def switch(self, first, second):
        """"""
        allowed_states = ['queued', 'stashed']
        if first in self.queue and second in self.queue \
                and self.queue[first]['status'] in allowed_states\
                and self.queue[second]['status'] in allowed_states:

            tmp = self.queue[second].copy()
            self.queue[second] = self.queue[first].copy()
            self.queue[first] = tmp
            self.write()
            return True
        return False
223862
def override_ignore_outcome(ini):
    """"""
    travis_reader = tox.config.SectionReader("travis", ini)
    return travis_reader.getbool('unignore_outcomes', False)
821585
function setStatus() {
  var statusEl = document.getElementById("status");
  var logoutButton = document.getElementById("logout-btn");

  if(matter.isLoggedIn){
    statusEl.innerHTML = "True";
    statusEl.style.color = 'green';
    // statusEl.className = statusEl.className ? ' status-loggedIn' : 'status-loggedIn';
    logoutButton.style.display='inline';
  } else {
    statusEl.innerHTML = "False";
    statusEl.style.color = 'red';
    logoutButton.style.display='none';
  }
}
1374865
protected void setReadOnly()
   {
      // try to stop merger in safe way
      if (merger != null)
      {
         merger.dispose();
         merger = null;
      }

      if (flushTask != null)
      {
         flushTask.cancel();
      }
      FLUSH_TIMER.purge();
      this.redoLog = null;
   }
265259
public void setStatus(BounceProxyStatus status) throws IllegalStateException {
        // this checks if the transition is valid
        if (this.status.isValidTransition(status)) {
            this.status = status;
        } else {
            throw new IllegalStateException("Illegal status transition from " + this.status + " to " + status);
        }
    }
295790
function(attr, options) {
    options = options ? _.clone(options) : {};
    var val = this.get(attr);
    if(!_.isBoolean(val)) console.error('Tried to toggle non-boolean value ' + attr +'!', this);
    return this.set(attr, !val, options);
  }
623669
def toggle(self, key):
        
        val = self[key]
        assert isinstance(val, bool), 'key[%r] = %r is not a bool' % (key, val)
        self.pref_update(key, not val)
465545
def toggle_actions(actions, enable):
    """"""
    if actions is not None:
        for action in actions:
            if action is not None:
                action.setEnabled(enable)
834631
def toggle_bit(self, position: int):
        
        if position > (self._bit_width - 1):
            raise ValueError('position greater than the bit width')

        self._value ^= (1 << position)
        self._text_update()
314310
def on_rbAggLayerNoAggregation_toggled(self):
        
        self.parent.aggregation_layer = None
        self.parent.pbnNext.setEnabled(True)
597479
private void switchAccountStatus(Account account, Account.Status status,
            UserIdentityContext userIdentityContext) {
        if (logger.isDebugEnabled()) {
            logger.debug("Switching status for account:" + account.getSid() + ",status:" + status);
        }
        switch (status) {
            case CLOSED:
                sendRVDStatusNotification(account,userIdentityContext);
                // then proceed to dependency removal
                removeAccoundDependencies(account.getSid());
                break;
            default:
                break;

        }
        // finally, set and persist account status
        account = account.setStatus(status);
        accountsDao.updateAccount(account);
    }
1222486
private void toggleReadOnly() {
		allFiles.setReadOnly(!allFiles.isReadOnly());
		imageFiles.setReadOnly(!imageFiles.isReadOnly());
		textFiles.setReadOnly(!textFiles.isReadOnly());
		pdfFiles.setReadOnly(!pdfFiles.isReadOnly());
	}
532326
def set_status(self, value):
        """"""
        self._check_object_exists()
        DB.set_hash_value(self.key, 'status', value)
        self.publish('status_changed', event_data=dict(status=value))
1024142
function ToggleSwitch_ariaChanged() {
                        var value = this._domElement.getAttribute('aria-checked');
                        value = (value === 'true') ? true : false;
                        this.checked = value;
                    }