diff --git a/module/ai/config.php b/module/ai/config.php index 714cd6a943..51e8a24a59 100644 --- a/module/ai/config.php +++ b/module/ai/config.php @@ -56,7 +56,20 @@ $config->ai->targetFormVars['execution'] = array(); /* Menu printing configurations. */ $config->ai->menuPrint = new stdclass(); -$config->ai->menuPrint->locations = array(); // Menu location definations, defines acceptable module-methods and on page menu locations. +/** + * Menu location definations, defines acceptable module-methods and on page menu locations, etc. + * + * @param string $module prompt module name (actual module could differ from prompt module name) + * @param string $targetContainer injection target container selector + * @param string $class class of menu or dropdown button + * @param string $buttonClass specified class of action menu buttons + * @param string $dropdownClass specified class of dropdown menu button + * @param string $objectVarName object variable name of view + * @param string $stylesheet stylesheet to be injected + * @param string $injectMethod injection jQuery method, `append` by default + * @see ./view/promptmenu.html.php + */ +$config->ai->menuPrint->locations = array(); $config->ai->menuPrint->locations['story']['view'] = (object)array('module' => 'story', 'targetContainer' => '#mainContent .cell:first-of-type .detail:first-of-type .detail-title', 'class' => 'pull-right', 'stylesheet' => '#mainContent .cell:first-of-type .detail:first-of-type .detail-title>button {margin-left: 10px;} #mainContent .cell:first-of-type .detail:first-of-type .detail-content {margin-top: 12px;}'); $config->ai->menuPrint->locations['projectstory']['view'] = $config->ai->menuPrint->locations['story']['view']; $config->ai->menuPrint->locations['execution']['storyView'] = $config->ai->menuPrint->locations['story']['view']; diff --git a/module/ai/view/promptmenu.html.php b/module/ai/view/promptmenu.html.php index 79177ebaff..1b9cc71e0f 100644 --- a/module/ai/view/promptmenu.html.php +++ b/module/ai/view/promptmenu.html.php @@ -26,16 +26,18 @@ ?> objectVarName) ? $menuOptions->module : $menuOptions->objectVarName; + $currentObjectId = !empty($this->view->$objectVarName) ? $this->view->$objectVarName->id : 0; if(count($prompts) > 1) { $html .= ''; } else { $prompt = current($prompts); - $html .= html::commonButton($prompt->name . ($prompt->status != 'active' ? '' . $lang->ai->prompts->statuses[$prompt->status] . '' : ''), "title='{$prompt->desc}'", 'btn btn-link' . ((isset($menuOptions->class) ? ' ' . $menuOptions->class : '') . (isset($menuOptions->buttonClass) ? ' ' . $menuOptions->buttonClass : ''))); + $html .= html::linkButton($prompt->name . ($prompt->status != 'active' ? '' . $lang->ai->prompts->statuses[$prompt->status] . '' : ''), helper::createLink('ai', 'execute', "promptId=$prompt->id&objectId=$currentObjectId"), 'self', "title='{$prompt->desc}'", 'btn btn-link' . ((isset($menuOptions->class) ? ' ' . $menuOptions->class : '') . (isset($menuOptions->buttonClass) ? ' ' . $menuOptions->buttonClass : ''))); } ?>