callback function to update draft specific properties post creation
18701
function(oEvent) {
				var oNewEntity = oEvent.getParameter("oEntity");
				oNewEntity.IsActiveEntity = false;
				oNewEntity.HasActiveEntity = false;
				oNewEntity.HasDraftEntity = false;
			}
788416
def publish(self):
        
        if self.is_draft:
            # If the object has previously been linked then patch the
            # placeholder data and remove the previously linked object.
            # Otherwise set the published date.
            if self.publishing_linked:
                self.patch_placeholders()
                # Unlink draft and published copies then delete published.
                # NOTE: This indirect dance is necessary to avoid
                # triggering unwanted MPTT tree structure updates via
                # `save`.
                type(self.publishing_linked).objects \
                    .filter(pk=self.publishing_linked.pk) \
                    .delete()  # Instead of self.publishing_linked.delete()
            else:
                self.publishing_published_at = timezone.now()

            # Create a new object copying all fields.
            publish_obj = deepcopy(self)

            # If any fields are defined not to copy set them to None.
            for fld in self.publishing_publish_empty_fields + (
                'urlnode_ptr_id', 'publishing_linked_id'
            ):
                setattr(publish_obj, fld, None)

            # Set the state of publication to published on the object.
            publish_obj.publishing_is_draft = False

            # Update Fluent's publishing status field mechanism to correspond
            # to our own notion of publication, to help use work together more
            # easily with Fluent Pages.
            if isinstance(self, UrlNode):
                self.status = UrlNode.DRAFT
                publish_obj.status = UrlNode.PUBLISHED

            # Set the date the object should be published at.
            publish_obj.publishing_published_at = self.publishing_published_at

            # Perform per-model preparation before saving published copy
            publish_obj.publishing_prepare_published_copy(self)

            # Save the new published object as a separate instance to self.
            publish_obj.save()
            # Sanity-check that we successfully saved the published copy
            if not publish_obj.pk:  # pragma: no cover
                raise PublishingException("Failed to save published copy")

            # As it is a new object we need to clone each of the
            # translatable fields, placeholders and required relations.
            self.clone_parler_translations(publish_obj)
            self.clone_fluent_placeholders_and_content_items(publish_obj)
            self.clone_fluent_contentitems_m2m_relationships(publish_obj)

            # Extra relationship-cloning smarts
            publish_obj.publishing_clone_relations(self)

            # Link the published object to the draft object.
            self.publishing_linked = publish_obj

            # Flag draft instance when it is being updated as part of a
            # publish action, for use in `publishing_set_update_time`
            self._skip_update_publishing_modified_at = True

            # Signal the pre-save hook for publication, save then signal
            # the post publish hook.
            publishing_signals.publishing_publish_pre_save_draft.send(
                sender=type(self), instance=self)

            # Save the draft and its new relationship with the published copy
            publishing_signals.publishing_publish_save_draft.send(
                sender=type(self), instance=self)

            publishing_signals.publishing_post_publish.send(
                sender=type(self), instance=self)
            return publish_obj
1123435
function update_field( $field, $post_id )
	{
		// sanitize field name
		// - http://support.advancedcustomfields.com/discussion/5262/sanitize_title-on-field-name
		// - issue with camel case! Replaced with JS
		//$field['name'] = sanitize_title( $field['name'] );
		
		
		// filters
		$field = apply_filters('acf/update_field/type=' . $field['type'], $field, $post_id ); // new filter
		
		
		// clear cache
		wp_cache_delete( 'load_field/key=' . $field['key'], 'acf' );
	
		
		// save
		update_post_meta( $post_id, $field['key'], $field );
	}
1318024
function setAndPublish(variableName, object, channel, option){

    client.set(variableName, JSON.stringify(object));
    // Publish that it did an update
    client.publish(channel, option);
}
284097
def insert_draft_child(self, child_pid):
        """"""
        if child_pid.status != PIDStatus.RESERVED:
            raise PIDRelationConsistencyError(
                "Draft child should have status 'RESERVED'")

        if not self.draft_child:
            with db.session.begin_nested():
                super(PIDNodeVersioning, self).insert_child(child_pid,
                                                            index=-1)
        else:
            raise PIDRelationConsistencyError(
                "Draft child already exists for this relation: {0}".format(
                    self.draft_child))
