public function ResetField($fieldAlias, $pkVal = NULL) { if (!$this->FieldExists($fieldAlias)) { return; } if (uEvents::TriggerEvent('BeforeResetField', $this, $fieldAlias) === FALSE) { return FALSE; } // reset the field. $enc_name = $this->GetEncodedFieldName($fieldAlias, $pkVal); $newRec = is_null($pkVal) ? NULL : $this->LookupRecord($pkVal, true); $data = $this->GetCellData($fieldAlias, $newRec, $this->GetTargetURL($fieldAlias, $newRec)); utopia::AjaxUpdateElement('.' . $enc_name, $data); // if this field is the PK of a linked table also update all fields associated with that table $info = $this->fields[$fieldAlias]; $tbl = array(); foreach ($this->sqlTableSetupFlat as $t) { if (isset($t['joins'])) { foreach ($t['joins'] as $from => $to) { if ($from == $info['field'] || $to == $info['field']) { $tbl[] = $t['alias']; } } } } foreach ($this->fields as $alias => $info) { if (array_search($info['tablename'], $tbl) === false) { continue; } $enc_name = $this->GetEncodedFieldName($alias, $pkVal); $data = $this->GetCellData($alias, $newRec, $this->GetTargetURL($alias, $newRec)); utopia::AjaxUpdateElement('.' . $enc_name, $data); } }
public static function RefreshList() { if (utopia::GetCurrentModule() !== __CLASS__) { return; } $obj = utopia::GetInstance(__CLASS__); $relational = $obj->GetNestedArray(); $r = $obj->GetChildren($relational); // javascript: find open folders (visible ui-treesort-folder with visible ul) AjaxEcho('var openfolders = $(\'.ui-treesort-folder:has(ul:visible)\');'); utopia::AjaxUpdateElement('.uCMS_List', $r); AjaxEcho('InitialiseTree();'); AjaxEcho('$(openfolders).each(function() {$(\'#\'+$(this).attr(\'id\')).children(\'ul\').show();});'); AjaxEcho('RefreshIcons();'); }