Changeset 2182:eaaf345b04f3 for inc
- Timestamp:
- 10/01/13 09:44:02 (12 years ago)
- Branch:
- dcRepo
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
inc/admin/lib.moduleslist.php
r2179 r2182 10 10 11 11 protected $list_id = 'unknow'; 12 13 protected $config_module = ''; 14 protected $config_file = ''; 15 protected $config_content = ''; 12 16 13 17 protected $path = false; … … 473 477 } 474 478 479 # Select (from repository) 480 if (in_array('choose', $actions) && $this->path_writable) { 481 $submits[] = '<input type="submit" name="choose" value="'.__('Choose').'" />'; 482 } 483 475 484 # Parse form 476 485 if (!empty($submits)) { … … 702 711 } 703 712 713 /** 714 * 715 * We need to get configuration content in three steps 716 * and out of this class to keep backward compatibility. 717 * 718 * if ($xxx->setConfigurationFile()) { 719 * include $xxx->getConfigurationFile(); 720 * } 721 * $xxx->setConfigurationContent(); 722 * ... [put here page headers and other stuff] 723 * $xxx->getConfigurationContent(); 724 * 725 */ 726 public function setConfigurationFile(dcModules $modules, $id=null) 727 { 728 if (empty($_REQUEST['conf']) || empty($_REQUEST['module']) && !$id) { 729 return false; 730 } 731 732 if (!empty($_REQUEST['module']) && empty($id)) { 733 $id = $_REQUEST['module']; 734 } 735 736 if (!$modules->moduleExists($id)) { 737 $core->error->add(__('Unknow module ID')); 738 return false; 739 } 740 741 $module = $modules->getModules($id); 742 $module = self::parseModuleInfo($id, $module); 743 $file = path::real($module['root'].'/_config.php'); 744 745 if (!file_exists($file)) { 746 $core->error->add(__('This module has no configuration file.')); 747 return false; 748 } 749 750 $this->config_module = $module; 751 $this->config_file = $file; 752 $this->config_content = ''; 753 754 if (!defined('DC_CONTEXT_MODULE')) { 755 define('DC_CONTEXT_MODULE', true); 756 } 757 758 return true; 759 } 760 761 public function getConfigurationFile() 762 { 763 if (!$this->config_file) { 764 return null; 765 } 766 767 ob_start(); 768 769 return $this->config_file; 770 } 771 772 public function setConfigurationContent() 773 { 774 if ($this->config_file) { 775 $this->config_content = ob_get_contents(); 776 } 777 778 ob_end_clean(); 779 780 return !empty($this->file_content); 781 } 782 783 public function getConfigurationContent() 784 { 785 if (!$this->config_file) { 786 return null; 787 } 788 789 if (!$this->config_module['standalone_config']) { 790 echo 791 '<form id="module_config" action="'.$this->getPageURL('conf=1').'" method="post" enctype="multipart/form-data">'. 792 '<h3>'.sprintf(__('Configure plugin "%s"'), html::escapeHTML($this->config_module['name'])).'</h3>'. 793 '<p><a class="back" href="'.$this->getPageURL().'#plugins">'.__('Back').'</a></p>'; 794 } 795 796 echo $this->config_content; 797 798 if (!$this->config_module['standalone_config']) { 799 echo 800 '<p class="clear"><input type="submit" name="save" value="'.__('Save').'" />'. 801 form::hidden('module', $this->config_module['id']). 802 $this->core->formNonce().'</p>'. 803 '</form>'; 804 } 805 806 return true; 807 } 808 704 809 public static function sanitizeString($str) 705 810 { … … 828 933 if ($current && $has_conf) { 829 934 $line .= 830 '<a href="'.$this->getPageURL(' conf=1').'" class="button">'.__('Configure theme').'</a> ';935 '<a href="'.$this->getPageURL('module='.$id.'&conf=1', false).'" class="button">'.__('Configure theme').'</a> '; 831 936 } 832 937 $line .=
Note: See TracChangeset
for help on using the changeset viewer.