944609
function pongTableAjaxCommits( divId, resourceURL, params, tbl ) {
  var contentItems = [];
  var dataUrl = resourceURL;
  if ( tbl.dataURL != null ) {
    var slash = '/';
    if ( tbl.dataURL.charAt( 0 ) == '/' ||  dataUrl.charAt( dataUrl.length - 1 ) == '/') { slash = '' }
    dataUrl = dataUrl + slash + tbl.dataURL;
  }
  poTbl[ divId ].dataURL = dataUrl
//  if ( dataUrl.charAt( dataUrl.length - 1 ) != '/' ) { 
//    dataUrl = dataUrl + '/';
//  }
  var redirectErr = $.i18n( "Data not stored! POST redirected, please check configuration" );
  
  contentItems.push( "<script>" );
  contentItems.push( "$(function() { ");
    //contentItems.push( '   $( ".editdatepicker" ).datepicker(); ' );
    
  // code to add/set selected attribute by selector-checkbox event
  contentItems.push( '  $( "#'+divId+'PongTable" ).on( "change", ".changeSelect", ' );
  contentItems.push( '         function( event ) { ' );
  contentItems.push( '            var tbl = $(this); ' );
  contentItems.push( '            pongTablePostSelectChange( "'+divId+'", "'+dataUrl+'", tbl, this.value ); ' );
  contentItems.push( '            event.preventDefault(); return false; ' );
  contentItems.push( '         } ); ');
  
  // TODO: change to something like "pongTablePostSelectChange"
  // code to add/set selected attribute by selector-checkbox event
  contentItems.push( '  $( "#'+divId+'PongTable" ).on( "change", ".rowSelector", ' );
  contentItems.push( '         function( event ) { ' );
  contentItems.push( '            var tbl = $(this); ' );
  contentItems.push( '            poTbl["'+divId+'"].pongTableData[ tbl.data("r") ]["selected"] = tbl.is(":checked"); ' );
  contentItems.push( '         } ); ');

  // code to commit imput/checkbox changes with AJAX call 
  contentItems.push( '  $( "#'+divId+'PongTable" ).on( "change", ".postchange", ' );
  contentItems.push( '         function( event ) { ' );
  contentItems.push( '            var tbl = $(this); ' );
  if ( ( typeof tbl.rowId === 'string' ) ) {
    contentItems.push( '            var rowIdVal =  poTbl["'+divId+'"].pongTableData[ tbl.data("r") ]["'+tbl.rowId+'"]; ' );
    contentItems.push( '            var postParam =  { '+tbl.rowId+': rowIdVal }; ' );		
  } else if ( Array.isArray( tbl.rowId ) ) {
    var param = "";
    var first = true;
    for ( var x = 0; x < tbl.rowId.length; x++ ) {
      if ( ! first ) { param += ', '; } 
      param += tbl.rowId[x]+':poTbl["'+divId+'"].pongTableData[ tbl.data("r") ]["'+tbl.rowId[x]+'"]';
      first = false;
    }
    contentItems.push( '            var postParam =  {'+param+'}; ' );
  } else {
    contentItems.push( '            var rowIdVal  =  ""; ' ); // TODO handle rowId Array
    contentItems.push( '            var postParam =  { }; ' );
  }
  contentItems.push( '            var colId =  tbl.data("cid"); ' );
  contentItems.push( '            var colVal =  tbl.is(":checked"); ' ); // TODO: need if(checkbox) ???
  contentItems.push( '            postParam[ colId ] =  colVal; ' );
  //contentItems.push( '            alert( "Post '+dataUrl+' "+ JSON.stringify(postParam) ); ' );
  contentItems.push( '            $.post( ' );
  contentItems.push( '               "'+dataUrl+'", postParam, function( response ) { }, "json"' );
  contentItems.push( '               ).done( ' );
  contentItems.push( '                  function(){ publishEvent( "feedback", {"text":"Row saved sucessfully"} ) } ' );
  contentItems.push( '               ).fail( ' );
  contentItems.push( '                  function(){ publishEvent( "feedback", {"text":"ERROR: Could not save row!"} ) } ' );
  contentItems.push( '               );');
  contentItems.push( '            event.preventDefault(); return false; ' );
  contentItems.push( '         }' );
  contentItems.push( '  );' );

  // linkfFor
  contentItems.push( '  $( "#'+divId+'PongTable" ).on( "click", ".tbl-link-icon", function() { ' );
  contentItems.push( '         if (  $( this ).data( "target" )  &&  $( this ).data( "target" ) != "_parent" ) { ' );
  contentItems.push( '             loadResourcesHTajax(  $( this ).data( "target" ), $( this ).data( "link" ) );' );
  contentItems.push( '         } else { window.open( $( this ).data( "link" ) );  } ' );
  contentItems.push( '  } );' );
  
  // AJAX commit changes for editable text cells
  contentItems.push( '  $( "#'+divId+'PongTable" ).on( "mouseover", ".editableTblCell", ' );
  contentItems.push( '         function() { $(this).parent().toggleClass( "optedithighlight", true ); return $(this); }' );
  contentItems.push( '  ).on( "mouseout", ".editableTblCell,.editableTblCellX", ' );
  contentItems.push( '         function() { $(this).parent().toggleClass( "optedithighlight", false ); return $(this); }' );
  contentItems.push( '  );' );
  contentItems.push( '  $( "#'+divId+'PongTable" ).on( "focus", ".editableTblCell", ' );
  contentItems.push( '     function() { pongTableSpanToInput( $(this) ); }');
  contentItems.push( '  ).on( "focusout", ".editableTblCellX", function() { ' );
  contentItems.push( '     var tbl = $(this); ' );
  contentItems.push( '     pongTableInputToSpan( tbl );');
  contentItems.push( '     if ( tbl.data("before") !== tbl.val() ) { ' );
  contentItems.push( '        tbl.data("before", tbl.val()); ' ); 
  if ( ( typeof tbl.rowId === 'string' ) ) {
    contentItems.push( '        var rowIdVal =  poTbl["'+divId+'"].pongTableData[ tbl.data("r") ]["'+tbl.rowId+'"]; ' );
    contentItems.push( '        var postParam =  { '+tbl.rowId+': rowIdVal }; ' );		
  } else if ( Array.isArray( tbl.rowId ) ) {
    var param = "";
    var first = true;
    for ( var x = 0; x < tbl.rowId.length; x++ ) {
      if ( ! first ) { param += ', '; } 
      param += tbl.rowId[x]+':poTbl["'+divId+'"].pongTableData[ tbl.data("r") ]["'+tbl.rowId[x]+'"]';
      first = false;
    }
    contentItems.push( '        var postParam =  {'+param+'}; ' );
  } else {
    contentItems.push( '        var rowIdVal  = ""; ' );   // TODO handle rowId Array
    contentItems.push( '        var postParam = {  }; ' );
  }
  contentItems.push( '        var colId =  tbl.data("cid"); ' );		
  contentItems.push( '        var colVal =  tbl.val(); ' );
  contentItems.push( '        postParam[ colId ] =  colVal; ' );
  contentItems.push( '        $.post( ' );
  contentItems.push( '           "'+dataUrl+'", postParam , function(response) {  }, "json"' );
  contentItems.push( '        ).done( ' );
  contentItems.push( '           function(){ publishEvent( "feedback", {"text":"Row saved sucessfully"} ) } ' );
  contentItems.push( '        ).fail( ' );
  contentItems.push( '           function(){ publishEvent( "feedback", {"text":"ERROR: Could not save row!"} ) } ' );
  contentItems.push( '        );');
  //contentItems.push( '        alert( "Post Data Error: { '+tbl.rowId+': "+rowIdVal+", "+colId+": "+colVal+" }   (r="+tbl.data("r") + "/c="+tbl.data("c")+") not stored!!"  ); ' );
  contentItems.push( '     }' );
  contentItems.push( '     return tbl;' );
  contentItems.push( '  }); ');
  contentItems.push( " }); </script>" );

  return contentItems;
}
717918
public function postUpdate()
    {
        $search = array();
        $replace = array();
        $dbPattern = array();
        $model = null;
        $j = 0;

        $components = Kwf_Component_Data_Root::getInstance()
            ->getComponentsByClass('Kwc_Columns_Component', array('ignoreVisible' => true));
        if (count($components) > 50) {
            echo "Kwc_Columns_Update_1: updating ".count($components)." components, this might take some time\n";
        }
        foreach ($components as $c) {
            if (!$model) $model = $c->getComponent()->getChildModel();
            $totalColumns = (int)substr($c->getComponent()->getRow()->type, 0, 1);

            $select = new Kwf_Model_Select();
            $select->whereEquals('component_id', $c->dbId);
            if ($model->countRows($select)) continue;

            for ($i = 1; $i <= $totalColumns; $i++) {
                $id = $model->createRow(array(
                    'component_id' => $c->dbId,
                    'pos' => $i,
                    'visible' => true
                ))->save();

                $s = $c->dbId . '-' . $i;
                $search[$j] = $s;
                $replace[$j] = $c->dbId . '-' . $id;

                $dbPattern[$j][] = $s . '-%';
                $dbPattern[$j][] = $s . '\_%';
                $dbPattern[$j][] = $s;

                $j++;
            }
        }

        if (empty($search)) return;

        $db = Zend_Registry::get('db');
        foreach ($db->listTables() as $table) {
            if ($table == 'cache_component') continue;
            if ($table == 'cache_component_includes') continue;
            if ($table == 'cache_component_url') continue;
            if ($table == 'cache_users') continue;
            $hasComponentId = false;
            $column = 'component_id';
            foreach ($db->query("SHOW FIELDS FROM $table")->fetchAll() as $field) {
                if ($table == 'kwf_pages') {
                    $column = 'parent_id';
                    $hasComponentId = true;
                } else if ($field['Field'] == 'component_id') {
                    $hasComponentId = true;
                }
            }

            if ($hasComponentId) {
                $where = "WHERE ";
                foreach ($search as $key => $value) {
                    $where .= "$column LIKE '" . implode("' OR $column LIKE '", $dbPattern[$key]) . "' OR ";
                }
                $where = substr($where, 0, strlen($where)-4);
                $sql = "SELECT $column FROM $table $where";
                $ids = $db->fetchCol($sql);
                if (empty($ids)) continue;

                $lastUpdatedId = false;
                foreach ($ids as $id) {
                    if ($lastUpdatedId == $id) continue;
                    $k = 0;
                    foreach ($search as $key => $value) {
                        if (strpos($id, $value) !== false) {
                            $k = $key;
                            break;
                        }
                    }
                    $sql = "UPDATE $table SET $column = " . $db->quote(str_replace($search[$k], $replace[$k], $id)) . "
                        WHERE $column = '$id'";
                    $db->query($sql);
                    $lastUpdatedId = $id;
                }
            }
        }

        $where = "WHERE ";
        foreach ($search as $key => $value) {
            $where .= "content LIKE '%href=\"" . implode("\"%' OR content LIKE '%href=\"", $dbPattern[$key]) . "\"%' OR content LIKE '%href=\n  \"" . implode("\"%' OR content LIKE '%href=\n  \"", $dbPattern[$key]) . "\"%' OR ";
        }
        $where = substr($where, 0, strlen($where)-4);

        $sql = "SELECT component_id, content FROM kwc_basic_text $where";
        $rows = $db->query($sql)->fetchAll();
        foreach ($rows as $row) {
            $k = 0;
            foreach ($search as $key => $value) {
                if (strpos($row['content'], $value) !== false) {
                    $row['content'] = preg_replace('#(href=\s*")([^"]*/)?([^"]*)'.preg_quote($search[$key]).'([^"]*)"#',
                                                   '\1\2\3'.$replace[$key].'\4"',
                                                   $row['content']);
                }
            }
            $sql = "UPDATE kwc_basic_text SET content = " . $db->quote($row['content']) . "
                        WHERE component_id = '".$row['component_id']."'";
            $db->query($sql);
        }
    }
