def main(): ''' Application to manage the most used packages using apt-get. Unfinished. ''' config=Configuration() view = View(config.system.actions) form = cgi.FieldStorage() if('index' in form and form['index'].value != -1 ) : packages = getTableRecord( form['index'].value ) if packages != None : composeJS( json.dumps(packages) ) else : composeJS( json.dumps( STOP ) ) else : if ( getAptBusy( ) ): view.setContent('Package Management',\ '<script src="/css/reloadBasedOnStatus.js"></script>\ The package manager is busy right now. . . \ This page will automatically reload once the service is available') output(view, form) else : htmlcode = "\n<div id='packages-table'><table id='packages-table-id'>" htmlcode += "\n</table></div>" view.setContent('Package Management',\ '<script src="/css/lazyLoading.js"></script>' + htmlcode ) output(view, form)
def _generateMissingDependenciesView(self): if ( getAptBusy( ) ): html = "<div>It seems that the dependencies of this package are not installed but the OS package manager is busy now. Try again in a moment...</div>" else: html = "<div>The dependencies of this module are missing. Do you want to install them?</div><br/><button onclick=\"getDependenciesFor('" +\ self.extensionID + "')\">Resolve dependencies</button>" return html
def main(): form = cgi.FieldStorage() if ('index' in form and form['index'].value != -1): packages = getTableRecord(form['index'].value) if packages != None: composeJS(json.dumps(packages)) else: composeJS(json.dumps(STOP)) elif ('op' in form and form['op'].value == 'status'): composeJS(json.dumps({'status': not getAptBusy()})) else: composeJS(json.dumps({}))
def main(): form = cgi.FieldStorage() if('index' in form and form['index'].value != -1 ) : packages = getTableRecord( form['index'].value ) if packages != None : composeJS( json.dumps( packages ) ) else : composeJS( json.dumps( STOP ) ) elif ('op' in form and form['op'].value == 'status'): composeJS(json.dumps({'status':not getAptBusy()})) else: composeJS(json.dumps({}))
def main(): ''' Application to manage the most used packages using apt-get. Still in progress. ''' form = cgi.FieldStorage() if('index' in form and form['index'].value != -1 ) : packages = getTableRecord( form['index'].value ) if packages != None : composeJS( json.dumps( packages ) ) else : composeJS( json.dumps( STOP ) ) else : if ( 'action' in form and form['action'].value == 'getPackageList' ) : #ajax call response composeJS( json.dumps( getPackageList( ) ) ) elif ( getAptBusy( ) ): view.setContent('Package Management',\ '<script src="/css/reloadBasedOnStatus.js"></script>\ The package manager is busy right now. . . \ This page will automatically reload once the service is available') output(view, form) else : #lazyloading will populate the table htmlcode = '<script src="/css/lazyLoading.js"></script>\ \n<script src="/css/autocomplete.js"></script>' #enable search feature htmlcode += '\n<div class="form-group" style="margin-bottom: 0px;overflow: hidden;">\ \n<input id="autocomplete" name="filter" \ onkeyup="filter( \'autocomplete\',\'packages-table-id\',1 )" type="text" \ class="form-control" style="float:left;width:20%;" placeholder="Search. . .">\ \n\ <div style="padding-top: 10px;">\ <button id="extensive_search" style="float: right;" class="btn btn-primary" onclick="extensive_search();">\ Search package</button>\ </div>\ </div>' htmlcode += "\n<div id='packages-table'><table id='packages-table-id'>" htmlcode += "\n</table></div>" view.setContent('Package Management', htmlcode ) output(view, form)
def main(): ''' Application to manage the most used packages using apt-get. Still in progress. ''' form = cgi.FieldStorage() if ('index' in form and form['index'].value != -1): packages = getTableRecord(form['index'].value) if packages != None: composeJS(json.dumps(packages)) else: composeJS(json.dumps(STOP)) else: if ('action' in form and form['action'].value == 'getPackageList'): #ajax call response composeJS(json.dumps(getPackageList())) elif (getAptBusy()): view.setContent('Package Management',\ '<script src="/css/reloadBasedOnStatus.js"></script>\ The package manager is busy right now. . . \ This page will automatically reload once the service is available' ) output(view, form) else: #lazyloading will populate the table htmlcode = '<script src="/css/lazyLoading.js"></script>\ \n<link rel="stylesheet" href="/css/jquery-ui.css">\ \n<script src="/css/jquery-ui.js"></script>\ \n<script src="/css/autocomplete.js"></script>' #enable search feature htmlcode += '\n<div class="form-group" style="margin-bottom: 0px;overflow: hidden;">\ \n<input id="autocomplete" name="filter" \ onkeyup="filter( \'autocomplete\',\'packages-table-id\',1 )" type="text" \ class="form-control" style="float:left;width:20%;" placeholder="Search. . .">\ \n</div>' htmlcode += "\n<div id='packages-table'><table id='packages-table-id'>" htmlcode += "\n</table></div>" view.setContent('Package Management', htmlcode) output(view, form)
def main(): ''' Application to manage all the most used packages using apt-get. Unfinished. ''' config=Configuration() view = View(config.system.actions) form = cgi.FieldStorage() if (getAptBusy( )): view.setContent('Package Management',\ '<script src="/css/reloadBasedOnStatus.js"></script>\ The package manager is busy right now. . . \ This page will automatically reload once the service is available') output(view, form) return htmlcode = '' ins = open( PACKAGES_LIST_PATH, "r" ) packages = [] for line in ins: line = line.rstrip() # strip the new line packages.append( line ) allPackages = [[]] for pName in packages : checkedText = createOnOffSwitch( pName ) descriptionText = getDpkgInfo( pName, "Description" ) versionText = getDpkgInfo( pName, "Version" ) allPackages.append( [ pName, checkedText, descriptionText, versionText ] ) htmlcode += "\n<div id='packages-table'>" htmlcode += HTML.table( allPackages, header_row=['Package Name', 'Status', 'Description', 'Version'] ) htmlcode += "\n</div>" view.setContent('Package Management', htmlcode ) output(view, form)