Project

General

Profile

Feature #2918 ยป patch-2918.txt

Sonja Schubert, 2009-03-19 17:22

 
### Eclipse Workspace Patch 1.0
#P igeworkspace42
Index: typo3/mod/user/ws/class.wsstagelib.php
===================================================================
--- typo3/mod/user/ws/class.wsstagelib.php (revision 287)
+++ typo3/mod/user/ws/class.wsstagelib.php (working copy)
@@ -115,6 +115,9 @@
if($stageid === '0') {
$nextStage = $workspaceStageRecs[0];
$nextStage['uid'] = $nextStage['uid']+20;
+ if(!empty($nextStage['responsible_persons'])) {
+ $nextStage['responsible_persons'] = $this->getResponsibleUser($nextStage['responsible_persons']);
+ }
return $nextStage;
}
@@ -126,6 +129,9 @@
if($workspaceStageRecs[$array_key+1]) {
$nextStage = $workspaceStageRecs[$array_key+1];
$nextStage['uid'] = $nextStage['uid']+20;
+ if(!empty($nextStage['responsible_persons'])) {
+ $nextStage['responsible_persons'] = $this->getResponsibleUser($nextStage['responsible_persons']);
+ }
} else {
$nextStage['uid'] = '10';
}
@@ -152,6 +158,9 @@
if($stageid == '10') {
$prevStage = end($workspaceStageRecs);
$prevStage['uid'] = $prevStage['uid']+20;
+ if(!empty($prevStage['responsible_persons'])) {
+ $prevStage['responsible_persons'] = $this->getResponsibleUser($prevStage['responsible_persons']);
+ }
} else {
while (list($array_key, $workspaceStageRec) = each($workspaceStageRecs)) {
if($workspaceStageRec['uid'] == ($stageid-20)) {
@@ -159,6 +168,9 @@
if($workspaceStageRecs[$array_key-1]) {
$prevStage = $workspaceStageRecs[$array_key-1];
$prevStage['uid'] = $prevStage['uid']+20;
+ if(!empty($prevStage['responsible_persons'])) {
+ $prevStage['responsible_persons'] = $this->getResponsibleUser($prevStage['responsible_persons']);
+ }
} else {
// First stage is always the standart edit stage
$prevStage['uid'] = '0';
@@ -172,6 +184,82 @@
return false;
}
}
+
+ /**
+ * Get uids of all responsilbe persons for a stage
+ *
+ * @param string responsible_persion value from stage record
+ * @return string uid list of responsible be_users
+ */
+ function getResponsibleUser($stageRespValue) {
+ $stageValuesArray = t3lib_div::trimExplode(',',$stageRespValue);
+
+ $beuserUidArray = array();
+ $begroupUidArray = array();
+ $subgroupUidArray = array();
+
+ foreach($stageValuesArray as $key => $uidvalue) {
+ if(strstr($uidvalue, 'be_users') !== FALSE) { // Current value is a uid of a be_user record
+ $beuserUidArray[] = str_replace('be_users_','',$uidvalue);
+ } else {
+ $begroupUidArray[] = str_replace('be_groups_','',$uidvalue);
+ }
+ }
+
+ if(!empty($begroupUidArray)) {
+ $allBeUserArray = t3lib_befunc::getUserNames();
+ $begroupUidList = implode(',',$begroupUidArray);
+ $begroupUidArray = $this->fetchGroups($begroupUidList);
+
+ foreach($begroupUidArray as $groupkey => $groupData) {
+ foreach($allBeUserArray as $useruid => $userdata) {
+ if(t3lib_div::inList($userdata['usergroup'],$groupData['uid'])) {
+ $beuserUidArray[] = $useruid;
+ }
+ }
+ }
+
+ }
+
+ array_unique($beuserUidArray);
+ return implode(',',$beuserUidArray);
+ }
+
+ function fetchGroups($grList,$idList='') {
+ global $TYPO3_CONF_VARS;
+
+ $whereSQL = 'deleted=0 AND hidden=0 AND pid=0 AND uid IN ('.$grList.')';
+ $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'be_groups', $whereSQL);
+
+ // The userGroups array is filled
+ while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
+ $this->userGroups[$row['uid']] = $row;
+ }
+
+ // Traversing records in the correct order
+ $include_staticArr = t3lib_div::intExplode(',',$grList);
+ reset($include_staticArr);
+ while(list(,$uid)=each($include_staticArr)) { // traversing list
+ // Get row:
+ $row = $this->userGroups[$uid];
+ if (is_array($row) && !t3lib_div::inList($idList,$uid)) { // Must be an array and $uid should not be in the idList, because then it is somewhere previously in the grouplist
+ // If the localconf.php option isset the user of the sub- sub- groups will also be used
+ if($GLOBALS['TYPO3_CONF_VARS']['BE']['customStageShowRecipientRecursive'] == 1) {
+ // Include sub groups
+ if (trim($row['subgroup'])) {
+ $theList = implode(',',t3lib_div::intExplode(',',$row['subgroup'])); // Make integer list
+ return $this->fetchGroups($theList, $idList.','.$uid); // Call recursively, pass along list of already processed groups so they are not recursed again.
+ } else {
+ return $this->userGroups;
+ }
+ }
+ return $this->userGroups;
+ } else {
+ return $this->userGroups;
+ }
+ }
+ }
+
}
Index: t3lib/class.t3lib_tcemain.php
===================================================================
--- t3lib/class.t3lib_tcemain.php (revision 285)
+++ t3lib/class.t3lib_tcemain.php (working copy)
@@ -4715,10 +4715,17 @@
if($workspaceRec['use_custom_staging'] == '1' && $stageId !== '10') { // Check if custom staging is activated
if($record['t3ver_stage'] !== '0') {
$workspaceCurrentStageRec = t3lib_BEfunc::getRecord('sys_workspace_stage', $record['t3ver_stage']-20);
- if((t3lib_div::inList($workspaceCurrentStageRec['responsible_persons'],$GLOBALS['BE_USER']->user['uid']) && $stat['_ACCESS']==='member') ||
+ if((t3lib_div::inList($workspaceCurrentStageRec['responsible_persons'],'be_users_'.$GLOBALS['BE_USER']->user['uid']) && $stat['_ACCESS']==='member') ||
($stat['_ACCESS']==='owner')) { // Only if the user is responsible for the element in the current stage or he is owner he's allowed to change the stage forward or backwards
$changeStageAccess = TRUE;
}
+
+ foreach($GLOBALS['BE_USER']->userGroupsUID as $groupUid) {
+ if ((t3lib_div::inList($workspaceCurrentStageRec['responsible_persons'],'be_groups_'.$groupUid) && $stat['_ACCESS']==='member') ||
+ ($stat['_ACCESS']==='owner')) { // Only if the user is responsible for the element in the current stage or he is owner he's allowed to change the stage forward or backwards
+ $changeStageAccess = TRUE;
+ }
+ }
} elseif(($record['t3ver_stage'] === '0') && ($stat['_ACCESS']==='member')) {
$changeStageAccess = TRUE;
}
Index: t3lib/stddb/tbl_be.php
===================================================================
--- t3lib/stddb/tbl_be.php (revision 286)
+++ t3lib/stddb/tbl_be.php (working copy)
@@ -944,9 +944,10 @@
'config' => array(
'type' => 'group',
'internal_type' => 'db',
- 'allowed' => 'be_users',
+ 'allowed' => 'be_users,be_groups',
+ 'prepend_tname' => 1,
'size' => '3',
- 'maxitems' => '20',
+ 'maxitems' => '100',
'autoSizeMax' => 20,
'show_thumbs' => '1'
)
Index: t3lib/config_default.php
===================================================================
--- t3lib/config_default.php (revision 270)
+++ t3lib/config_default.php (working copy)
@@ -200,6 +200,7 @@
'ModuleMenu::render' => 'typo3/classes/class.modulemenu.php:ModuleMenu->renderAjax',
'SC_mod_web_perm_ajax::dispatch' => 'typo3/mod/web/perm/class.sc_mod_web_perm_ajax.php:SC_mod_web_perm_ajax->dispatch'
),
+ 'customStageShowRecipientRecursive' => FALSE, // If true the email recipients for custom stage change will be used from selected be_group and sub be_groups recursive
'XCLASS' => Array(), // See 'Inside TYPO3' document for more information.
),
'FE' => Array( // Configuration for the TypoScript frontend (FE). Nothing here relates to the administration backend!
Index: t3lib/class.t3lib_userauthgroup.php
===================================================================
--- t3lib/class.t3lib_userauthgroup.php (revision 285)
+++ t3lib/class.t3lib_userauthgroup.php (working copy)
@@ -800,10 +800,17 @@
$stat = $this->checkWorkspaceCurrent();
if($this->workspaceRec['use_custom_staging'] == '1' && $stage !== '0' && $stage !== '10') { // Check if custom staging is activated
$workspaceStageRec = t3lib_BEfunc::getRecord('sys_workspace_stage', $stage-20); // Get custom stage record
- if((t3lib_div::inList($workspaceStageRec['responsible_persons'],$this->user['uid']) && $stat['_ACCESS']==='member') ||
+ if((t3lib_div::inList($workspaceStageRec['responsible_persons'],'be_users_'.$this->user['uid']) && $stat['_ACCESS']==='member') ||
($stat['_ACCESS']==='owner')) {
return TRUE; // OK for these criteria
}
+
+ foreach($this->userGroupsUID as $groupUid) {
+ if ((t3lib_div::inList($workspaceStageRec['responsible_persons'],'be_groups_'.$groupUid) && $stat['_ACCESS']==='member') ||
+ ($stat['_ACCESS']==='owner')) {
+ return TRUE; // OK for these criteria
+ }
+ }
} else {
$memberStageLimit = $this->workspaceRec['review_stage_edit'] ? 1 : 0;
if (($stage<=$memberStageLimit && $stat['_ACCESS']==='member') ||
    (1-1/1)