1262424
def save(self, *args, **kwargs):
        """"""
        if not self.status:
            self.status = self.DRAFT
        # Published pages should always have a publication date
        if self.publication_date is None and self.status == self.PUBLISHED:
            self.publication_date = get_now()
        # Drafts should not, unless they have been set to the future
        if self.status == self.DRAFT:
            if settings.PAGE_SHOW_START_DATE:
                if (self.publication_date and
                        self.publication_date <= get_now()):
                    self.publication_date = None
            else:
                self.publication_date = None
        self.last_modification_date = get_now()
        super(Page, self).save(*args, **kwargs)
        # fix sites many-to-many link when the're hidden from the form
        if settings.PAGE_HIDE_SITES and self.sites.count() == 0:
            self.sites.add(Site.objects.get(pk=global_settings.SITE_ID))
1092154
def sync_mptt_tree_fields_from_draft_to_published_post_save(
        sender, instance, **kwargs):
    
    mptt_opts = getattr(instance, '_mptt_meta', None)
    published_copy = getattr(instance, 'publishing_linked', None)
    if mptt_opts and published_copy:
        sync_mptt_tree_fields_from_draft_to_published(instance)
861403
function (sid, session, callback) {
        var rec = {};

        // apply our properties:
        _applyProp(propSid, sid, rec);
        _applyProp(propData, serializer(session), rec);

        // opportunity to do:
        _applyProp(propLastActive, new Date(), rec);

        mongooseModel.findOneAndUpdate(_applyProp(propSid, sid), rec, {upsert: true}, function(err){
          (callback||_.noop)(err);
        });
      }
