Changeset 2428:3eff307817bf
- Timestamp:
- 10/17/13 17:41:32 (11 years ago)
- Branch:
- 2.6
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
inc/admin/lib.moduleslist.php
r2377 r2428 732 732 } 733 733 734 if ($count > 1 && !empty($actions) && $this->core->auth->isSuperAdmin()) { 735 $buttons = $this->getGlobalActions($actions); 736 737 echo 738 '<form action="'.$this->getURL().'" method="post" class="global-actions-buttons">'. 739 '<div>'. 740 $this->core->formNonce(). 741 form::hidden(array('modules'), '1'). 742 743 implode(' ', $buttons). 744 745 '</div>'. 746 '</form>'; 747 } 748 734 749 return $this; 735 750 } … … 795 810 } 796 811 812 return $submits; 813 } 814 815 /** 816 * Get global action buttons to add to modules list. 817 * 818 * @param array $actions Actions keys 819 * @return Array of actions buttons 820 */ 821 protected function getGlobalActions($actions) 822 { 823 $submits = array(); 824 825 # Use loop to keep requested order 826 foreach($actions as $action) { 827 switch($action) { 828 829 # Deactivate 830 case 'activate': if ($this->path_writable) { 831 $submits[] = 832 '<input type="submit" name="activate" value="'.__('Activate all plugins from this list').'" />'; 833 } break; 834 835 # Activate 836 case 'deactivate': if ($this->path_writable) { 837 $submits[] = 838 '<input type="submit" name="deactivate" value="'.__('Deactivate all plugins from this list').'" class="reset" />'; 839 } break; 840 841 # Update (from store) 842 case 'update': if ($this->path_writable) { 843 $submits[] = 844 '<input type="submit" name="update" value="'.__('Update all plugins from this list').'" />'; 845 } break; 846 847 # Behavior 848 case 'behavior': 849 850 # --BEHAVIOR-- adminModulesListGetGlobalActions 851 $tmp = $this->core->callBehavior('adminModulesListGetGlobalActions', $this); 852 853 if (!empty($tmp)) { 854 $submits[] = $tmp; 855 } 856 break; 857 } 858 } 797 859 798 860 return $submits; … … 813 875 } 814 876 815 # List actions877 # Actions per module 816 878 if (!empty($_POST['module'])) { 817 879 … … 893 955 http::redirect($this->getURL()); 894 956 } 895 896 957 elseif (!empty($_POST['install'])) { 897 958 … … 963 1024 $this->core->callBehavior('adminModulesListDoActions', $this, $id, 'plugin'); 964 1025 1026 } 1027 } 1028 # Global actions 1029 elseif (!empty($_POST['modules'])) { 1030 1031 if (!empty($_POST['activate'])) { 1032 1033 $modules = $this->modules->getDisabledModules(); 1034 if (empty($modules)) { 1035 throw new Exception(__('No such plugin.')); 1036 } 1037 1038 foreach($modules as $id => $module) { 1039 1040 # --BEHAVIOR-- moduleBeforeActivate 1041 $this->core->callBehavior('pluginBeforeActivate', $id); 1042 1043 $this->modules->activateModule($id); 1044 1045 # --BEHAVIOR-- moduleAfterActivate 1046 $this->core->callBehavior('pluginAfterActivate', $id); 1047 1048 } 1049 1050 dcPage::addSuccessNotice(__('Plugins have been successfully activated.')); 1051 http::redirect($this->getURL()); 1052 } 1053 1054 elseif (!empty($_POST['deactivate'])) { 1055 1056 $modules = $this->modules->getModules(); 1057 if (empty($modules)) { 1058 throw new Exception(__('No such plugin.')); 1059 } 1060 1061 $failed = false; 1062 foreach($modules as $id => $module) { 1063 $module[$id] = $id; 1064 1065 if (!$module['root_writable']) { 1066 $failed = true; 1067 continue; 1068 } 1069 1070 # --BEHAVIOR-- moduleBeforeDeactivate 1071 $this->core->callBehavior('pluginBeforeDeactivate', $module); 1072 1073 $this->modules->deactivateModule($id); 1074 1075 # --BEHAVIOR-- moduleAfterDeactivate 1076 $this->core->callBehavior('pluginAfterDeactivate', $module); 1077 } 1078 1079 if ($failed) { 1080 dcPage::addWarningNotice(__('Some plugins have not been deactivated.')); 1081 } 1082 else { 1083 dcPage::addSuccessNotice(__('Plugins have been successfully deactivated.')); 1084 } 1085 http::redirect($this->getURL()); 1086 } 1087 1088 elseif (!empty($_POST['update'])) { 1089 1090 $updated = $this->store->get(true); 1091 if (empty($updated)) { 1092 throw new Exception(__('No such plugin.')); 1093 } 1094 1095 foreach($updated as $module) { 1096 1097 if (!self::$allow_multi_install) { 1098 $dest = $module['root'].'/../'.basename($module['file']); 1099 } 1100 else { 1101 $dest = $this->getPath().'/'.basename($module['file']); 1102 if ($module['root'] != $dest) { 1103 @file_put_contents($module['root'].'/_disabled', ''); 1104 } 1105 } 1106 1107 # --BEHAVIOR-- moduleBeforeUpdate 1108 $this->core->callBehavior('pluginBeforeUpdate', $module); 1109 1110 $this->store->process($module['file'], $dest); 1111 1112 # --BEHAVIOR-- moduleAfterUpdate 1113 $this->core->callBehavior('pluginAfterUpdate', $module); 1114 } 1115 1116 dcPage::addSuccessNotice(__('Plugins have been successfully updated.')); 1117 http::redirect($this->getURL().'#plugins'); 965 1118 } 966 1119 } … … 1378 1531 '<p class="message">'.__('No themes matched your search.').'</p>'; 1379 1532 } 1533 1534 if ($count > 1 && !empty($actions) && $this->core->auth->isSuperAdmin()) { 1535 $buttons = $this->getGlobalActions($actions); 1536 1537 echo 1538 '<form action="'.$this->getURL().'" method="post" class="global-actions-buttons">'. 1539 '<div>'. 1540 $this->core->formNonce(). 1541 form::hidden(array('modules'), '1'). 1542 1543 implode(' ', $buttons). 1544 1545 '</div>'. 1546 '</form>'; 1547 } 1380 1548 } 1381 1549 … … 1398 1566 parent::getActions($id, $module, $actions) 1399 1567 ); 1568 } 1569 1570 protected function getGlobalActions($actions) 1571 { 1572 $submits = array(); 1573 1574 foreach($actions as $action) { 1575 switch($action) { 1576 1577 1578 # Update (from store) 1579 case 'update': if ($this->path_writable) { 1580 $submits[] = 1581 '<input type="submit" name="update" value="'.__('Update all themes from this list').'" />'; 1582 } break; 1583 1584 # Behavior 1585 case 'behavior': 1586 1587 # --BEHAVIOR-- adminModulesListGetGlobalActions 1588 $tmp = $this->core->callBehavior('adminModulesListGetGlobalActions', $this); 1589 1590 if (!empty($tmp)) { 1591 $submits[] = $tmp; 1592 } 1593 break; 1594 } 1595 } 1596 1597 return $submits; 1400 1598 } 1401 1599 … … 1570 1768 $this->core->callBehavior('adminModulesListDoActions', $this, $id, 'theme'); 1571 1769 1770 } 1771 } 1772 # Global actions 1773 elseif (!empty($_POST['modules'])) { 1774 1775 if (!empty($_POST['update'])) { 1776 1777 $updated = $this->store->get(true); 1778 if (empty($updated)) { 1779 throw new Exception(__('No such theme.')); 1780 } 1781 1782 foreach($updated as $module) { 1783 1784 if (!self::$allow_multi_install) { 1785 $dest = $module['root'].'/../'.basename($module['file']); 1786 } 1787 else { 1788 $dest = $this->getPath().'/'.basename($module['file']); 1789 if ($module['root'] != $dest) { 1790 @file_put_contents($module['root'].'/_disabled', ''); 1791 } 1792 } 1793 1794 # --BEHAVIOR-- moduleBeforeUpdate 1795 $this->core->callBehavior('themesBeforeUpdate', $module); 1796 1797 $this->store->process($module['file'], $dest); 1798 1799 # --BEHAVIOR-- moduleAfterUpdate 1800 $this->core->callBehavior('themesAfterUpdate', $module); 1801 } 1802 1803 dcPage::addSuccessNotice(__('Themes have been successfully updated.')); 1804 http::redirect($this->getURL().'#themes'); 1572 1805 } 1573 1806 } -
locales/en/main.po
r2417 r2428 2864 2864 msgstr "" 2865 2865 2866 msgid "Activate all plugins from this list" 2867 msgstr "" 2868 2869 msgid "Plugins have been successfully activated." 2870 msgstr "" 2871 2872 msgid "Deactivate all plugins from this list" 2873 msgstr "" 2874 2875 msgid "Plugins have been successfully deactivated." 2876 msgstr "" 2877 2878 msgid "Some plugins have not been deactivated." 2879 msgstr "" 2880 2881 msgid "Update all plugins from this list" 2882 msgstr "" 2883 2884 msgid "Plugins have been successfully updated." 2885 msgstr "" 2886 2866 2887 msgid "Zip file path:" 2867 2888 msgstr "" … … 2954 2975 2955 2976 msgid "Theme has been successfully updated." 2977 msgstr "" 2978 2979 msgid "Update all theme from this list" 2980 msgstr "" 2981 2982 msgid "Themes have been successfully updated." 2956 2983 msgstr "" 2957 2984 -
locales/fr/main.po
r2417 r2428 2877 2877 msgstr "Ce plugin a été installé." 2878 2878 2879 msgid "Activate all plugins from this list" 2880 msgstr "Activer tous les plugins de cette liste" 2881 2882 msgid "Plugins have been successfully activated." 2883 msgstr "Ces plugins ont été activés." 2884 2885 msgid "Deactivate all plugins from this list" 2886 msgstr "Désactiver tous les plugins de cette liste" 2887 2888 msgid "Plugins have been successfully deactivated." 2889 msgstr "Ces plugins ont été désactivés." 2890 2891 msgid "Some plugins have not been deactivated." 2892 msgstr "Certains plugins n'ont pas pu être désactivés." 2893 2894 msgid "Update all plugins from this list" 2895 msgstr "Mettre à jour tous les plugins de cette liste" 2896 2897 msgid "Plugins have been successfully updated." 2898 msgstr "Ces plugins ont été mis à jour." 2899 2879 2900 msgid "Zip file path:" 2880 2901 msgstr "Chemin du fichier zip :" … … 2968 2989 msgid "Theme has been successfully updated." 2969 2990 msgstr "Ce thème a été mis à jour." 2991 2992 msgid "Update all theme from this list" 2993 msgstr "Mettre à jour tous les thèmes de cette liste" 2994 2995 msgid "Themes have been successfully updated." 2996 msgstr "Ces thèmes ont été mis à jour." 2970 2997 2971 2998 msgid "Theme has been successfully installed."
Note: See TracChangeset
for help on using the changeset viewer.