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); } }