357708
def workflow_set_properties(object_id, input_params={}, always_retry=True, **kwargs):
    
    return DXHTTPRequest('/%s/setProperties' % object_id, input_params, always_retry=always_retry, **kwargs)
438281
function pongListUpdateData( divId, paramsObj ) {
  log( "PoNG-List",  'update '+divId );
  var tblDef = poTbl[ divId ].pongTableDef;

  if ( poTbl[ divId ].resourceURL != '-' ) {
    
    $.getJSON( tblDef.dataUrlFull, paramsObj ,
      function( data ) {  
        log( "PoNG-List",  JSON.stringify( data ) );
        var subdata = getSubData( data, tblDef.dataDocSubPath );
        pongListSetData( divId, subdata ); 
        publishEvent( 'feedback', {'text':'List data loaded sucessfully'} )
      } 
    ).fail( 
        function() { publishEvent( 'feedback', {'text':'List service offline? Config OK?'} ) } 
    );
    
  }
}
429136
def add_or_update(uid, post_data):
        '''
        
        '''
        cur_rec = MPost.get_by_uid(uid)
        if cur_rec:
            MPost.update(uid, post_data)
        else:
            MPost.create_post(uid, post_data)
886145
function update(annotationObject, changeSet) {
  const updatedAnnotation = Object.assign({}, annotationObject, changeSet);

  let changeDetected = false;
  Object.keys(updatedAnnotation).forEach((key) => {
    if (updatedAnnotation[key] !== annotationObject[key]) {
      changeDetected = true;
    }
  });

  if (changeDetected) {
    generation += 1;
    updatedAnnotation.generation = generation;
  }

  return updatedAnnotation;
}
154444
function update(clientModelDoc, callback) {
      var cb = callback || angular.noop;

      return ClientModelDoc.update(clientModelDoc,
        function (clientModelDoc) {
          return cb(clientModelDoc);
        },
        function (err) {
          return cb(err);
        }).$promise;
    }
