mirror of
				https://git.code.sf.net/p/seeddms/code
				synced 2025-10-31 13:18:06 +00:00 
			
		
		
		
	extension are disabled in the settings
the configuration of the extension will no longer work for disabling an extension
This commit is contained in:
		
							parent
							
								
									cb9ce2a42f
								
							
						
					
					
						commit
						b3ffdd3b7d
					
				|  | @ -78,4 +78,19 @@ class SeedDMS_Controller_ExtensionMgr extends SeedDMS_Controller_Common { | |||
| 		return true; | ||||
| 	} /* }}} */ | ||||
| 
 | ||||
| 	public function toggle() { /* {{{ */ | ||||
| 		$dms = $this->params['dms']; | ||||
| 		$settings = $this->params['settings']; | ||||
| 		$extmgr = $this->params['extmgr']; | ||||
| 		$extname = $this->params['extname']; | ||||
| 
 | ||||
| 		if($settings->extensionIsDisabled($extname)) | ||||
| 			$settings->enableExtension($extname); | ||||
| 		else | ||||
| 			$settings->disableExtension($extname); | ||||
| 		$settings->save(); | ||||
| 
 | ||||
| 		return true; | ||||
| 	} /* }}} */ | ||||
| 
 | ||||
| } | ||||
|  |  | |||
|  | @ -55,7 +55,8 @@ class UI extends UI_Default { | |||
| 		/* Collect all decorators */ | ||||
| 		$decorators = array(); | ||||
| 		foreach($EXT_CONF as $extname=>$extconf) { | ||||
| 			if(!isset($extconf['disable']) || $extconf['disable'] == false) { | ||||
| 			if(!$settings->extensionIsDisabled($extname)) { | ||||
| //			if(!isset($extconf['disable']) || $extconf['disable'] == false) {
 | ||||
| 				if(isset($extconf['decorators'][$class])) { | ||||
| 					$filename = $settings->_rootDir.'ext/'.$extname.'/decorators/'.$theme."/".$extconf['decorators'][$class]['file']; | ||||
| 					if(file_exists($filename)) { | ||||
|  | @ -71,7 +72,8 @@ class UI extends UI_Default { | |||
| 		$filename = ''; | ||||
| 		$httpbasedir = ''; | ||||
| 		foreach($EXT_CONF as $extname=>$extconf) { | ||||
| 			if(!isset($extconf['disable']) || $extconf['disable'] == false) { | ||||
| 			if(!$settings->extensionIsDisabled($extname)) { | ||||
| //			if(!isset($extconf['disable']) || $extconf['disable'] == false) {
 | ||||
| 				/* Setting the 'views' element in the configuration can be used to | ||||
| 				 * replace an existing view in views/bootstrap/, e.g. class.ViewFolder.php | ||||
| 				 * without providing an out/out.ViewFolder.php. In that case $httpbasedir | ||||
|  |  | |||
|  | @ -22,15 +22,17 @@ $EXT_CONF = $extMgr->getExtensionConfiguration(); | |||
| $version = new SeedDMS_Version; | ||||
| 
 | ||||
| foreach($EXT_CONF as $extname=>$extconf) { | ||||
| 	if(!isset($extconf['disable']) || $extconf['disable'] == false) { | ||||
| 	if(!$settings->extensionIsDisabled($extname)) { | ||||
| //	if(!isset($extconf['disable']) || $extconf['disable'] == false) {
 | ||||
| 		/* check for requirements */ | ||||
| 		if(!empty($extconf['constraints']['depends']['seeddms'])) { | ||||
| 			$t = explode('-', $extconf['constraints']['depends']['seeddms'], 2); | ||||
| 			if(SeedDMS_Extension_Mgr::cmpVersion($t[0], $version->version()) > 0 || ($t[1] && SeedDMS_Extension_Mgr::cmpVersion($t[1], $version->version()) < 0)) | ||||
| 				continue; | ||||
| 				$extconf['disable'] = true; | ||||
| 		} | ||||
| 	} | ||||
| 	if(!isset($extconf['disable']) || $extconf['disable'] == false) { | ||||
| //	}
 | ||||
| //	if(!isset($extconf['disable']) || $extconf['disable'] == false) {
 | ||||
| 		if(isset($extconf['class']) && isset($extconf['class']['file']) && isset($extconf['class']['name'])) { | ||||
| 			$classfile = $settings->_rootDir."/ext/".$extname."/".$extconf['class']['file']; | ||||
| 			if(file_exists($classfile)) { | ||||
|  |  | |||
|  | @ -56,7 +56,7 @@ if ($action == "download") { | |||
| 	$controller->setParam('extmgr', $extMgr); | ||||
| 	$controller->setParam('extname', $extname); | ||||
| 	if (!$controller($_POST)) { | ||||
| 		echo json_encode(array('success'=>false, 'error'=>'Could not download extension')); | ||||
| 		echo json_encode(array('success'=>false, 'msg'=>'Could not download extension')); | ||||
| 	} | ||||
| 	add_log_line(); | ||||
| } /* }}} */ | ||||
|  | @ -125,7 +125,22 @@ elseif ($action == "getlist") { /* {{{ */ | |||
| 	} | ||||
| 	add_log_line(); | ||||
| 	header("Location:../out/out.ExtensionMgr.php?currenttab=".$currenttab); | ||||
| }	elseif ($action == "toggle") { /* {{{ */ | ||||
| 	if (!isset($_POST["extname"])) { | ||||
| 		echo json_encode(array('success'=>false, 'msg'=>'Could not toggle extension')); | ||||
| 	} | ||||
| 	$extname = trim($_POST["extname"]); | ||||
| 	if (!file_exists($settings->_rootDir.'/ext/'.$extname) ) { | ||||
| 		UI::exitError(getMLText("admin_tools"),getMLText("missing_extension")); | ||||
| 	} | ||||
| 	$controller->setParam('extmgr', $extMgr); | ||||
| 	$controller->setParam('extname', $extname); | ||||
| 	if (!$controller($_POST)) { | ||||
| 		echo json_encode(array('success'=>false, 'msg'=>'Could not toggle extension')); | ||||
| 	} else { | ||||
| 		echo json_encode(array('success'=>true, 'msg'=>'Operation succeded')); | ||||
| 	} | ||||
| 	add_log_line(); | ||||
| } /* }}} */ | ||||
| 
 | ||||
| 
 | ||||
| ?>
 | ||||
|  |  | |||
|  | @ -31,7 +31,8 @@ class SeedDMS_View_ExtensionMgr extends SeedDMS_Bootstrap_Style { | |||
| 		header('Content-Type: application/javascript'); | ||||
| ?>
 | ||||
| 		$(document).ready( function() { | ||||
| 			$('a.download').click(function(ev){ | ||||
| 			$('body').on('click', 'a.download', function(ev){ | ||||
| //			$('a.download').click(function(ev){
 | ||||
| 				var element = $(this); | ||||
| 				$('#'+element.data('extname')+'-download').submit(); | ||||
| /* | ||||
|  | @ -54,6 +55,27 @@ class SeedDMS_View_ExtensionMgr extends SeedDMS_Bootstrap_Style { | |||
| 				}); | ||||
| */ | ||||
| 			}); | ||||
| 			$('body').on('click', 'a.toggle', function(ev){ | ||||
| //			$('a.toggle').click(function(ev){
 | ||||
| 				var element = $(this); | ||||
| 				ev.preventDefault(); | ||||
| 				$.ajax({url: '../op/op.ExtensionMgr.php', | ||||
| 					type: 'POST', | ||||
| 					dataType: "json", | ||||
| 					data: {action: 'toggle', 'formtoken': '<?= createFormKey('extensionmgr') ?>', 'extname': element.data('extname')}, | ||||
| 					success: function(data) { | ||||
| 						noty({ | ||||
| 							text: data.msg, | ||||
| 							type: (data.error) ? 'error' : 'success', | ||||
| 							dismissQueue: true, | ||||
| 							layout: 'topRight', | ||||
| 							theme: 'defaultTheme', | ||||
| 							timeout: 1500, | ||||
| 						}); | ||||
| 						$('div.ajax').trigger('update'); | ||||
| 					} | ||||
| 				}); | ||||
| 			}); | ||||
| 
 | ||||
| 			$('a.import').click(function(ev){ | ||||
| 				var element = $(this); | ||||
|  | @ -80,11 +102,11 @@ class SeedDMS_View_ExtensionMgr extends SeedDMS_Bootstrap_Style { | |||
| 
 | ||||
| 		echo "<table class=\"table _table-condensed\">\n"; | ||||
| 		print "<thead>\n<tr>\n"; | ||||
| 		print "<th></th>\n";	 | ||||
| 		print "<th>".getMLText('name')."</th>\n";	 | ||||
| 		print "<th>".getMLText('version')."</th>\n";	 | ||||
| 		print "<th>".getMLText('author')."</th>\n";	 | ||||
| 		print "<th></th>\n";	 | ||||
| 		print "<th></th>\n"; | ||||
| 		print "<th>".getMLText('name')."</th>\n"; | ||||
| 		print "<th>".getMLText('version')."</th>\n"; | ||||
| 		print "<th>".getMLText('author')."</th>\n"; | ||||
| 		print "<th></th>\n"; | ||||
| 		print "</tr></thead><tbody>\n"; | ||||
| 		$list = $extmgr->getExtensionListByName($extname); | ||||
| 		foreach($list as $re) { | ||||
|  | @ -113,7 +135,7 @@ class SeedDMS_View_ExtensionMgr extends SeedDMS_Bootstrap_Style { | |||
| 			echo "</div>"; | ||||
| 			echo "</td>"; | ||||
| 			echo "</tr>"; | ||||
| 		}	 | ||||
| 		} | ||||
| 		echo "</tbody></table>\n"; | ||||
| 	} /* }}} */ | ||||
| 
 | ||||
|  | @ -132,6 +154,69 @@ class SeedDMS_View_ExtensionMgr extends SeedDMS_Bootstrap_Style { | |||
| 		} | ||||
| 	} /* }}} */ | ||||
| 
 | ||||
| 	function installedList() { /* {{{ */ | ||||
| 		$dms = $this->params['dms']; | ||||
| 		$user = $this->params['user']; | ||||
| 		$settings = $this->params['settings']; | ||||
| 		$httproot = $this->params['httproot']; | ||||
| 		$extmgr = $this->params['extmgr']; | ||||
| 		$extdir = $this->params['extdir']; | ||||
| 
 | ||||
| 		echo "<table id=\"extensionlist\" class=\"table _table-condensed\">\n"; | ||||
| 		print "<thead>\n<tr>\n"; | ||||
| 		print "<th></th>\n"; | ||||
| 		print "<th>".getMLText('name')."</th>\n"; | ||||
| 		print "<th>".getMLText('version')."</th>\n"; | ||||
| 		print "<th>".getMLText('author')."</th>\n"; | ||||
| 		print "<th></th>\n"; | ||||
| 		print "</tr></thead><tbody>\n"; | ||||
| 		$errmsgs = array(); | ||||
| 		foreach($GLOBALS['EXT_CONF'] as $extname=>$extconf) { | ||||
| 			$errmsgs = array(); | ||||
| 			if(!$settings->extensionIsDisabled($extname)) { | ||||
| //			if(!isset($extconf['disable']) || $extconf['disable'] == false) {
 | ||||
| 				$extmgr->checkExtension($extname); | ||||
| 				$errmsgs = $extmgr->getErrorMsgs(); | ||||
| 				if($errmsgs) | ||||
| 					echo "<tr class=\"error\" ref=\"".$extname."\">"; | ||||
| 				else | ||||
| 					echo "<tr class=\"success\" ref=\"".$extname."\">"; | ||||
| 			} else { | ||||
| 				echo "<tr class=\"warning\" ref=\"".$extname."\">"; | ||||
| 			} | ||||
| 			echo "<td width=\"32\">"; | ||||
| 			if($extconf['icon']) | ||||
| 				echo "<img width=\"32\" height=\"32\" src=\"".$httproot."ext/".$extname."/".$extconf['icon']."\" alt=\"".$extname."\" title=\"".$extname."\">"; | ||||
| 			echo "</td>"; | ||||
| 			echo "<td>".$extconf['title']; | ||||
| 			echo "<br /><small>".$extconf['description']."</small>"; | ||||
| 			if($errmsgs) | ||||
| 				echo "<div><img src=\"".$this->getImgPath("attention.gif")."\"> ".implode('<br /><img src="'.$this->getImgPath("attention.gif").'"> ', $errmsgs)."</div>"; | ||||
| 			echo "</td>"; | ||||
| 			echo "<td nowrap>".$extconf['version']; | ||||
| 			echo "<br /><small>".$extconf['releasedate']."</small>"; | ||||
| 			echo "</td>"; | ||||
| 			echo "<td nowrap><a href=\"mailto:".$extconf['author']['email']."\">".$extconf['author']['name']."</a><br /><small>".$extconf['author']['company']."</small></td>"; | ||||
| 			echo "<td nowrap>"; | ||||
| 			echo "<div class=\"list-action\">"; | ||||
| 			if(!empty($extconf['changelog']) && file_exists($extdir."/".$extname."/".$extconf['changelog'])) { | ||||
| 				echo "<a data-target=\"#extensionChangelog\" href=\"../out/out.ExtensionMgr.php?action=changelog&extensionname=".$extname."\" data-toggle=\"modal\" title=\"".getMLText('show_extension_changelog')."\"><i class=\"icon-reorder\"></i></a>\n"; | ||||
| 			} | ||||
| 			if($extconf['config']) | ||||
| 				echo "<a href=\"../out/out.Settings.php?currenttab=extensions#".$extname."\" title=\"".getMLText('configure_extension')."\"><i class=\"icon-cogs\"></i></a>"; | ||||
| 			echo "<form style=\"display: inline-block; margin: 0px;\" method=\"post\" action=\"../op/op.ExtensionMgr.php\" id=\"".$extname."-download\">".createHiddenFieldWithKey('extensionmgr')."<input type=\"hidden\" name=\"action\" value=\"download\" /><input type=\"hidden\" name=\"extname\" value=\"".$extname."\" /><a class=\"download\" data-extname=\"".$extname."\" title=\"".getMLText('download_extension')."\"><i class=\"icon-download\"></i></a></form>"; | ||||
| 			if(!$settings->extensionIsDisabled($extname)) { | ||||
| 				echo ' <a href="#" class="toggle" data-extname="'.$extname.'"><i class="icon-check"</i></a>'; | ||||
| 			} else { | ||||
| 				echo ' <a href="#" class="toggle" data-extname="'.$extname.'"><i class="icon-check-minus"></i></a>'; | ||||
| 			} | ||||
| 			echo "</div>"; | ||||
| 			echo "</td>"; | ||||
| 			echo "</tr>\n"; | ||||
| 		} | ||||
| 		echo "</tbody></table>\n"; | ||||
| 	} /* }}} */ | ||||
| 
 | ||||
| 	function show() { /* {{{ */ | ||||
| 		$dms = $this->params['dms']; | ||||
| 		$user = $this->params['user']; | ||||
|  | @ -142,7 +227,7 @@ class SeedDMS_View_ExtensionMgr extends SeedDMS_Bootstrap_Style { | |||
| 		$extmgr = $this->params['extmgr']; | ||||
| 		$currenttab = $this->params['currenttab']; | ||||
| 		$reposurl = $this->params['reposurl']; | ||||
| 	 | ||||
| 
 | ||||
| 		$this->htmlStartPage(getMLText("admin_tools")); | ||||
| 		$this->globalNavigation(); | ||||
| 		$this->contentStart(); | ||||
|  | @ -179,74 +264,26 @@ class SeedDMS_View_ExtensionMgr extends SeedDMS_Bootstrap_Style { | |||
| 		<div class="tab-content"> | ||||
| 			<div class="tab-pane <?php if(!$currenttab || $currenttab == 'installed') echo 'active'; ?>" id="installed"> | ||||
| 			<input id="extensionfilter" type="text"> | ||||
| 	<div class="ajax" data-view="ExtensionMgr" data-action="installedList"></div> | ||||
| <?php | ||||
| //		$this->contentContainerStart();
 | ||||
| 		echo "<table id=\"extensionlist\" class=\"table _table-condensed\">\n"; | ||||
| 		print "<thead>\n<tr>\n"; | ||||
| 		print "<th></th>\n";	 | ||||
| 		print "<th>".getMLText('name')."</th>\n";	 | ||||
| 		print "<th>".getMLText('version')."</th>\n";	 | ||||
| 		print "<th>".getMLText('author')."</th>\n";	 | ||||
| 		print "<th></th>\n";	 | ||||
| 		print "</tr></thead><tbody>\n"; | ||||
| 		$errmsgs = array(); | ||||
| 		foreach($GLOBALS['EXT_CONF'] as $extname=>$extconf) { | ||||
| 			$errmsgs = array(); | ||||
| 			if(!isset($extconf['disable']) || $extconf['disable'] == false) { | ||||
| 				$extmgr->checkExtension($extname); | ||||
| 				$errmsgs = $extmgr->getErrorMsgs(); | ||||
| 				if($errmsgs) | ||||
| 					echo "<tr class=\"error\">"; | ||||
| 				else | ||||
| 					echo "<tr class=\"success\">"; | ||||
| 			} else | ||||
| 				echo "<tr class=\"warning\">"; | ||||
| 			echo "<td width=\"32\">"; | ||||
| 			if($extconf['icon']) | ||||
| 				echo "<img width=\"32\" height=\"32\" src=\"".$httproot."ext/".$extname."/".$extconf['icon']."\" alt=\"".$extname."\" title=\"".$extname."\">"; | ||||
| 			echo "</td>"; | ||||
| 			echo "<td>".$extconf['title']; | ||||
| 			echo "<br /><small>".$extconf['description']."</small>"; | ||||
| 			if($errmsgs) | ||||
| 				echo "<div><img src=\"".$this->getImgPath("attention.gif")."\"> ".implode('<br /><img src="'.$this->getImgPath("attention.gif").'"> ', $errmsgs)."</div>"; | ||||
| 			echo "</td>"; | ||||
| 			echo "<td nowrap>".$extconf['version']; | ||||
| 			echo "<br /><small>".$extconf['releasedate']."</small>"; | ||||
| 			echo "</td>"; | ||||
| 			echo "<td nowrap><a href=\"mailto:".$extconf['author']['email']."\">".$extconf['author']['name']."</a><br /><small>".$extconf['author']['company']."</small></td>"; | ||||
| 			echo "<td nowrap>"; | ||||
| 			echo "<div class=\"list-action\">"; | ||||
| 			if(!empty($extconf['changelog']) && file_exists($extdir."/".$extname."/".$extconf['changelog'])) { | ||||
| 				echo "<a data-target=\"#extensionChangelog\" href=\"../out/out.ExtensionMgr.php?action=changelog&extensionname=".$extname."\" data-toggle=\"modal\" title=\"".getMLText('show_extension_changelog')."\"><i class=\"icon-reorder\"></i></a>\n"; | ||||
| 			} | ||||
| 			if($extconf['config']) | ||||
| 				echo "<a href=\"../out/out.Settings.php?currenttab=extensions#".$extname."\" title=\"".getMLText('configure_extension')."\"><i class=\"icon-cogs\"></i></a>"; | ||||
| 			echo "<form style=\"display: inline-block; margin: 0px;\" method=\"post\" action=\"../op/op.ExtensionMgr.php\" id=\"".$extname."-download\">".createHiddenFieldWithKey('extensionmgr')."<input type=\"hidden\" name=\"action\" value=\"download\" /><input type=\"hidden\" name=\"extname\" value=\"".$extname."\" /><a class=\"download\" data-extname=\"".$extname."\" title=\"".getMLText('download_extension')."\"><i class=\"icon-download\"></i></a></form>"; | ||||
| 			echo "</div>"; | ||||
| 			echo "</td>"; | ||||
| 			echo "</tr>\n"; | ||||
| 		} | ||||
| 		echo "</tbody></table>\n"; | ||||
| //		$this->installedList();
 | ||||
| ?>
 | ||||
| <form action="../op/op.ExtensionMgr.php" name="form1" method="post"> | ||||
|   <?php echo createHiddenFieldWithKey('extensionmgr'); ?>
 | ||||
| 	<input type="hidden" name="action" value="refresh" /> | ||||
| 	<p><button type="submit" class="btn"><i class="icon-refresh"></i> <?php printMLText("refresh");?></button></p>
 | ||||
| </form> | ||||
| <?php | ||||
| //		$this->contentContainerEnd();
 | ||||
| ?>
 | ||||
| 			</div> | ||||
| 
 | ||||
| 			<div class="tab-pane <?php if($currenttab == 'repository') echo 'active'; ?>" id="repository"> | ||||
| <?php | ||||
| 		echo "<table class=\"table _table-condensed\">\n"; | ||||
| 		print "<thead>\n<tr>\n"; | ||||
| 		print "<th></th>\n";	 | ||||
| 		print "<th>".getMLText('name')."</th>\n";	 | ||||
| 		print "<th>".getMLText('version')."</th>\n";	 | ||||
| 		print "<th>".getMLText('author')."</th>\n";	 | ||||
| 		print "<th></th>\n";	 | ||||
| 		print "<th></th>\n"; | ||||
| 		print "<th>".getMLText('name')."</th>\n"; | ||||
| 		print "<th>".getMLText('version')."</th>\n"; | ||||
| 		print "<th>".getMLText('author')."</th>\n"; | ||||
| 		print "<th></th>\n"; | ||||
| 		print "</tr></thead><tbody>\n"; | ||||
| 		$list = $extmgr->getExtensionList(); | ||||
| 		foreach($list as $re) { | ||||
|  | @ -279,7 +316,7 @@ class SeedDMS_View_ExtensionMgr extends SeedDMS_Bootstrap_Style { | |||
| 			echo "</div>"; | ||||
| 			echo "</td>"; | ||||
| 			echo "</tr>"; | ||||
| 		}	 | ||||
| 		} | ||||
| 		echo "</tbody></table>\n"; | ||||
| ?>
 | ||||
| 				<div> | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Uwe Steinmann
						Uwe Steinmann