addPackagePageToAdminBreadcrumb($Package,'manage'); $Bootstrap->addPackagePageToAdminBreadcrumb($Package,'edit'); $manage = $Bootstrap->makeAdminURL($Package,'manage'); $edit = $Bootstrap->makeAdminURL($Package,'edit'); $delete = $Bootstrap->makeAdminURL($Package,'delete'); define (HTML_FORM_TH_ATTR,"valign=top align=left width='15%'"); define (HTML_FORM_TD_ATTR,"valign=top align=left"); define (HTML_FORM_MAX_FILE_SIZE, 10485760); // 10 MB include_once(PACKAGE_DIRECTORY.'../TabbedForm.php'); $SelfHostedPluginContainer = new SelfHostedPluginContainer(); if ($_REQUEST['shpid']){ $SelfHostedPlugin = $SelfHostedPluginContainer->getSelfHostedPlugin($_REQUEST['shpid']); } if (!$SelfHostedPlugin){ $SelfHostedPlugin = new SelfHostedPlugin(); } /****************************************************************** * Field Level Validation * Only performed if they've submitted the form ******************************************************************/ if ($_POST['form_submitted'] == 'true'){ // They hit the cancel button, return to the Manage Pages page if ($_POST['cancel']){ header("Location:".$manage); exit(); } /****************************************************************** * BEGIN EDITS * If an edit fails, it adds an error to the message list. ******************************************************************/ /****************************************************************** * END EDITS ******************************************************************/ /****************************************************************** * BEGIN Set Parameters ******************************************************************/ /****************************************************************** * END Set Parameters ******************************************************************/ // If there are no messages/errors, then go ahead and do the update (or add) // Note: if they were deleting a version, then there will be a message, so // this section won't get performed if (!$MessageList->hasMessages()){ $PluginSource=$_FILES['PluginZIP']['tmp_name']; if ($PluginSource != "" and $PluginSource !="none"){ $result = $SelfHostedPluginContainer->addUploadedPluginFile('PluginZIP',$SelfHostedPlugin); if (PEAR::isError($result)){ $MessageList->addMessage($result->getMessage(),MESSAGE_TYPE_ERROR); } } } // Trigger an object update, useful for plugins that want to modify behaviour on object update if (!$MessageList->hasMessages()){ $SelfHostedPluginContainer->updateSelfHostedPlugin($SelfHostedPlugin); } } /**************************************************************************** * * BEGIN Display Code * The following code sets how the page will actually display. * ****************************************************************************/ // Declaration of the Form $form = new HTML_TabbedForm($Bootstrap->getAdminURL(),'post','Update_Form','','multipart/form-data'); /*********************************************************************** * * SelfHostedPlugin Tab * ***********************************************************************/ $SelfHostedPluginTab = new HTML_Tab('SelfHostedPlugin','Self Hosted Plugin'); $SelfHostedPluginTab->addPlainText(' ',' Important: your plugin will be modified when you upload it. Three things happen.
[self-hosted-plugins slug='.$SelfHostedPlugin->getParameter('SelfHostedPluginSlug').'] - the download link';
$shortcodes[] = '[self-hosted-plugins slug='.$SelfHostedPlugin->getParameter('SelfHostedPluginSlug').' history=true] - all versions with download links';
$shortcodes[] = '[self-hosted-plugins slug='.$SelfHostedPlugin->getParameter('SelfHostedPluginSlug').' details=true] - the plugin details page';
$SelfHostedPluginTab->addPlainText('Shortcodes:',join('
".$MessageList->toBullettedString()); $DefaultTab = 'MessageTab'; $form->addTab($MessageTab); } $$DefaultTab->setDefault(); // Here are the buttons $form->addSubmit('save','Save Changes'); $form->addSubmit('cancel','Cancel'); // Some hidden fields to help us out $form->addHidden('form_submitted','true'); $form->addHidden('shpid',$SelfHostedPlugin->getParameter('SelfHostedPluginID')); // Finally, we set the Smarty variables as needed. $smarty->assign('includes_tabbed_form',true); $smarty->assign('form',$form); $smarty->assign('form_attr','width=90% align=center'); $smarty->assign('Tabs',$form->getTabs()); //$smarty->assign('admin_head_extras',$admin_head_extras); ?> display('admin_form.tpl'); ?>