From 4a3dab3ddbf197c7b88aed33fde624eae1a720e6 Mon Sep 17 00:00:00 2001 From: Wouter van Oijen Date: Tue, 18 Apr 2006 13:21:16 +0000 Subject: [PATCH] Added file upload ability to the Rich Text Editor Reordered the operations array in Operations.pm --- lib/WebGUI/Operation.pm | 390 ++++++++++-------- lib/WebGUI/Operation/FormHelpers.pm | 186 ++++++++- .../i18n/English/Operation_FormHelpers.pm | 41 ++ 3 files changed, 434 insertions(+), 183 deletions(-) create mode 100644 lib/WebGUI/i18n/English/Operation_FormHelpers.pm diff --git a/lib/WebGUI/Operation.pm b/lib/WebGUI/Operation.pm index 0d45c8efc..c0c76c5df 100644 --- a/lib/WebGUI/Operation.pm +++ b/lib/WebGUI/Operation.pm @@ -77,184 +77,222 @@ Returns a hash reference containing operation and package names. sub getOperations { return { - 'deleteAd' => 'WebGUI::Operation::AdSpace', - 'deleteAdSpace' => 'WebGUI::Operation::AdSpace', - 'editAd' => 'WebGUI::Operation::AdSpace', - 'editAdSave' => 'WebGUI::Operation::AdSpace', - 'editAdSpace' => 'WebGUI::Operation::AdSpace', - 'editAdSpaceSave' => 'WebGUI::Operation::AdSpace', - 'manageAdSpaces' => 'WebGUI::Operation::AdSpace', - 'clickAd' => 'WebGUI::Operation::AdSpace', - 'editVersionTag' => 'WebGUI::Operation::VersionTag', - 'editVersionTagSave' => 'WebGUI::Operation::VersionTag', - 'commitVersionTag' => 'WebGUI::Operation::VersionTag', - 'commitVersionTagConfirm' => 'WebGUI::Operation::VersionTag', - 'manageCommittedVersions' => 'WebGUI::Operation::VersionTag', - 'approveVersionTag' => 'WebGUI::Operation::VersionTag', - 'manageVersions' => 'WebGUI::Operation::VersionTag', - 'manageRevisionsInTag' => 'WebGUI::Operation::VersionTag', - 'rollbackVersionTag' => 'WebGUI::Operation::VersionTag', - 'setWorkingVersionTag' => 'WebGUI::Operation::VersionTag', - 'promoteWorkflowActivity' => 'WebGUI::Operation::Workflow', - 'demoteWorkflowActivity' => 'WebGUI::Operation::Workflow', - 'addWorkflow' => 'WebGUI::Operation::Workflow', - 'deleteWorkflow' => 'WebGUI::Operation::Workflow', - 'runWorkflow' => 'WebGUI::Operation::Workflow', - 'editWorkflowActivity' => 'WebGUI::Operation::Workflow', - 'editWorkflowActivitySave' => 'WebGUI::Operation::Workflow', - 'deleteWorkflowActivity' => 'WebGUI::Operation::Workflow', - 'addWorkflowSave' => 'WebGUI::Operation::Workflow', - 'editWorkflow' => 'WebGUI::Operation::Workflow', - 'editWorkflowSave' => 'WebGUI::Operation::Workflow', - 'manageWorkflows' => 'WebGUI::Operation::Workflow', - 'manageCron' => 'WebGUI::Operation::Cron', - 'editCronJob' => 'WebGUI::Operation::Cron', - 'editCronJobSave' => 'WebGUI::Operation::Cron', - 'deleteCronJob' => 'WebGUI::Operation::Cron', - 'adminConsole' => 'WebGUI::Operation::Admin', - 'switchOffAdmin' => 'WebGUI::Operation::Admin', - 'switchOnAdmin' => 'WebGUI::Operation::Admin', - 'auth' => 'WebGUI::Operation::Auth', - 'copyDatabaseLink' => 'WebGUI::Operation::DatabaseLink', - 'deleteDatabaseLink' => 'WebGUI::Operation::DatabaseLink', - 'deleteDatabaseLinkConfirm' => 'WebGUI::Operation::DatabaseLink', - 'editDatabaseLink' => 'WebGUI::Operation::DatabaseLink', - 'editDatabaseLinkSave' => 'WebGUI::Operation::DatabaseLink', - 'listDatabaseLinks' => 'WebGUI::Operation::DatabaseLink', - 'copyLDAPLink' => 'WebGUI::Operation::LDAPLink', - 'deleteLDAPLink' => 'WebGUI::Operation::LDAPLink', - 'editLDAPLink' => 'WebGUI::Operation::LDAPLink', - 'editLDAPLinkSave' => 'WebGUI::Operation::LDAPLink', - 'listLDAPLinks' => 'WebGUI::Operation::LDAPLink', - - 'formAssetTree' => 'WebGUI::Operation::FormHelpers', - 'richEditPageTree' => 'WebGUI::Operation::FormHelpers', - 'richEditImageTree' => 'WebGUI::Operation::FormHelpers', - 'richEditViewThumbnail' => 'WebGUI::Operation::FormHelpers', - 'manageUsersInGroup' => 'WebGUI::Operation::Group', - 'deleteGroup' => 'WebGUI::Operation::Group', - 'deleteGroupConfirm' => 'WebGUI::Operation::Group', - 'deleteGroupConfirm' => 'WebGUI::Operation::Group', - 'deleteGroupGrouping' => 'WebGUI::Operation::Group', - 'editGroup' => 'WebGUI::Operation::Group', - 'editGroupSave' => 'WebGUI::Operation::Group', - 'listGroups' => 'WebGUI::Operation::Group', - 'emailGroup' => 'WebGUI::Operation::Group', - 'emailGroupSend' => 'WebGUI::Operation::Group', - 'manageGroupsInGroup' => 'WebGUI::Operation::Group', - 'addGroupsToGroupSave' => 'WebGUI::Operation::Group', - 'addUsersToGroupSave' => 'WebGUI::Operation::Group', - 'deleteGroupGrouping' => 'WebGUI::Operation::Group', - 'autoAddToGroup' => 'WebGUI::Operation::Group', - 'autoDeleteFromGroup' => 'WebGUI::Operation::Group', - 'addUsersToGroupSave' => 'WebGUI::Operation::Group', - 'viewHelp' => 'WebGUI::Operation::Help', - 'viewHelpIndex' => 'WebGUI::Operation::Help', - 'viewHelpTOC' => 'WebGUI::Operation::Help', - 'viewHelpChapter' => 'WebGUI::Operation::Help', - 'viewInbox' => 'WebGUI::Operation::Inbox', - 'viewInboxMessage' => 'WebGUI::Operation::Inbox', - 'editProfile' => 'WebGUI::Operation::Profile', - 'editProfileSave' => 'WebGUI::Operation::Profile', - 'viewProfile' => 'WebGUI::Operation::Profile', - 'deleteProfileCategoryConfirm' => 'WebGUI::Operation::ProfileSettings', - 'deleteProfileFieldConfirm' => 'WebGUI::Operation::ProfileSettings', - 'editProfileCategorySave' => 'WebGUI::Operation::ProfileSettings', - 'editProfileFieldSave' => 'WebGUI::Operation::ProfileSettings', - 'deleteProfileCategory' => 'WebGUI::Operation::ProfileSettings', - 'deleteProfileField' => 'WebGUI::Operation::ProfileSettings', - 'editProfileCategory' => 'WebGUI::Operation::ProfileSettings', - 'editProfileField' => 'WebGUI::Operation::ProfileSettings', - 'moveProfileCategoryDown' => 'WebGUI::Operation::ProfileSettings', - 'moveProfileCategoryUp' => 'WebGUI::Operation::ProfileSettings', - 'moveProfileFieldDown' => 'WebGUI::Operation::ProfileSettings', - 'moveProfileFieldUp' => 'WebGUI::Operation::ProfileSettings', - 'editProfileSettings' => 'WebGUI::Operation::ProfileSettings', - 'deleteReplacement' => 'WebGUI::Operation::Replacements', - 'editReplacement' => 'WebGUI::Operation::Replacements', - 'editReplacementSave' => 'WebGUI::Operation::Replacements', - 'listReplacements' => 'WebGUI::Operation::Replacements', - 'setScratch' => 'WebGUI::Operation::Scratch', - 'deleteScratch' => 'WebGUI::Operation::Scratch', - 'saveSettings' => 'WebGUI::Operation::Settings', - 'editSettings' => 'WebGUI::Operation::Settings', - 'viewStatistics' => 'WebGUI::Operation::Statistics', - 'killSession' => 'WebGUI::Operation::ActiveSessions', - 'viewLoginHistory' => 'WebGUI::Operation::LoginHistory', - 'viewActiveSessions' => 'WebGUI::Operation::ActiveSessions', - 'makePrintable' => 'WebGUI::Operation::Style', - 'setPersonalStyle' => 'WebGUI::Operation::Style', - 'unsetPersonalStyle' => 'WebGUI::Operation::Style', - 'editUserKarma' => 'WebGUI::Operation::User', - 'editUserKarmaSave' => 'WebGUI::Operation::User', - 'deleteGrouping' => 'WebGUI::Operation::Group', - 'editGrouping' => 'WebGUI::Operation::Group', - 'editGroupingSave' => 'WebGUI::Operation::Group', - 'becomeUser' => 'WebGUI::Operation::User', - 'deleteUser' => 'WebGUI::Operation::User', - 'deleteUserConfirm' => 'WebGUI::Operation::User', - 'editUser' => 'WebGUI::Operation::User', - 'editUserSave' => 'WebGUI::Operation::User', - 'listUsers' => 'WebGUI::Operation::User', - 'setup' => 'WebGUI::Operation::WebGUI', - 'theWg' => 'WebGUI::Operation::WebGUI', - 'genesis' => 'WebGUI::Operation::WebGUI', - 'deleteSubscription' => 'WebGUI::Operation::Subscription', - 'editSubscription' => 'WebGUI::Operation::Subscription', - 'editSubscriptionSave' => 'WebGUI::Operation::Subscription', - 'listSubscriptions' => 'WebGUI::Operation::Subscription', - 'purchaseSubscription' => 'WebGUI::Operation::Subscription', - 'createSubscriptionCodeBatch' => 'WebGUI::Operation::Subscription', - 'createSubscriptionCodeBatchSave' => 'WebGUI::Operation::Subscription', - 'deleteSubscriptionCodeBatch' => 'WebGUI::Operation::Subscription', - 'listSubscriptionCodeBatches' => 'WebGUI::Operation::Subscription', - 'redeemSubscriptionCode' => 'WebGUI::Operation::Subscription', - 'listSubscriptionCodes' => 'WebGUI::Operation::Subscription', - 'deleteSubscriptionCodes' => 'WebGUI::Operation::Subscription', + 'killSession' => 'WebGUI::Operation::ActiveSessions', + 'viewActiveSessions' => 'WebGUI::Operation::ActiveSessions', - 'addToCart' => 'WebGUI::Operation::Commerce', - 'confirmRecurringTransaction' => 'WebGUI::Operation::Commerce', - 'checkout' => 'WebGUI::Operation::Commerce', - 'checkoutConfirm' => 'WebGUI::Operation::Commerce', - 'checkoutSubmit' => 'WebGUI::Operation::Commerce', - 'deleteCartItem' => 'WebGUI::Operation::Commerce', - 'editCommerceSettings' => 'WebGUI::Operation::Commerce', - 'editCommerceSettingsSave' => 'WebGUI::Operation::Commerce', - 'listTransactions' => 'WebGUI::Operation::Commerce', - 'cancelTransaction' => 'WebGUI::Operation::Commerce', - 'completePendingTransaction' => 'WebGUI::Operation::Commerce', - 'selectPaymentGateway' => 'WebGUI::Operation::Commerce', - 'selectPaymentGatewaySave' => 'WebGUI::Operation::Commerce', - 'selectShippingMethod' => 'WebGUI::Operation::Commerce', - 'selectShippingMethodSave' => 'WebGUI::Operation::Commerce', - 'updateCart' => 'WebGUI::Operation::Commerce', - 'viewCart' => 'WebGUI::Operation::Commerce', - - 'viewPurchaseHistory' => 'WebGUI::Operation::TransactionLog', - 'cancelRecurringTransaction' => 'WebGUI::Operation::TransactionLog', - 'deleteTransaction' => 'WebGUI::Operation::TransactionLog', - 'deleteTransactionItem' => 'WebGUI::Operation::TransactionLog', + 'adminConsole' => 'WebGUI::Operation::Admin', + 'switchOffAdmin' => 'WebGUI::Operation::Admin', + 'switchOnAdmin' => 'WebGUI::Operation::Admin', - 'deleteProduct' => 'WebGUI::Operation::ProductManager', - 'deleteProductParameter' => 'WebGUI::Operation::ProductManager', - 'deleteProductParameterOption' => 'WebGUI::Operation::ProductManager', - 'editProduct' => 'WebGUI::Operation::ProductManager', - 'editProductSave' => 'WebGUI::Operation::ProductManager', - 'editProductParameter' => 'WebGUI::Operation::ProductManager', - 'editProductParameterSave' => 'WebGUI::Operation::ProductManager', - 'editProductParameterOption' => 'WebGUI::Operation::ProductManager', - 'editProductParameterOptionSave' => 'WebGUI::Operation::ProductManager', - 'editProductVariant' => 'WebGUI::Operation::ProductManager', - 'editProductVariantSave' => 'WebGUI::Operation::ProductManager', - 'editSkuTemplate' => 'WebGUI::Operation::ProductManager', - 'editSkuTemplateSave' => 'WebGUI::Operation::ProductManager', - 'listProducts' => 'WebGUI::Operation::ProductManager', - 'listProductVariants' => 'WebGUI::Operation::ProductManager', - 'listProductVariantsSave' => 'WebGUI::Operation::ProductManager', - 'manageProduct' => 'WebGUI::Operation::ProductManager', - - 'manageCache' => 'WebGUI::Operation::Cache', - 'flushCache' => 'WebGUI::Operation::Cache', + 'clickAd' => 'WebGUI::Operation::AdSpace', + 'deleteAd' => 'WebGUI::Operation::AdSpace', + 'deleteAdSpace' => 'WebGUI::Operation::AdSpace', + 'editAd' => 'WebGUI::Operation::AdSpace', + 'editAdSave' => 'WebGUI::Operation::AdSpace', + 'editAdSpace' => 'WebGUI::Operation::AdSpace', + 'editAdSpaceSave' => 'WebGUI::Operation::AdSpace', + 'manageAdSpaces' => 'WebGUI::Operation::AdSpace', + + 'auth' => 'WebGUI::Operation::Auth', + + 'flushCache' => 'WebGUI::Operation::Cache', + 'manageCache' => 'WebGUI::Operation::Cache', + + 'addToCart' => 'WebGUI::Operation::Commerce', + 'cancelTransaction' => 'WebGUI::Operation::Commerce', + 'checkout' => 'WebGUI::Operation::Commerce', + 'checkoutConfirm' => 'WebGUI::Operation::Commerce', + 'checkoutSubmit' => 'WebGUI::Operation::Commerce', + 'completePendingTransaction' => 'WebGUI::Operation::Commerce', + 'confirmRecurringTransaction' => 'WebGUI::Operation::Commerce', + 'deleteCartItem' => 'WebGUI::Operation::Commerce', + 'editCommerceSettings' => 'WebGUI::Operation::Commerce', + 'editCommerceSettingsSave' => 'WebGUI::Operation::Commerce', + 'listTransactions' => 'WebGUI::Operation::Commerce', + 'selectPaymentGateway' => 'WebGUI::Operation::Commerce', + 'selectPaymentGatewaySave' => 'WebGUI::Operation::Commerce', + 'selectShippingMethod' => 'WebGUI::Operation::Commerce', + 'selectShippingMethodSave' => 'WebGUI::Operation::Commerce', + 'updateCart' => 'WebGUI::Operation::Commerce', + 'viewCart' => 'WebGUI::Operation::Commerce', + + 'editCronJob' => 'WebGUI::Operation::Cron', + 'editCronJobSave' => 'WebGUI::Operation::Cron', + 'deleteCronJob' => 'WebGUI::Operation::Cron', + 'manageCron' => 'WebGUI::Operation::Cron', + + 'copyDatabaseLink' => 'WebGUI::Operation::DatabaseLink', + 'deleteDatabaseLink' => 'WebGUI::Operation::DatabaseLink', + 'deleteDatabaseLinkConfirm' => 'WebGUI::Operation::DatabaseLink', + 'editDatabaseLink' => 'WebGUI::Operation::DatabaseLink', + 'editDatabaseLinkSave' => 'WebGUI::Operation::DatabaseLink', + 'listDatabaseLinks' => 'WebGUI::Operation::DatabaseLink', + + 'formAssetTree' => 'WebGUI::Operation::FormHelpers', + 'richEditAddFolder' => 'WebGUI::Operation::FormHelpers', + 'richEditAddFolderSave' => 'WebGUI::Operation::FormHelpers', + 'richEditAddImage' => 'WebGUI::Operation::FormHelpers', + 'richEditAddImageSave' => 'WebGUI::Operation::FormHelpers', + 'richEditImageTree' => 'WebGUI::Operation::FormHelpers', + 'richEditPageTree' => 'WebGUI::Operation::FormHelpers', + 'richEditViewThumbnail' => 'WebGUI::Operation::FormHelpers', + + 'addGroupsToGroupSave' => 'WebGUI::Operation::Group', + 'addUsersToGroupSave' => 'WebGUI::Operation::Group', + 'autoAddToGroup' => 'WebGUI::Operation::Group', + 'autoDeleteFromGroup' => 'WebGUI::Operation::Group', + 'deleteGroup' => 'WebGUI::Operation::Group', + 'deleteGroupConfirm' => 'WebGUI::Operation::Group', + 'deleteGroupGrouping' => 'WebGUI::Operation::Group', + 'deleteGrouping' => 'WebGUI::Operation::Group', + 'editGroup' => 'WebGUI::Operation::Group', + 'editGroupSave' => 'WebGUI::Operation::Group', + 'editGrouping' => 'WebGUI::Operation::Group', + 'editGroupingSave' => 'WebGUI::Operation::Group', + 'emailGroup' => 'WebGUI::Operation::Group', + 'emailGroupSend' => 'WebGUI::Operation::Group', + 'listGroups' => 'WebGUI::Operation::Group', + 'manageGroupsInGroup' => 'WebGUI::Operation::Group', + 'manageUsersInGroup' => 'WebGUI::Operation::Group', + + 'viewHelp' => 'WebGUI::Operation::Help', + 'viewHelpChapter' => 'WebGUI::Operation::Help', + 'viewHelpIndex' => 'WebGUI::Operation::Help', + 'viewHelpTOC' => 'WebGUI::Operation::Help', + + 'viewInbox' => 'WebGUI::Operation::Inbox', + 'viewInboxMessage' => 'WebGUI::Operation::Inbox', + + 'copyLDAPLink' => 'WebGUI::Operation::LDAPLink', + 'deleteLDAPLink' => 'WebGUI::Operation::LDAPLink', + 'editLDAPLink' => 'WebGUI::Operation::LDAPLink', + 'editLDAPLinkSave' => 'WebGUI::Operation::LDAPLink', + 'listLDAPLinks' => 'WebGUI::Operation::LDAPLink', + + 'viewLoginHistory' => 'WebGUI::Operation::LoginHistory', + + 'deleteProduct' => 'WebGUI::Operation::ProductManager', + 'deleteProductParameter' => 'WebGUI::Operation::ProductManager', + 'deleteProductParameterOption' => 'WebGUI::Operation::ProductManager', + 'editProduct' => 'WebGUI::Operation::ProductManager', + 'editProductParameter' => 'WebGUI::Operation::ProductManager', + 'editProductParameterSave' => 'WebGUI::Operation::ProductManager', + 'editProductParameterOption' => 'WebGUI::Operation::ProductManager', + 'editProductParameterOptionSave' => 'WebGUI::Operation::ProductManager', + 'editProductSave' => 'WebGUI::Operation::ProductManager', + 'editProductVariant' => 'WebGUI::Operation::ProductManager', + 'editProductVariantSave' => 'WebGUI::Operation::ProductManager', + 'editSkuTemplate' => 'WebGUI::Operation::ProductManager', + 'editSkuTemplateSave' => 'WebGUI::Operation::ProductManager', + 'listProducts' => 'WebGUI::Operation::ProductManager', + 'listProductVariants' => 'WebGUI::Operation::ProductManager', + 'listProductVariantsSave' => 'WebGUI::Operation::ProductManager', + 'manageProduct' => 'WebGUI::Operation::ProductManager', + + 'editProfile' => 'WebGUI::Operation::Profile', + 'editProfileSave' => 'WebGUI::Operation::Profile', + 'viewProfile' => 'WebGUI::Operation::Profile', + + 'deleteProfileCategory' => 'WebGUI::Operation::ProfileSettings', + 'deleteProfileCategoryConfirm' => 'WebGUI::Operation::ProfileSettings', + 'deleteProfileField' => 'WebGUI::Operation::ProfileSettings', + 'deleteProfileFieldConfirm' => 'WebGUI::Operation::ProfileSettings', + 'editProfileCategory' => 'WebGUI::Operation::ProfileSettings', + 'editProfileCategorySave' => 'WebGUI::Operation::ProfileSettings', + 'editProfileField' => 'WebGUI::Operation::ProfileSettings', + 'editProfileFieldSave' => 'WebGUI::Operation::ProfileSettings', + 'editProfileSettings' => 'WebGUI::Operation::ProfileSettings', + 'moveProfileCategoryDown' => 'WebGUI::Operation::ProfileSettings', + 'moveProfileCategoryUp' => 'WebGUI::Operation::ProfileSettings', + 'moveProfileFieldDown' => 'WebGUI::Operation::ProfileSettings', + 'moveProfileFieldUp' => 'WebGUI::Operation::ProfileSettings', + + 'deleteReplacement' => 'WebGUI::Operation::Replacements', + 'editReplacement' => 'WebGUI::Operation::Replacements', + 'editReplacementSave' => 'WebGUI::Operation::Replacements', + 'listReplacements' => 'WebGUI::Operation::Replacements', + + 'deleteScratch' => 'WebGUI::Operation::Scratch', + 'setScratch' => 'WebGUI::Operation::Scratch', + + 'editSettings' => 'WebGUI::Operation::Settings', + 'saveSettings' => 'WebGUI::Operation::Settings', + + 'viewStatistics' => 'WebGUI::Operation::Statistics', + + 'makePrintable' => 'WebGUI::Operation::Style', + 'setPersonalStyle' => 'WebGUI::Operation::Style', + 'unsetPersonalStyle' => 'WebGUI::Operation::Style', + + 'createSubscriptionCodeBatch' => 'WebGUI::Operation::Subscription', + 'createSubscriptionCodeBatchSave' => 'WebGUI::Operation::Subscription', + 'deleteSubscription' => 'WebGUI::Operation::Subscription', + 'deleteSubscriptionCodeBatch' => 'WebGUI::Operation::Subscription', + 'deleteSubscriptionCodes' => 'WebGUI::Operation::Subscription', + 'editSubscription' => 'WebGUI::Operation::Subscription', + 'editSubscriptionSave' => 'WebGUI::Operation::Subscription', + 'listSubscriptionCodeBatches' => 'WebGUI::Operation::Subscription', + 'listSubscriptionCodes' => 'WebGUI::Operation::Subscription', + 'listSubscriptions' => 'WebGUI::Operation::Subscription', + 'purchaseSubscription' => 'WebGUI::Operation::Subscription', + 'redeemSubscriptionCode' => 'WebGUI::Operation::Subscription', + + 'addThemeComponent' => 'WebGUI::Operation::Theme', + 'addThemeComponentSave' => 'WebGUI::Operation::Theme', + 'deleteTheme' => 'WebGUI::Operation::Theme', + 'deleteThemeConfirm' => 'WebGUI::Operation::Theme', + 'deleteThemeComponent' => 'WebGUI::Operation::Theme', + 'deleteThemeComponentConfirm' => 'WebGUI::Operation::Theme', + 'editTheme' => 'WebGUI::Operation::Theme', + 'editThemeSave' => 'WebGUI::Operation::Theme', + 'exportTheme' => 'WebGUI::Operation::Theme', + 'importTheme' => 'WebGUI::Operation::Theme', + 'importThemeSave' => 'WebGUI::Operation::Theme', + 'importThemeValidate' => 'WebGUI::Operation::Theme', + 'listThemes' => 'WebGUI::Operation::Theme', + 'viewTheme' => 'WebGUI::Operation::Theme', + + 'cancelRecurringTransaction' => 'WebGUI::Operation::TransactionLog', + 'deleteTransaction' => 'WebGUI::Operation::TransactionLog', + 'deleteTransactionItem' => 'WebGUI::Operation::TransactionLog', + 'viewPurchaseHistory' => 'WebGUI::Operation::TransactionLog', + + 'becomeUser' => 'WebGUI::Operation::User', + 'deleteUser' => 'WebGUI::Operation::User', + 'deleteUserConfirm' => 'WebGUI::Operation::User', + 'editUser' => 'WebGUI::Operation::User', + 'editUserSave' => 'WebGUI::Operation::User', + 'editUserKarma' => 'WebGUI::Operation::User', + 'editUserKarmaSave' => 'WebGUI::Operation::User', + 'listUsers' => 'WebGUI::Operation::User', + + 'approveVersionTag' => 'WebGUI::Operation::VersionTag', + 'commitVersionTag' => 'WebGUI::Operation::VersionTag', + 'commitVersionTagConfirm' => 'WebGUI::Operation::VersionTag', + 'editVersionTag' => 'WebGUI::Operation::VersionTag', + 'editVersionTagSave' => 'WebGUI::Operation::VersionTag', + 'manageCommittedVersions' => 'WebGUI::Operation::VersionTag', + 'manageRevisionsInTag' => 'WebGUI::Operation::VersionTag', + 'manageVersions' => 'WebGUI::Operation::VersionTag', + 'rollbackVersionTag' => 'WebGUI::Operation::VersionTag', + 'setWorkingVersionTag' => 'WebGUI::Operation::VersionTag', + + 'genesis' => 'WebGUI::Operation::WebGUI', + 'setup' => 'WebGUI::Operation::WebGUI', + 'theWg' => 'WebGUI::Operation::WebGUI', + + 'addWorkflow' => 'WebGUI::Operation::Workflow', + 'addWorkflowSave' => 'WebGUI::Operation::Workflow', + 'deleteWorkflow' => 'WebGUI::Operation::Workflow', + 'deleteWorkflowActivity' => 'WebGUI::Operation::Workflow', + 'demoteWorkflowActivity' => 'WebGUI::Operation::Workflow', + 'editWorkflow' => 'WebGUI::Operation::Workflow', + 'editWorkflowSave' => 'WebGUI::Operation::Workflow', + 'editWorkflowActivity' => 'WebGUI::Operation::Workflow', + 'editWorkflowActivitySave' => 'WebGUI::Operation::Workflow', + 'manageWorkflows' => 'WebGUI::Operation::Workflow', + 'promoteWorkflowActivity' => 'WebGUI::Operation::Workflow', + 'runWorkflow' => 'WebGUI::Operation::Workflow', }; } diff --git a/lib/WebGUI/Operation/FormHelpers.pm b/lib/WebGUI/Operation/FormHelpers.pm index 0a2eb2cda..a1e758040 100644 --- a/lib/WebGUI/Operation/FormHelpers.pm +++ b/lib/WebGUI/Operation/FormHelpers.pm @@ -12,7 +12,10 @@ package WebGUI::Operation::FormHelpers; use strict; use WebGUI::Asset; +use WebGUI::Asset::Wobject::Folder; +use WebGUI::Form::Group; use WebGUI::HTMLForm; +use WebGUI::Storage::Image; =head1 NAME @@ -38,8 +41,8 @@ sub www_formAssetTree { my $ancestors = $base->getLineage(["self","ancestors"],{returnObjects=>1}); foreach my $ancestor (@{$ancestors}) { push(@crumb,'form->process("classLimiter").";formId=" - .$session->form->process("formId")).'">'.$ancestor->get("menuTitle").''); - } + .$session->form->process("formId")).'">'.$ancestor->get("menuTitle").''); + } my $output = '

'.join(" > ", @crumb)."

\n"; my $children = $base->getLineage(["children"],{returnObjects=>1}); foreach my $child (@{$children}) { @@ -134,22 +137,41 @@ sub www_richEditImageTree { my $base = WebGUI::Asset->newByUrl($session) || WebGUI::Asset->getRoot($session); my @crumb; my $ancestors = $base->getLineage(["self","ancestors"],{returnObjects=>1}); + my $media; + my @output; + my $i18n = WebGUI::International->new($session, 'Operation_FormHelpers'); foreach my $ancestor (@{$ancestors}) { push(@crumb,''.$ancestor->get("menuTitle").''); + # check if we are in (a subdirectory of) Media + if ($ancestor->get('assetId') eq 'PBasset000000000000003') { + $media = $ancestor; + } } - my $output = '

'.join(" > ", @crumb)."

\n"; + if ($media) { + # if in (a subdirectory of) Media, give user the ability to create folders or upload images + push(@output, '

[ '.$i18n->get('Create new folder').' ]   [ '.$i18n->get('Upload new image').' ]

'); + } else { + $media = WebGUI::Asset->getMedia($session); + # if not in Media, provide a direct link to it + push(@output, '

[ '.$media->get('title').' ]

'); + } + push(@output, '

'.join(" > ", @crumb)."

\n"); my $children = $base->getLineage(["children"],{returnObjects=>1}); foreach my $child (@{$children}) { next unless $child->canView; if ($child->get("className") =~ /^WebGUI::Asset::File::Image/) { - $output .= '(•) '; + push(@output, '(•) '); } else { - $output .= "(•) "; + push(@output, "(•) "); } - $output .= ''.$child->get("menuTitle").''."
\n"; + push(@output, ''.$child->get("menuTitle").''."
\n"); } $session->style->useEmptyStyle("1"); - return $output; + return join('', @output); } @@ -186,8 +208,158 @@ sub www_richEditViewThumbnail { return '
'.$i18n->get('image manager').'
'; } +#------------------------------------------------------------------- + +=head2 www_richEditAddFolder ( $session ) + +Returns a form to add a folder using the rich editor. The purpose of this feature is to provide a very simple way for end-users to create a folder from within the rich editor, in stead of having to leave the rich editor and use the asset manager. A very minimal set of options is supplied, all other options should be derived from the current asset. + +=cut + +sub www_richEditAddFolder { + my $session = shift; + my $i18n = WebGUI::International->new($session, 'Operation_FormHelpers'); + my $f = WebGUI::HTMLForm->new($session); + $f->hidden( + name => 'op', + value => 'richEditAddFolderSave', + ); + $f->text( + label => $i18n->get('Folder name'), + name => 'filename', + ); + $f->submit( + value => $i18n->get('Create'), + ); + $f->button( + value => $i18n->get('Cancel'), + extras => 'onclick="history.go(-1);"', + ); + my $html = '

'.$i18n->get('Create new folder').'

'.$f->print; + return $session->style->process($html, 'PBtmpl0000000000000137'); +} +#------------------------------------------------------------------- + +=head2 www_richEditAddFolderSave ( $session ) + +Creates a directory under the current asset. The filename should be specified in the form. The Edit and View rights from the current asset are used if not specified in the form. All other properties are copied from the current asset. + +=cut + +sub www_richEditAddFolderSave { + my $session = shift; + # get base url + my $base = WebGUI::Asset->newByUrl($session) || WebGUI::Asset->getRoot($session); + # check if user can edit the current asset + return WebGUI::Privilege::insufficient() unless $base->canEdit; + + my $filename = $session->form->process('filename') || 'untitled'; + $base->addChild({ + # Asset properties + title => $filename, + menuTitle => $filename, + url => $base->getUrl.'/'.$filename, + groupIdEdit => $session->form->process('groupIdEdit') || $base->get('groupIdEdit'), + groupIdView => $session->form->process('groupIdView') || $base->get('groupIdView'), + ownerUserId => $session->user->userId, + startDate => $base->get('startDate'), + endDate => $base->get('endDate'), + encryptPage => $base->get('encryptPage'), + isHidden => 1, + newWindow => 0, + + # Asset/Wobject properties + displayTitle => 1, + cacheTimeout => $base->get('cacheTimeout'), + cacheTimeoutVisitor => $base->get('cacheTimeoutVisitor'), + styleTemplateId => $base->get('styleTemplateId'), + printableStyleTemplateId => $base->get('printableStyleTemplateId'), + + # Asset/Wobject/Folder properties + templateId => 'PBtmpl0000000000000078', + + # Other properties + #assetId => 'new', + className => 'WebGUI::Asset::Wobject::Folder', + #filename => $filename, + }); + $session->http->setRedirect($base->getUrl('op=richEditImageTree')); + return ""; +} + +#------------------------------------------------------------------- + +=head2 www_richEditAddImage ( $session ) + +Returns a form to add an image using the rich editor. The purpose of this feature is to provide a very simple way for end-users to upload new images from within the rich editor, in stead of having to leave the rich editor and use the asset manager. A very minimal set of options is supplied, all other options should be derived from the current asset. + +=cut + +sub www_richEditAddImage { + my $session = shift; + my $i18n = WebGUI::International->new($session, 'Operation_FormHelpers'); + my $f = WebGUI::HTMLForm->new($session); + $f->hidden( + name => 'op', + value => 'richEditAddImageSave', + ); + $f->file( + label => $i18n->get('File'), + name => 'filename', + size => 10, + ); + $f->submit( + value => $i18n->get('Upload'), + ); + $f->button( + value => $i18n->get('Cancel'), + extras => 'onclick="history.go(-1);"', + ); + my $html = '

'.$i18n->get('Upload new image').'

'.$f->print; + return $session->style->process($html, 'PBtmpl0000000000000137'); +} + +#------------------------------------------------------------------- + +=head2 www_richEditAddImageSave ( $session ) + +Creates an Image asset under the current asset. The filename should be specified in the form. The Edit and View rights from the current asset are used if not specified in the form. All other properties are copied from the current asset. + +=cut + +sub www_richEditAddImageSave { + my $session = shift; + # get base url + my $base = WebGUI::Asset->newByUrl($session) || WebGUI::Asset->getRoot($session); + #my $base = $session->asset; + my $url = $base->getUrl; + # check if user can edit the current asset + return WebGUI::Privilege::insufficient() unless $base->canEdit; + + my $storage = WebGUI::Storage::Image->create($session); + my $filename = $storage->addFileFromFormPost('filename'); + if ($filename) { + $base->addChild({ + assetId => 'new', + className => 'WebGUI::Asset::File::Image', + storageId => $storage->getId, + filename => $filename, + title => $filename, + menuTitle => $filename, + templateId => 'PBtmpl0000000000000088', + url => $url.'/'.$filename, + groupIdEdit => $session->form->process('groupIdEdit') || $base->get('groupIdEdit'), + groupIdView => $session->form->process('groupIdView') || $base->get('groupIdView'), + ownerUserId => $session->var->get('userId'), + isHidden => 1, + }); + $storage->generateThumbnail($filename); + } + $session->http->setRedirect($url.'?op=richEditImageTree'); + return ""; +} 1; diff --git a/lib/WebGUI/i18n/English/Operation_FormHelpers.pm b/lib/WebGUI/i18n/English/Operation_FormHelpers.pm new file mode 100644 index 000000000..9d21acef1 --- /dev/null +++ b/lib/WebGUI/i18n/English/Operation_FormHelpers.pm @@ -0,0 +1,41 @@ +package WebGUI::i18n::English::Operation_FormHelpers; + +our $I18N = { + 'Cancel' => { + message => q|Cancel|, + lastUpdate => 0, + }, + + 'Create' => { + message => q|Create|, + lastUpdate => 0, + }, + + 'Create new folder' => { + message => q|Create new folder|, + lastUpdated => 0, + }, + + 'File' => { + message => q|File|, + lastUpdate => 0, + }, + + 'Folder name' => { + message => q|Folder name|, + lastUpdate => 0, + }, + + 'Upload' => { + message => q|Upload|, + lastUpdate => 0, + }, + + 'Upload new image' => { + message => q|Upload new image|, + lastUpdate => 0, + }, + +}; + +1;