summaryrefslogtreecommitdiffstats
path: root/scripts
Commit message (Expand)AuthorAgeFilesLines
* scripts: force copy of files to erase already present and readonly filesLionel Landwerlin2010-05-021-2/+2
* fakeroot: remove all references to BR2_HOST_FAKEROOTThomas Petazzoni2010-04-091-1/+0Star
* get_linux_config.sh: sets THIS_MINOR to 0 if not valid.Julien Boibessot2010-02-171-0/+1
* Add package statistics scriptThomas Petazzoni2009-12-151-0/+200
* remove BR2_KERNEL_HURD from defconfig filesThomas Petazzoni2009-12-141-1/+0Star
* lzma: remove 'target' from lzma package namePeter Korsgaard2009-10-262-2/+2
* lzma: host targets should not be user selectablePeter Korsgaard2009-10-261-1/+0Star
* script: use qstripThomas Petazzoni2009-09-051-3/+1Star
* buildroot: fix remaining references to SDL_net instead of sdl_netPeter Korsgaard2009-08-291-1/+1
* buildroot: fix fallout after qtopia4 -> qt renamePeter Korsgaard2009-08-031-1/+1
* scripts/package wizard: clarify the steps after the wizardMarkus Heidelberg2009-05-031-9/+21
* scripts/package wizard: add support for subdirsMarkus Heidelberg2009-05-031-5/+22
* scripts/package wizard: delete trailing whitespace and empty linesMarkus Heidelberg2009-05-031-3/+1Star
* scripts/package wizard: make workable from TOPDIRMarkus Heidelberg2009-05-031-3/+4
* scripts/setlocalversion: Renamed 'git-svn' to 'git svn'Peter Korsgaard2009-03-261-1/+1
* pkgconfig: add pkgconfig package for targetPeter Korsgaard2009-03-181-1/+0Star
* setlocalversion: sync with HEAD of kernel gitPeter Korsgaard2009-02-031-5/+9
* Update buildall.sh with result of latest ARM tests + whitespace cleanupsUlf Samuelsson2009-02-021-346/+324Star
* Create a log file as well as stdout during testUlf Samuelsson2009-02-021-35/+36
* Do not build target compiler during testUlf Samuelsson2009-02-021-2/+1Star
* readline: s/BR2_READLINE/BR2_PACKAGE_READLINE/Peter Korsgaard2009-01-301-1/+1
* run test with some knowledge of ARCHUlf Samuelsson2009-01-292-0/+9
* Update verification scripts and status for ARM buildUlf Samuelsson2009-01-263-51/+147
* Fix buildall script to use testbed in scripts/testUlf Samuelsson2009-01-242-85/+178
* Add test configuration but do not include it by defaultUlf Samuelsson2009-01-241-0/+633
* package/: remove deprecated and broken raidtool2 packagePeter Korsgaard2009-01-231-1/+0Star
* Update tester scriptUlf Samuelsson2009-01-231-514/+323Star
* Add help script for testingUlf Samuelsson2009-01-231-0/+111
* Update buildall.sh scriptUlf Samuelsson2009-01-161-44/+96
* Update package buildscriptUlf Samuelsson2009-01-161-4/+32
* Update buildall.sh scriptUlf Samuelsson2009-01-131-6/+7
* Remove conditional clause which disables building some packagesUlf Samuelsson2009-01-121-6/+9
* Add some whitespace to output, aligning comments, when addedUlf Samuelsson2009-01-121-2/+2
* Add buildall script for testing many/most packages separately with build logs...Ulf Samuelsson2009-01-111-0/+460
* Bug fix for mkpkg scriptUlf Samuelsson2009-01-111-4/+4
* Add script allowing better overview of build status of single packagesUlf Samuelsson2009-01-101-0/+45
* Do not copy linux config with higher minor version than current kernelUlf Samuelsson2009-01-031-6/+25
* Apply some care, when copying the linux configuration fileUlf Samuelsson2009-01-021-9/+51
* scripts/setlocalversion: update deprecated git-<command> usageWade Berrier2008-12-231-1/+1
* new package wizard: change bash-specific constructPeter Korsgaard2008-10-221-2/+1Star
* Kconfig: remove 'default n'Peter Korsgaard2008-07-171-1/+0Star
* some enhancements to the build-ext3-img scriptJohn Voltz2008-05-011-5/+5
* Fix bad use of symbolUlf Samuelsson2008-04-061-0/+1
* setlocalversion: add git-svn supportPeter Korsgaard2008-04-011-1/+6
* buildroot: add /etc/br-version with version info to target dirPeter Korsgaard2008-03-311-0/+63
* Add some robustness to linux configurationUlf Samuelsson2008-03-291-0/+14
* fixed typo in scriptJohn Voltz2008-03-111-1/+1
* more robust development files in target handlerJohn Voltz2008-03-111-0/+20
* some buildroot helper scriptsJohn Voltz2008-03-063-0/+328
mp;id=8fc0fb48b4b1c7faa1728c59fcde269d9ab744f6'>8fc0fb48 ^
fe6ac164 ^