726416
protected function submitAddFieldValue()
    {
        $this->setSubmitted(null, $this->getParam());
        $this->validateComponent('field_value');
        $this->addFieldValue();
    }
798024
function(propertyText, majorChange, overwrite, userCallback)
    {
        function enabledCallback(style)
        {
            if (userCallback)
                userCallback(style);
        }

        function callback(error, stylePayload)
        {
            WebInspector.cssModel._pendingCommandsMajorState.pop();
            if (!error) {
                if (majorChange)
                    WebInspector.domAgent.markUndoableState();
                this.text = propertyText;
                var style = WebInspector.CSSStyleDeclaration.parsePayload(stylePayload);
                var newProperty = style.allProperties[this.index];

                if (newProperty && this.disabled && !propertyText.match(/^\s*$/)) {
                    newProperty.setDisabled(false, enabledCallback);
                    return;
                }

                if (userCallback)
                    userCallback(style);
            } else {
                if (userCallback)
                    userCallback(null);
            }
        }

        if (!this.ownerStyle)
            throw "No ownerStyle for property";

        // An index past all the properties adds a new property to the style.
        WebInspector.cssModel._pendingCommandsMajorState.push(majorChange);
        CSSAgent.setPropertyText(this.ownerStyle.id, this.index, propertyText, overwrite, callback.bind(this));
    }