29 Settings::setDefaultValue(
"settings",
"enable_content_versioning",
false, Boolean,
"Enables content versioning for supported content items",
"Content Versioning");
46 for($i = 0; $i < func_num_args(); ++$i)
66 echo
"<p class='version_info'>$versionControls</p>";
86 $reversion->load(
$id);
88 foreach($reversion->versioned_fields as
$field)
97 if (!$contentVersion)
throw new FakoliException(
"No draft found for item");
98 $contentVersion->approve(
$target);
106 if ($version ==
'draft')
112 checkNumeric($version);
131 if (!$version) $version =
"";
135 $qs = getCleanQueryString();
136 parse_str(
$qs, $params);
141 $liveQs = http_build_query($params);
142 $params[
$param] =
"draft";
143 $draftQs = http_build_query($params);
146 if (!$hasDraft && $formMode)
153 if ($hasDraft && !$formMode)
155 $draftSelected = ($version ==
"draft") ?
" selected" :
"";
156 $liveSelected = ($version ==
"") ?
" selected" :
"";
158 $out .=
" <a class='pushbutton first{$liveSelected}' href='?{$liveQs}'>Live</a><a class='pushbutton last{$draftSelected}' href='?{$draftQs}'> Draft</a>";
162 if ($selectedVersion)
165 $owner =
$mgr->getUserFullName($selectedVersion->LastModifiedBy());
167 $out .= $selectedVersion->format(
"<span class='version'>Version {version_number} Last Edited By {$owner} on {last_modified}</span>");
170 if ($version ==
"draft" && $hasDraft)
172 $class = get_class($item);
173 $pkval = $item->getPrimaryKeyValue();
174 $out .=
"<a class='approve' href='#' onclick='VersionedContentManager.approve(\"{$class}\", {$pkval}); return false'>Approve</a>";
175 $out .=
" <a class='revert' href='#' onclick='VersionedContentManager.revert(\"{$class}\", {$pkval}); return false'>Discard Changes</a>";
183 $mgr->upgrade($version);
static fireEvent($event, $parameter=null, $mustBeConsumed=false)
Fire an event to all subscribers as detailed in their manifests.
static saveDraft($target)
Saves a draft version of the target object to the content version table.
static loadVersion($target, $version)
Update the versioned fields on the target object to the specified version.
static getVersion($target, $version)
static hasDraft($target)
Determine whether the specified target content item has a draft version outstanding.
static loadDraft($target)
Update the versioned fields on target object to the current draft version.
FakoliException is the base exception class for all Fakoli errors.
static getValue($component, $name)
Retrieve the value of the specified Setting.
static setDefaultValue($component, $name, $value, $field_type="String", $annotation="", $category="", $options="", $weight=0)
Sets the default value of the given component setting.
Provides the interface to the user model for the application.
Provides a central management class for event handlers and common functionality for the versioned_con...
VersionedContentManager()
static upgradeComponent($version)
static onDrawInlineControls($item)
static onSavePreProcess($form)
static selectDisplayVersion($target, $param="version")
static revert($target)
Revert the versioned fields on specified target to the current live values.
static $versionedContentClasses
static registerVersionedContent()
static enableVersioning($form)
static renderVersioningControls($item, $formMode=false)