3262dfc8 ^
8fc0fb48 ^
fe6ac164 ^
8fc0fb48 ^
3262dfc8 ^
8fc0fb48 ^
3262dfc8 ^
8fc0fb48 ^
3262dfc8 ^
8fc0fb48 ^
b82ea6a8 ^
8fc0fb48 ^


b82ea6a8 ^
8fc0fb48 ^




dbc0d961 ^
fe6ac164 ^
8fc0fb48 ^
3262dfc8 ^
bb6432a6 ^
fe6ac164 ^





47365590 ^
fe6ac164 ^


cd55ead3 ^


5347ecd5 ^
fe6ac164 ^



5347ecd5 ^
fe6ac164 ^



5347ecd5 ^

fe6ac164 ^

3262dfc8 ^






5347ecd5 ^

fe6ac164 ^
fe6ac164 ^



dbc0d961 ^
5347ecd5 ^
fe6ac164 ^



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224









                                                         



                                                              





                                       


           
                              







                                                                                                           





                                                                                     



                                    
                                                            









                                                          
                                                                                                   
                 
                                                             







































                                                                 
                                              
                                                                 

                                                                                             





















                                                                 
                                                
                                                                                                                 
                                                                         
                                            
                                          
                        
                                                              







                                                          
                                                              

                                                                  
                                                          

                                                                                               
                                  
                                                                                                            
                         



                                                                                 

                                                                                                              
                                                                             
                                                   
                 
                                            
                                                      
                                                  
                                                       
                        
                                    
                 
                           


                                                                        
                                                                       




                                                                                                       
                                                                                                                    
                                                     
                                                             
                                          
                                                                                     





                   
                                          


                                             


                         
                                



                                                   
                                                



                                                                         

                                                           

                                                                         






                                                                                              

                                                                         
                 



                                           
                                                                                                                     
                                                         



                   
<?php

/**
 * Addconfig subpage base - makes sure
 * we have the two required methods preprocess and render
 */
abstract class AddConfig_Base
{

	/**
	 * Holds the instance for the currently executing step
	 * @var \AddConfig_Base
	 */
	private static $instance = false;
	
	/**
	 * Config being edited (if any)
	 * @var \ConfigTgz
	 */
	protected $edit = false;

	/**
	 * 
	 * @param string $step
	 */
	public static function setStep($step)
	{
		if (empty($step) || !class_exists($step) || get_parent_class($step) !== 'AddConfig_Base') {
			Message::addError('invalid-action', $step);
			Util::redirect('?do=SysConfig');
		}
		self::$instance = new $step();
		if (Request::any('edit')) {
			self::$instance->edit = ConfigTgz::get(Request::any('edit'));
			if (self::$instance->edit === false)
				Util::traceError('Invalid config id for editing');
			Util::addRedirectParam('edit', self::$instance->edit->id());
		}
	}

	protected function tmError()
	{
		Message::addError('main.taskmanager-error');
		Util::redirect('?do=SysConfig');
	}

	protected function taskError($status)
	{
		if (isset($status['data']['error'])) {
			$error = $status['data']['error'];
		} elseif (isset($status['statusCode'])) {
			$error = $status['statusCode'];
		} else {
			$error = Dictionary::translate('lang_unknwonTaskManager'); // TODO: No text
		}
		Message::addError('main.task-error', $error);
		Util::redirect('?do=SysConfig');
	}

	/**
	 * Called before any HTML rendering happens, so you can
	 * pepare stuff, validate input, and optionally redirect
	 * early if something is wrong, or you received post
	 * data etc.
	 */
	protected function preprocessInternal()
	{
		// void
	}

