Event handler called before writing to the database.
961402
public function onBeforeWrite()
    {
        parent::onBeforeWrite();
        $owner = $this->owner;
        if (!$owner->ID) {
            // first write
            $owner->updatepresets = true;
        }
    }
682623
function() {
        this.cal.beforeRenderNavEvent.fire();
        if (!this.__rendered) {
            this.createNav();
            this.createMask();
            this.applyListeners();
            this.__rendered = true;
        }
        this.cal.renderNavEvent.fire();
    }
50223
def before_insert(mapper, conn, target):
        """"""
        from sqlalchemy import text

        if not target.id:
            sql = text('SELECT max(f_id)+1 FROM files WHERE f_d_vid = :did')

            target.id, = conn.execute(sql, did=target.d_vid).fetchone()

            if not target.id:
                target.id = 1

        if target.contents and isinstance(target.contents, six.text_type):
            target.contents = target.contents.encode('utf-8')

        File.before_update(mapper, conn, target)
373255
protected function onBeforeWrite() {
		parent::onBeforeWrite();

		// Changes in 2.4 mean that $this->Content can now become polluted with UTF-8 HTML entitised garbage
		// we'll leave this legacy conversion in for now?
		$this->Content = str_replace('&#13;', '', $this->Content);

		$formatter = $this->getFormatter();
		$formatter->analyseSavedContent($this);

		// set a lock expiry in the past if there's not one already set
		if (!$this->WikiLockExpiry) {
			$this->WikiLockExpiry = date('Y-m-d H:i:s');
		}

		// Make sure to set the last editor to the current user
		if (Member::currentUser()) {
			$this->WikiLastEditor = Member::currentUser()->Email;
		}
	}
948956
function onReady( event ) {
  // bail if already triggered or IE8 document is not ready just yet
  var isIE8NotReady = event.type === 'readystatechange' && document.readyState !== 'complete';
  if ( docReady.isReady || isIE8NotReady ) {
    return;
  }

  trigger();
}
535764
@Override
    public void beforeCompletion() {
        if (tc.isEntryEnabled()) {
            Tr.entry(this, tc, "beforeCompletion");
            Tr.exit(this, tc, "beforeCompletion");
        }
    }
792872
public function triggerBeforeFind()
    {
        if (!$this->_beforeFindFired && $this->_type === 'select') {
            $this->_beforeFindFired = true;

            /** @var \Cake\Event\EventDispatcherInterface $repository */
            $repository = $this->getRepository();
            $repository->dispatchEvent('Model.beforeFind', [
                $this,
                new ArrayObject($this->_options),
                !$this->isEagerLoaded()
            ]);
        }
    }
936651
public function beforeModelSave()
    {
        $this->model->item = $this->recordCode;
        if ($this->fieldValues) {
            $this->model->value = $this->fieldValues;
        }
    }
1101647
public void prepareUpdateStep1bOutput(JspWriter out) throws IOException {

        m_oldLoggingDBOffset = m_newLoggingDBOffset;
        m_newLoggingDBOffset = m_dbUpdateThread.getLoggingThread().getMessages().size();
        if (isInitialized()) {
            for (int i = m_oldLoggingDBOffset; i < m_newLoggingDBOffset; i++) {
                String str = m_dbUpdateThread.getLoggingThread().getMessages().get(i).toString();
                str = CmsEncoder.escapeWBlanks(str, CmsEncoder.ENCODING_UTF_8);
                out.println("output[" + (i - m_oldLoggingDBOffset) + "] = \"" + str + "\";");
            }
        } else {
            out.println("output[0] = 'ERROR';");
        }

        boolean threadFinished = m_dbUpdateThread.isFinished();
        boolean allWritten = m_oldLoggingDBOffset >= m_dbUpdateThread.getLoggingThread().getMessages().size();

        out.println("function initThread() {");
        if (isInitialized()) {
            out.print("send();");
            if (threadFinished && allWritten) {
                out.println("setTimeout('top.display.finish()', 1000);");
            } else {
                int timeout = 5000;
                if (getUpdateDBThread().getLoggingThread().getMessages().size() < 20) {
                    timeout = 2000;
                }
                out.println("setTimeout('location.reload()', " + timeout + ");");
            }
        }
        out.println("}");
    }
757890
function(e) {

      if(!this.dialog) {
         this.renderDialog();
      }
		
		// Inserting new record
		this.insertNewRecord = true;
		
		this.dialog.whenFormAvailable({
			fn: function() {
				this.dialog.getForm().clear();
				this.dialog.show();
			},
			scope: this
		});
		
   }
251281
public static function preFork()
    {
        $clusterHandler = self::instance();

        // disconnect DB based cluster handlers from the database
        if ( $clusterHandler instanceof ezpDatabaseBasedClusterFileHandler )
        {
            $clusterHandler->disconnect();

            // destroy the current handler so that it reconnects when instanciated again
            self::$globalHandler = null;
        }
    }
408642
public void addNew() throws DBException
    {
        this.getRecord().setEditMode(Constants.EDIT_NONE);
        m_objectID = null;
        m_dataSource = null;
        try   {
            this.doAddNew();
            m_iRecordStatus = DBConstants.RECORD_NEW;
        } catch (DBException ex)   {
            throw ex;
        }
        this.getRecord().setEditMode(Constants.EDIT_ADD);   // I do this before the handleNewRecord behaviors do anything
        this.getRecord().handleNewRecord();   // Display Fields
    }
1168944
def pre_handler(self, cmd):
        """"""
        if self._finished:
            return
        if self.interesting_commit and cmd.name == 'commit':
            if cmd.mark == self.interesting_commit:
                print(cmd.to_string())
                self._finished = True
            return
        if cmd.name in self.parsed_params:
            fields = self.parsed_params[cmd.name]
            str = cmd.dump_str(fields, self.parsed_params, self.verbose)
            print("%s" % (str,))
630721
function onBeforeShow() {
    var trigger = self.hc_.getAnchorElement();
    var ch = self.getChar_(trigger);
    if (ch) {
      self.zoomEl_.innerHTML = self.displayChar_(ch);
      self.unicodeEl_.innerHTML = goog.i18n.uChar.toHexString(ch);
      // Clear the character name since we don't want to show old data because
      // it is retrieved asynchronously and the DOM object is re-used
      self.charNameEl_.innerHTML = '';
      self.charNameFetcher_.getName(ch, function(charName) {
        if (charName) {
          self.charNameEl_.innerHTML = charName;
        }
      });
    }
  }
1260956
public function onBeforePublish()
    {
        /**
         * @var DBDatetime $publishDate
         */
        $publishDate = $this->dbObject('PublishDate');
        if (!$publishDate->getValue()) {
            $this->PublishDate = DBDatetime::now()->getValue();
            $this->write();
        }

        $this->Summary = trim($this->Summary);

        $this->extend('onBeforePublish');
    }
1374032
function ajaxBeforeSend(xhr, settings) {
        var context = settings.context;
        if (settings.beforeSend.call(context, xhr, settings) === false || triggerGlobal(settings, context, 'ajaxBeforeSend', [
                xhr,
                settings
            ]) === false)
            return false;

        triggerGlobal(settings, context, 'ajaxSend', [
            xhr,
            settings
        ]);
    }
194210
private void handleInputElements(Eventable eventable) {
		CopyOnWriteArrayList<FormInput> formInputs = eventable.getRelatedFormInputs();

		for (FormInput formInput : formHandler.getFormInputs()) {
			if (!formInputs.contains(formInput)) {
				formInputs.add(formInput);
			}
		}

		formHandler.handleFormElements(formInputs);

	}