function diasalsa_content_edit(&$pObject, &$pParamHash) { global $gBitSystem, $gBitSmarty, $gBitUser, $gBitThemes; $excludeContent = array(SALSAACTION_CONTENT_TYPE_GUID, BITCOMMENT_CONTENT_TYPE_GUID, BITUSER_CONTENT_TYPE_GUID, BITGROUP_CONTENT_TYPE_GUID, BITBOARD_CONTENT_TYPE_GUID); if ($gBitSystem->isPackageActive('diasalsa') && !in_array($pObject->getContentType(), $excludeContent)) { $action = new SalsaAction(); if (!empty($_REQUEST['connect_group_content_id'])) { $connect_group_content_id = $_REQUEST['connect_group_content_id']; } if (!empty($_REQUEST['link_action_content_id'])) { // for preview we override any current link - we might be changing it $action_content_id = $_REQUEST['link_action_content_id']; } elseif ($pObject->isValid()) { // get the current linked action if it exists $action_content_id = $action->getActionLink($pObject->mContentId); } if (!empty($action_content_id)) { $action2 = new SalsaAction(NULL, $action_content_id); $action2->load(); $gBitSmarty->assign('linkedAction', $action2->mInfo); } if ($pObject->isValid()) { /* redundant to groups too bad */ if (empty($contect_group_content_id)) { $listHash['mapped_content_id'] = $pObject->mContentId; $listHash['offset'] = 0; $group = new BitGroup(); $groups = $group->getList($listHash); if (count($groups) == 1) { $connect_group_content_id = $groups[0]['content_id']; } } } if (!empty($connect_group_content_id)) { $actionOptions = $action->getActionsByGroupId($connect_group_content_id); $options[''] = "Select one"; foreach ($actionOptions as $opt) { $options[$opt['content_id']] = $opt['title']; } $gBitSmarty->assign('actionOptions', $options); } $gBitThemes->loadAjax('mochikit', array('Iter.js', 'DOM.js')); $gBitThemes->loadJavascript(DIASALSA_PKG_PATH . 'scripts/DIASalsa.js', TRUE); } }
function group_content_verify(&$pObject, &$pParamHash) { global $gBitSystem, $gBitUser; // services are tripped even on native group object its board and other content we don't map to groups - we ignore those $excludeContent = array(BITCOMMENT_CONTENT_TYPE_GUID, BITUSER_CONTENT_TYPE_GUID, BITGROUP_CONTENT_TYPE_GUID); if ($gBitSystem->isPackageActive('group') && !in_array($pObject->getContentType(), $excludeContent) && !($pObject->getContentType() == BITBOARD_CONTENT_TYPE_GUID && !empty($pParamHash['group']['bypass_map_required']))) { // if mapping is required we need a group content id, we'll try to get one unless the user can bypass this process // we ignore comments and users since they are never mapped if ($gBitSystem->isFeatureActive('group_map_required') && !($gBitUser->isAdmin() || $pObject->hasUserPermission('p_group_edit_unmapped'))) { $connect_group_content_id = NULL; if (!empty($pParamHash['connect_group_content_id'])) { $connect_group_content_id = $pParamHash['connect_group_content_id']; } elseif ($pObject->isValid()) { $listHash['mapped_content_id'] = $pObject->mContentId; $listHash['offset'] = 0; $group = new BitGroup(); $groups = $group->getList($listHash); if (count($groups) == 1) { // also assign it to the hash - this will save us a step when the store service is called $pParamHash['connect_group_content_id'] = $connect_group_content_id = $groups[0]['content_id']; } } if (empty($connect_group_content_id)) { $pObject->mErrors['group_mappping'] = tra("You do not have permission to edit content outside of groups. Please copy your changes to some other work space, you can not save your changes."); } } } }
} if (empty($_REQUEST['content_type_guid'])) { // maps needs a signal to get a default list $_REQUEST['content_type_guid'] = 'Any'; // force comments inclusion since it would be stupid not to include comments (discussions) $_REQUEST['include_comments'] = 'y'; } include_once GMAP_PKG_PATH . 'map_content_list_inc.php'; // end } elseif (!empty($_REQUEST['search_group_content_id'])) { // override group content type param if coupled with a search_group_content_id if (!empty($_REQUEST['content_type_guid']) && $_REQUEST['content_type_guid'] == 'bitgroup') { $_REQUEST['content_type_guid'] = NULL; } if (empty($_REQUEST['content_type_guid'])) { // force comments inclusion since it would be stupid not to include comments (discussions) $_REQUEST['include_comments'] = 'y'; } // we use the group list.tpl not liberty's so just give us the results $_REQUEST['output'] = 'raw'; include_once LIBERTY_PKG_PATH . 'list_content.php'; $gBitSmarty->assign_by_ref('contentList', $contentList); } else { $group = new BitGroup(); $groupsList = $group->getList($_REQUEST); $gBitSmarty->assign_by_ref('contentList', $groupsList); // getList() has now placed all the pagination information in $_REQUEST['listInfo'] $gBitSmarty->assign_by_ref('listInfo', $_REQUEST['listInfo']); } // Display the list template $gBitSystem->display('bitpackage:group/search_groups.tpl', tra('Groups'), array('display_mode' => 'list'));