17 require_once SQ_INCLUDE_PATH.
'/asset_status/asset_status.inc';
47 $this->status_tag = SQ_STATUS_LIVE;
61 return translate(
'status_live');
78 if (!$this->owner->writeAccess(
''))
return $statii;
80 $wfm = $GLOBALS[
'SQ_SYSTEM']->getWorkflowManager();
81 $running_schemas = $wfm->getSchemas($this->owner->id,
true,
true);
83 if (!empty($running_schemas)) {
86 pre_echo(
'FIXME: SOMETHING HAS GONE WRONG HERE');
89 $statii[SQ_STATUS_LIVE_APPROVAL] = translate(
'status_change_place_up_for_review');
90 $statii[SQ_STATUS_EDITING] = translate(
'status_change_safe_edit');
91 if ($this->owner->adminAccess(
'')) {
92 $statii[SQ_STATUS_UNDER_CONSTRUCTION] = translate(
'status_change_place_under_construction');
93 $statii[SQ_STATUS_ARCHIVED] = translate(
'status_change_archive');
114 if (!parent::processStatusChange($new_status, $update_parent)) {
118 switch ($new_status) {
119 case SQ_STATUS_LIVE_APPROVAL :
122 $wfm = $GLOBALS[
'SQ_SYSTEM']->getWorkflowManager();
123 $current_userid = $GLOBALS[
'SQ_SYSTEM']->currentUserId();
126 $ms = $GLOBALS[
'SQ_SYSTEM']->getMessagingService();
127 $user = $GLOBALS[
'SQ_SYSTEM']->am->getAsset($current_userid);
129 $schemas = $wfm->getSchemas($this->owner->id,
true);
130 if (!empty($schemas)) {
131 $ms = $GLOBALS[
'SQ_SYSTEM']->getMessagingService();
132 $msg = $ms->newMessage();
133 $msg->subject =
'Asset Up For Review';
134 $msg->type =
'asset.workflow.review';
137 'workflow_user' => $user->name,
138 'assetid' => $this->owner->id,
139 'type_code' => $GLOBALS[
'SQ_SYSTEM']->am->getTypeInfo($this->owner->type(),
'name'),
140 'asset_name' => $this->owner->name,
141 'workflow_url' => current_url().$this->owner->getBackendHref(
'workflow', FALSE),
143 $msg->replacements = $msg_reps;
144 $asset_edt_fns = $this->owner->getEditFns();
145 if (isset($asset_edt_fns->static_screens[
'preview'])) {
146 $msg->replacements[
'preview_url'] = current_url().$this->owner->getBackendHref(
'preview', FALSE);
148 $msg->replacements[
'preview_url'] = current_url().$this->owner->getBackendHref(
'details', FALSE);
151 if (!$wfm->startWorkflow($this->owner->id,
false, $msg)) {
152 trigger_localised_error(
'SYS0262', E_USER_WARNING, $this->owner->name);
157 if (!$wfm->silentWorkflowParty($this->owner->id)) {
158 $log = $ms->newMessage();
159 $log->type =
'asset.workflow.log.review';
161 'user_name' => $user->name,
162 'workflow_user' => $user->name,
163 'type_code' => $GLOBALS[
'SQ_SYSTEM']->am->getTypeInfo($this->owner->type(),
'name'),
164 'asset_name' => $this->owner->name,
165 'workflow_url' => current_url().$this->owner->getBackendHref(
'workflow', FALSE),
168 $log->replacements = $msg_reps;
169 $asset_edt_fns = $this->owner->getEditFns();
170 if (isset($asset_edt_fns->static_screens[
'preview'])) {
171 $log->replacements[
'preview_url'] = current_url().$this->owner->getBackendHref(
'preview', FALSE);
173 $log->replacements[
'preview_url'] = current_url().$this->owner->getBackendHref(
'details', FALSE);
175 $log->parameters[
'assetid'] = $this->owner->id;
176 $log->parameters[
'version'] = substr($this->owner->version, 0, strrpos($this->owner->version,
'.'));
177 $ms->enqueueMessage($log);
182 case SQ_STATUS_EDITING :
184 if (!$this->owner->saveSystemVersion()) {
185 trigger_localised_error(
'SYS0208', E_USER_WARNING);