	/**
	 * Do page rendering.
	 */
	protected function renderInternal()
	{
		// void
	}
	
	/**
	 * Handle ajax stuff
	 */
	protected function ajaxInternal()
	{
		// void
	}
	
	public static function preprocess()
	{
		if (self::$instance === false) {
			Util::traceError('No step instance yet');
		}
		self::$instance->preprocessInternal();
	}
	
	public static function render()
	{
		if (self::$instance === false)
			Util::traceError('No step instance yet');
		if (self::$instance->edit !== false)
			Message::addInfo('replacing-config', self::$instance->edit->title());
		self::$instance->renderInternal();
	}
	
	public static function ajax()
	{
		if (self::$instance === false) {
			Util::traceError('No step instance yet');
		}
		self::$instance->ajaxInternal();
	}

}

/**
 * Start dialog for adding config. Ask for title,
 * show selection of modules.
 */
class AddConfig_Start extends AddConfig_Base
{

	protected function renderInternal()
	{
		$mods = ConfigModule::getList();
		$res = Database::simpleQuery("SELECT moduleid, title, moduletype, filepath FROM configtgz_module"
			. " ORDER BY title ASC"); // Move to ConfigModule
		if ($this->edit === false) {
			$active = array();
		} else {
			$active = $this->edit->getModuleIds();
		}
		$id = 0;
		$modGroups = array();
		foreach ($mods as &$mod) {
			$mod['groupid'] = 'g' . ++$id;
			$modGroups[$mod['group']] =& $mod;
		}
		unset($mod);
		while ($row = $res->fetch(PDO::FETCH_ASSOC)) {
			if (!isset($mods[$row['moduletype']])) {
				$mods[$row['moduletype']] = array(
					'unique' => false,
					'group' => 'Undefined moduletype in addconfig.inc.php',
					'groupid' => 'g' . ++$id,
				);
				$modGroups[$mods[$row['moduletype']]['group']] =& $mods[$row['moduletype']];
			}
			unset($group);
			$group =& $modGroups[$mods[$row['moduletype']]['group']];
			if (!isset($group['modules'])) {
				$group['modules'] = array();
			}
			if (empty($row['filepath']) || !file_exists($row['filepath'])) $row['missing'] = true;
			$row['active'] = in_array($row['moduleid'], $active);
			$group['modules'][] = $row;
		}
		if ($this->edit !== false) {
			$title = $this->edit->title();
		} elseif (Request::any('title')) {
			$title = Request::any('title');
		} else {
			$title = '';
		}
		$dummy = 0;
		foreach ($modGroups as &$mod) {
			if (!empty($mod['modules']) && $mod['unique']) {
				array_unshift($mod['modules'], array(
					'moduleid' => 'x' . (++$dummy),
					'title' => Dictionary::translate('lang_noModuleFromThisGroup'),
				));
			}
		}
		unset($mod);
		Render::addDialog(Dictionary::translate("lang_configurationCompilation"), false, 'cfg-start', array(
			'step' => 'AddConfig_Finish',
			'groups' => array_values($modGroups),
			'title' => $title,
			'edit' => ($this->edit !== false ? $this->edit->id() : false)
		));
	}

}

/**
 * Success dialog if adding config worked.
 */
class AddConfig_Finish extends AddConfig_Base
{
	/**
	 * @var ConfigTgz
	 */
	private $config = false;
	
	protected function preprocessInternal()
	{
		$modules = Request::post('module');
		$title = Request::post('title');
		if (!is_array($modules)) {
			Message::addError('missing-file');
			Util::redirect('?do=SysConfig&action=addconfig');
		}
		if (empty($title)) {
			Message::addError('missing-title');
			Util::redirect('?do=SysConfig&action=addconfig');
		}
		if ($this->edit === false) {
			$this->config = ConfigTgz::insert($title, $modules);
		} else {
			$this->edit->update($title, $modules);
			$this->config = $this->edit;
		}
		if ($this->config === false || $this->config->generate(true, 150) === false) {
			Message::addError('unsuccessful-action');
			Util::redirect('?do=SysConfig&action=addconfig');
		}
	}

	protected function renderInternal()
	{
		Render::addDialog(Dictionary::translate('lang_configurationCompilation'), false, 'cfg-finish', array(
			'configid' => $this->config->id()
		));
	}
	
}