JavaScript - Admin Interface?
Would I use php or javascript to make an admin interface so someone can update the web page i made for them easilier?
As of now, they need to change the html page and upload an image using filezilla. Are there any Admin interfaces that allow you to customize what you want to change/add to an html page? Similar TutorialsHi This is what I would like to do: 1. Create a tabbed interface 2. All tabs but one must be able to be closed by clicking a link 3. User must be able to add additional tabs I want this to be done in Javascript but I have no clue how to program in javascipt and tutorials I have seen do not go in to great detail since they just show you basics that a Kindergarten kid could use. Please help Thanks public classTestGeometricObject{ /** Main Method */ public static void main(String[] args) { //Declare and initialize two geometric objects GeometricObject geoObject1 = new Circle(5); GeometricObject geoObject2 = new Rectangles(5,3); System.out.println("The two objects have the same area? " + equalArea(geoObject1, geoObject2)); //Display circle displayGeometricObject(geoObject1); //Display rectangle displayGeometricObject(geoObject2); } /**A method for comparing */ public static boolean equalArea(GeometricObject object1, GeometricObject object2) { return object1.getArea()==object2.getArea(); } /**A method for displaying a geometric object*/ public static void displayGeometricObject(GeometricObject object){ System.out.println(); System.out.println("The area is " + object.getArea()); System.out.println("The perimeter is " + object.geetPerimeter()); } } public classTestGeometricObject{ /** Main Method */ public static void main(String[] args) { //Declare and initialize two geometric objects GeometricObject geoObject1 = new Circle(5); GeometricObject geoObject2 = new Rectangles(5,3); System.out.println("The two objects have the same area? " + equalArea(geoObject1, geoObject2)); //Display circle displayGeometricObject(geoObject1); //Display rectangle displayGeometricObject(geoObject2); } /**A method for comparing */ public static boolean equalArea(GeometricObject object1, GeometricObject object2) { return object1.getArea()==object2.getArea(); } /**A method for displaying a geometric object*/ public static void displayGeometricObject(GeometricObject object){ System.out.println(); System.out.println("The area is " + object.getArea()); System.out.println("The perimeter is " + object.getPerimeter()); } } Hi there, we have quite a big and successful project going on. We're a bunch of hardcore hockey gaming people and we're editing a game that has its entire interface written in Javascript. The whole game has been completely rebuilt... graphics, sounds, etc. Also all menus have been changed and reconstructed and we have managed to add some really unique features (previously unseen in sports games). I have some really wild ideas for the interface but we're at a dead end because we don't really have anyone who has advanced JS skills. See our project here. You can see the completely rebuilt menu features in the thumbnails. If this forum has someone who's interested in hockey simulator & gaming and has JS skills and would like to develop this brilliant game with us, I would like to get in touch with him. I can send him the full (unmodified base game) any time. The modifications have to be installed from the thread I linked. Thanks in advance. Best regards Trent Hi there, I'm trying really hard to find the solution to this error I am getting in java. Im using blue j. I have a feeling its something other than just braces missing somewhere, I have looked carefully and I'm just having bad luck!! I cant proceed to the next stage of my code unless I get this bit perfected with no syntax errors. I really really appreciate someone helping me out. Code: import java.util.Scanner; import java.awt.Color; /** * Write a description of class stage2 here. * * @author (Gayethiri Guruthevan) * @version (Version 1.0) */ public class stage2 { public static void main(String[]args) { final int WIDTH = 500; // width of the sheet in pixels final int HEIGHT = 500; // height of the sheet in pixels int x; // the x-coordinate int y; // the y-coordinate String direction; // the direction chosen // Create a Scanner object for keyboard input. Scanner keyboard = new Scanner(System.in); // 1. Ask the user for the ant's x-coordinate System.out.print("Enter your ant's x-coordinate: "); x = keyboard.nextInt(); // 2. If the x-coordinate is outside the allowed range, // print an error message and exit if(x < 0 || x > WIDTH-1) { System.out.println("The x-coordinate must be between 0 and " + (WIDTH-1)); System.exit(-1); } // 3. Ask the user for the ant's y-coordinate System.out.print("Enter your ant's y-coordinate: "); y = keyboard.nextInt(); // 4. If the integer is outside the allowed range, // print an error message and exit if(y < 0 || y > HEIGHT-1) { System.out.println("The Y-coordinate must be between 0 and " + (HEIGHT-1)); System.exit(-1); } // 5. Ask the user for the direction System.out.print("Enter the direction the ant is facing: "); direction = keyboard.next(); System.out.print("How many steps should the ant take?: "); int numStepsToTake = keyboard.nextInt(); for(int i=0; i<numStepsToTake;i++) { if (direction.equalsIgnoreCase("DL")) { y+=1; x-=1; } else if (direction.equalsIgnoreCase("DR")) { y-=1; x+=1; } else if (direction.equalsIgnoreCase("D")) { y-=1; } if (direction.equalsIgnoreCase("U")) { x+=1; } else if (direction.equalsIgnoreCase("UR")) { y+=1; x+=1; } else if (direction.equalsIgnoreCase("UL")) { y+=1; x-=1; } else if (direction.equalsIgnoreCase("L")) { x-=1; } else if(direction.equalsIgnoreCase("R")) { x+=1; } else { System.out.println("That is incorrect please enter the right direction"); } // "Wrap" the x and y-coordinates if the ant has walked over the edge of the paper if(x < 0) { x += WIDTH; } else if(x > WIDTH-1) { x-=WIDTH; } if(y < 0) { y += HEIGHT; } else if(y > HEIGHT-1) { y-=HEIGHT; } //Here is the new method for antart. AntArt.init(WIDTH,HEIGHT,x,y); for(int i=0; i<numStepsToTake;i++) { int oldX = x; int oldY = y; Color paperColor = AntArt.getColor(x,y); antColor = nextColor(antColor,paperColor); AntArt.setColor(antColor); // Take a step direction = nextDirection(direction,antColor,paperColor); x = stepX(x,direction,WIDTH,HEIGHT); y = stepY(y,direction,WIDTH,HEIGHT); AntArt.paint(oldX,oldY); } AntArt.paint(x,y); System.out.println("The new x is " + x + " and y coordinate is " + y); } } } private static int stepx(int x, String direction, int WIDTH, int HEIGHT) { //this will be the answer int newx = x; // take a step in the right direction if(direction.equals("UR")) { newx += 1; } else if (direction.equals("R")) { newx += 1; } else if(direction.equals("DR")) { newx += 1; } else if(direction.equals("DL")) { newx -= 1; } else if(direction.equals("L")) { newx -= 1; } else if(direction.equals("UL")) { newx -= 1; } // "Wrap" the x and y-coordinates if the ant has walked over the edge of the paper if(newx < 0) { newx += WIDTH; } else if(newx > WIDTH-1) { newx -= WIDTH; } return newx; } } } private static int stepY(int y, String direction, int WIDTH, int HEIGHT) { // this will be the answer int newy = y; // take a step in the right direction if(direction.equals("UR")) { newy += 1; } else if (direction.equals("R")) { newy += 1; } else if(direction.equals("DR")) { newy += 1; } else if(direction.equals("DL")) { newy -= 1; } else if(direction.equals("L")) { newy -= 1; } else if(direction.equals("UL")) { newy -= 1; } // "Wrap" the x and y-coordinates if the ant has walked over the edge of the paper if(newy < 0) { newy += HEIGHT; } else if(newy > HEIGHT-1) { newy -= HEIGHT; } return newy; } } Hello, this is my first post. The following code works in FF, Is there any way to have the code work correctly in IE 7? The error is on both the following lines, odoc.appendChild(ne);. Thank you for any assistance. Quote: <!--#include file="include/dbcommon.asp"--> <% set dbConnection = server.CreateObject ("ADODB.Connection") dbConnection.ConnectionString = strConnection dbConnection.Open %> <html> <head> <link REL="stylesheet" href="include/style.css" type="text/css"> <!--[if IE]> <link REL="stylesheet" href="include/styleIE.css" type="text/css"> <![endif]--> </head> <body> <table> <tr><td> Subject:</td> <td><input id=subject type=text size=40></td> <td align=right> Templates: <select id=templates style="width:300" onchange="doInsert(document.getElementById('templates').value);document.getElementById('templates'). selectedIndex=0;"> <option value="">Please select</option> <% Set rs = server.CreateObject ("ADODB.Recordset") rs.Open "select * from QuickTemplates", dbConnection,1,2 while not rs.eof fname=replace(rs("fname"),"""",""") if(len(rs("fname"))>40) then _ fname=replace(left(rs("fname"),30)&"...","""",""") response.write "<option value=""" & replace(rs("fname"),"""",""") & """>" & fname & "</option>" rs.movenext wend rs.close %> </select> </td></tr> <tr> <td valign=top>Body:</td><td colspan=2><textarea id=body cols=100 rows=20></textarea></td> </tr> <td align=center colspan=3> <SPAN class=buttonborder><input class=button type=button value="Send email" onclick="sendem();"></SPAN> <SPAN class=buttonborder><input class=button type=button value="Close" onclick="self.close();return false;"></SPAN> </td> </tr> </table> </body> <html> <script> function sendem() { odoc=opener.document.getElementById("frmAdmin"); opener.document.forms.frmAdmin.a.value="email"; ne=document.createElement("input"); ne.name="subject"; ne.type="hidden"; ne.value=document.getElementById("subject").value; odoc.appendChild(ne); ne=document.createElement("input"); ne.name="body"; ne.type="hidden"; ne.value=document.getElementById("body").value; odoc.appendChild(ne); opener.document.forms.frmAdmin.submit(); self.close(); } function doInsert(ibTag) { var uagent = navigator.userAgent.toLowerCase(); var is_safari = ( (uagent.indexOf('safari') != -1) || (navigator.vendor == "Apple Computer, Inc.") ); var is_opera = (uagent.indexOf('opera') != -1); var is_webtv = (uagent.indexOf('webtv') != -1); var ua_vers = parseInt(navigator.appVersion); var is_win = ( (uagent.indexOf("win") != -1) || (uagent.indexOf("16bit") !=- 1) ); var is_ie = ( (uagent.indexOf('msie') != -1) && (!is_opera) && (!is_safari) && (!is_webtv) ); if(ibTag!="") { var isClose = false; var obj_ta = document.getElementById("body"); obj_ta.focus(); if ( (ua_vers >= 4) && is_ie && is_win ) { var rng = document.selection.createRange(); rng.colapse; rng.text = ibTag; } else if ( obj_ta.selectionEnd>=0 ) { var ss = obj_ta.selectionStart; var st = obj_ta.scrollTop; var es = obj_ta.selectionEnd; if (es < 0) { es = obj_ta.textLength; } var start = (obj_ta.value).substring(0, ss); var end = (obj_ta.value).substring(es, obj_ta.textLength); obj_ta.value = start + ibTag + end; var p=0; var ent=0; while(p!=-1) { p=ibTag.indexOf('\n',p); if(p!=-1) { p++; ent++; } } var cpos = ss + (ibTag.length)-ent; obj_ta.selectionStart = cpos; obj_ta.selectionEnd = cpos; obj_ta.scrollTop = st; } obj_ta.focus(); return isClose; } } </script> Hi, Two JS questions: 1. Is there a way to check (using JS only) if the user have local admin privileges on the local machine? 2. Is there a way to check (using JS only) if office 2007 or office 2007 compatibility pack is installed on the local machine? Thanks, Yotam OMYG this error has kicked me dead: An error occurred in script '/var/www/html/admin/tabs.php' on line 54: Use of undefined constant title - assumed 'title' function tab( $title ) { global $tabs; $text=""; if ( count( $tabs ) > 0 ) endtab(); $tabs []= array( title => title, text => '' ); } Code: <?php $tabs = array(); function tabs_header() { ?> <style type="text/css"> .tab { border-bottom: 1px solid black; text-align: center; font-family: arial, verdana; } .tab-active { border-left: 1px solid black; border-top: 1px solid black; border-right: 1px solid black; text-align: center; font-family: arial, verdana; font-weight: bold; } .tab-content { padding: 5px; border-left: 1px solid black; border-right: 1px solid black; border-bottom: 1px solid black; } </style> <?php } function tabs_start() { ob_start(); } function endtab() { global $tabs; $text = ob_get_clean(); $tabs[ count( $tabs ) - 1 ][ 'text' ] = $text; ob_start(); } function tab( $title ) { global $tabs; if ( count( $tabs ) > 0 ) endtab(); $tabs []= array( title => $title, text => "" ); } function tabs_end( ) { global $tabs; endtab( ); ob_end_clean( ); $index = 0; if ( $_GET['tabindex'] ) $index = $_GET['tabindex']; ?> <table width="100%" cellspacing="0" cellpadding="0"> <tr> <?php $baseuri = $_SERVER['REQUEST_URI']; $baseuri = preg_replace( "/\?.*$/", "", $baseuri ); $curindex = 0; foreach( $tabs as $tab ) { $class = "tab"; if ( $index == $curindex ) $class ="tab-active"; ?> <td class="<?php echo($class); ?>"> <a href="<?php echo( $baseuri."?tabindex=".$curindex ); ?>"> <?php echo( $tab['title'] ); ?> </a> </td> <?php $curindex += 1; } ?> </tr> <tr><td class="tab-content" colspan="<?php echo( count( $tabs ) + 1 ); ?>"> <?php echo( $tabs[$index ]['text'] ); ?> </td></tr> </table> <?php } ?> I have an user table like this:- guid | username | password | firstname | lastname | location | emailad dress | userrole -----------------------------------+----------+----------------------------------+-----------+-----------+----------+-------- ------+--------------- 8024259764dc3e8ee0fb6f5.84107784 | james | 827ccb0eea8a706c4c34a16891f84e7b | james | bond | NY | ny@live .com | administrator 18689183644dc3e91571a364.71859328 | saty | 250cf8b51c773f3f8dc8b4be867a9a02 | saty | john | NY | hk@fd.c om | administrator 2644885344cecd6f2973b35.63257615 | admin | 21232f297a57a5a743894a0e4a801fc3 | System | Generated | | | administrator (3 rows) now my postgre query for delete the row .... $query = "delete from users where username!= 'admin' and guid='".$guid."'"; $result = pg_query($conn, $query); ?> <script type="text/javascript"> alert("Cannot delete this .\n It is system generated(s)."); </script> <?php (1)when I delete the user name one by one then delete occurs in my page userlist.php, I donot want to delete admin so i use username!= 'admin' in where condition as shown above. (2)now when I del any username(3 rows) from user table then alert occurs & it delete from userlist.php after that my page userlist.php is blank. Finaly when i refresh the page then my admin username seen.. when i use return true; function then only alert generate .. delete doesnot occurs ... Actauly i want:- (1)if user is not admin then it delete from userlist.php ... nd also i m continue on this page ... like when james and saty want to delte their acount ..as given in table. (2)if user is admin then alert generate nd i m continue on this page. i m tired now plz help me .... so can anyone put the best condition in my coding. |