code
stringlengths
1
2.01M
repo_name
stringlengths
3
62
path
stringlengths
1
267
language
stringclasses
231 values
license
stringclasses
13 values
size
int64
1
2.01M
using UnityEngine; using System; using System.Collections; //[RequireComponent (typeof (Navigator)) public class Robot : MonoBehaviour { Job currentJob; public bool hasAJob; public double pressureInTank; bool addedStatustoList; bool atJobSite; double x, y, z; int jobX, jobY, jobZ; private ArrayList path; private int pathIndex; Point nextPoint; NavMeshAgent agent; double rateOfMovement; public Tank tank; Torso torso; Legs legs; Arms arms; Head head; public bool hasMiningTool, hasConstructionTool, hasDeconstructionTool; public double rateOfConstruction, rateOfDeconstruction, rateOfMining; public ArrayList tools; public MiningTool miningTool; public ConstructionTool constructionTool; public DeconstructionTool deconstructionTool; public Item hauledItem; public bool hauling; // Use this for initialization void Start () { hasAJob = false; currentJob = null; pressureInTank = 100000; nextPoint = new Point(0,0,0); hasMiningTool = false; hasConstructionTool = false; hasDeconstructionTool = false; rateOfConstruction = 1; rateOfMining = 1; rateOfDeconstruction = 1; tools = new ArrayList(); x = (double)transform.position.x; y = (double)transform.position.y; z = (double)transform.position.z; hauling = false; agent = (NavMeshAgent)GetComponent("NavMeshAgent"); } // Update is called once per frame void Update(){ if (!hasAJob){ if (pressureInTank < 500){ addedStatustoList = true; //refill with steam Job j = new RechargingJob((BoilerManager)ConstructionController.boilers[0]); Controller.removeJob(j); this.assignJob(j); } if (!hasConstructionTool | !hasDeconstructionTool | !hasMiningTool){ if (!hasConstructionTool){ foreach (Tool t in Controller.getUnusedTools()){ if ((t.isConstructionTool) & (!addedStatustoList)){ addedStatustoList = true; currentJob = new EquipJob(t, t.x, t.y, t.z); t.updatePosition(); } } } if (!hasDeconstructionTool){ foreach (Tool t in Controller.getUnusedTools()){ if ((t.isDeconstructionTool) & (!addedStatustoList)){ addedStatustoList = true; currentJob = new EquipJob(t, t.x, t.y, t.z); t.updatePosition(); } } } if (!hasMiningTool){ foreach (Tool t in Controller.getUnusedTools()){ if ((t.isMiningTool) & (!addedStatustoList)){ addedStatustoList = true; assignJob(new EquipJob(t, t.x, t.y, t.z)); t.updatePosition(); } } } } if (!addedStatustoList){ addedStatustoList = true; Controller.addRobot(this); } } } void FixedUpdate () { //Deal with rendering of tools if (hasMiningTool){ miningTool.item.transform.position = new Vector3((float)x - 1, (float)y, (float)z); miningTool.updatePosition(); } if (atJobSite & hasAJob){ bool done = false; if (currentJob.jobType == 1){ done = ((BuildingOperationJob)(currentJob)).workOn(1, this); } else if (currentJob.jobType == 2){ done = ((ConstructionJob)(currentJob)).workOn(1, this); if (hasDeconstructionTool){ ParticleEmitter p = (ParticleEmitter)(constructionTool.item.GetComponent("ParticleEmitter")); p.emit = true; } } else if (currentJob.jobType == 3){ done = ((DeconstructionJob)(currentJob)).workOn(1, this); if (hasDeconstructionTool){ } } else if (currentJob.jobType == 4) { done = ((EquipJob)(currentJob)).workOn(this); done = true; } else if (currentJob.jobType == 5){ done = ((HaulingJob)(currentJob)).workOn(this); } else if (currentJob.jobType == 6){ done = ((MiningJob)(currentJob)).workOn(1, this); if (hasMiningTool){ ParticleEmitter p = (ParticleEmitter)(miningTool.item.GetComponent("ParticleEmitter")); p.emit = true; } } else if (currentJob.jobType == 7){ done = ((RechargingJob)(currentJob)).workOn(this); } else if (currentJob.jobType == 8){ done = ((SmeltOre)(currentJob)).workOn(1, this); } else if (currentJob.jobType == 9){ done = ((PlacingJob)(currentJob)).workOn(this); } else if (currentJob.jobType == 10){ done = ((SmeltBronze)(currentJob)).workOn(1, this); } else if (currentJob.jobType == 11){ done = ((SmeltBrass)(currentJob)).workOn(1, this); } else if (currentJob.jobType == 12){ done = ((SmeltGalvanizedSteel)(currentJob)).workOn(1, this); } else if (currentJob.jobType == 13){ done = ((SmeltSteel)(currentJob)).workOn(1, this); } else if (currentJob.jobType == 14){ done = ((ForgeRobotComponents)(currentJob)).workOn(1, this); } else if (currentJob.jobType == 15){ done = ((AssembleRobot)(currentJob)).workOn(1, this); } else { done = true; print ("Snork"); } if (done){ Controller.finishedJob(this, currentJob); currentJob = null; hasAJob = false; addedStatustoList = false; } } if (hasAJob & !atJobSite){ rateOfMovement = 0; foreach (Tool t in tools){ rateOfMovement += (float)(t.material.weightModifier); } rateOfMovement = (0.05 / (rateOfMovement + 1)); agent.speed = (float)rateOfMovement; try { nextPoint = (Point)(path[pathIndex]); } catch { Debug.LogError("Cannot find path"); Controller.finishedJob(this, currentJob); } bool goodToMoveOn = true; pathTo(nextPoint.x, nextPoint.y, nextPoint.z, rateOfMovement); if((int)(x) != nextPoint.x){ goodToMoveOn = false; } else if((int)(y) != nextPoint.y){ goodToMoveOn = false; } else if((int)(z)!= nextPoint.z){ goodToMoveOn = false; } if (goodToMoveOn){ pathIndex += 1; } if ((((int)x == jobX) & ((int)y == jobY) & ((int)z == jobZ)) | (pathIndex == path.Count)){ x = (int) x; y = (int) y; z = (int) z; atJobSite = true; pathIndex = 0; } } if (hauling){ hauledItem.setPosition(new Vector3(transform.position.x, transform.position.y + 1f, transform.position.z + 1f)); } } public void starterate(Arms narms, Legs nlegs, Head nhead, Torso ntorso, Tank ntank){ arms = narms; legs = nlegs; head = nhead; torso = ntorso; tank = ntank; } public void addConstructionTool(ConstructionTool tool){ hasConstructionTool = true; rateOfConstruction = tool.speedWithTool; tools.Add(tool); constructionTool = tool; } public void addDeconstructionTool(DeconstructionTool tool){ hasDeconstructionTool = true; rateOfDeconstruction = tool.speedWithTool; tools.Add(tool); deconstructionTool = tool; } public void addMiningTool(MiningTool tool){ hasMiningTool = true; rateOfMining = tool.speedWithTool; tools.Add(tool); miningTool = tool; } public void assignJob(Job j){ if (!hasAJob){ currentJob = j; hasAJob = true; atJobSite = false; jobX = j.x; jobY = j.y; jobZ = j.z; Controller.removeRobot(this); Controller.removeJob(currentJob); x = (double)transform.position.x; y = (double)transform.position.y; z = (double)transform.position.z; x = (int) x; y = (int) y; z = (int) z; //GetComponent<Navigator>().targetPosition = m_Target.position; //agent.destination = new Vector3((float)jobX, (float)jobY, (float)jobZ); path = generatePath(new Point((int)(x), (int)(y), (int)(z)), new Point((int)(jobX), (int)(jobY), (int)(jobZ))); } else { Controller.addJob(j); addedStatustoList = true; Debug.Log("I already have a job"); } } public void assignJob(Job j, bool t){ currentJob = j; hasAJob = true; atJobSite = false; jobX = j.x; jobY = j.y; jobZ = j.z; Controller.removeRobot(this); Controller.removeJob(currentJob); x = (double)transform.position.x; y = (double)transform.position.y; z = (double)transform.position.z; x = (int) x; y = (int) y; z = (int) z; //GetComponent<Navigator>().targetPosition = m_Target.position; //agent.destination = new Vector3((float)jobX, (float)jobY, (float)jobZ); path = generatePath(new Point((int)(x), (int)(y), (int)(z)), new Point((int)(jobX), (int)(jobY), (int)(jobZ))); } ArrayList generatePath(Point startLoc, Point goalLoc){ ArrayList open = new ArrayList(); ArrayList attemptingPath = new ArrayList(); ArrayList triedPoints = new ArrayList(); open.Add(startLoc); attemptingPath.Add(startLoc); Point pointToTry = startLoc; Point bestSoFar = startLoc; while (!pointToTry.isEqualTo(goalLoc)){ // Generates points next to current one Point[] adjacentpoints = pointToTry.getAdjacentPoints3d(); // Finds one with lowest cost, and goes from there int triedNum = 0; bool okay = true; for (int i = 0; i < 26; i++){ if (adjacentpoints[i].getFCost(goalLoc) < bestSoFar.getFCost(goalLoc) + 1){ foreach(Point p in triedPoints){ if (p.isEqualTo(adjacentpoints[i])){ okay = false; } } if ((!adjacentpoints[i].occupied)&(okay)){ bestSoFar = adjacentpoints[i]; } else { triedNum += 1; } } } if (triedNum > 24){ attemptingPath = null; attemptingPath = new ArrayList(); Debug.LogError("Cannot find path - too many obstacles"); return attemptingPath; } if (bestSoFar.isEqualTo(startLoc)){ //attemptingPath = null; //attemptingPath = new ArrayList(); //Debug.LogError("Cannot find path - invalid start"); //return attemptingPath; } else { triedPoints.Add(bestSoFar); } pointToTry = bestSoFar; attemptingPath.Add(pointToTry); triedPoints.Add(pointToTry); } return attemptingPath; } void pathTo(int pathX, int pathY, int pathZ, double travelSpeed){ if ((int)x < pathX){ x += travelSpeed; } else if (x > pathX){ x -= travelSpeed; } if ((int)y < pathY){ y += travelSpeed; } else if ((int)y > pathY){ y -= travelSpeed; } if ((int)z < pathZ){ z += travelSpeed; } else if ((int)z > pathZ){ z -= travelSpeed; } pressureInTank -= 1; transform.position = new Vector3((float)x, (float)y, (float)z); } public Point getPostion(){ Point p = new Point((int)(x), (int)(y), (int)(z)); return p; } }
100-degrees-celsius
Mine Carts test/Mine Carts test/Assets/Robots/Robot.cs
C#
gpl3
10,206
using UnityEngine; using System.Collections; using System.Collections.Generic; public class Point { public int x, y, z; public Point parent; public bool occupied; public int timesTried; public Point(int nx, int ny, int nz){ x = nx; y = ny; z = nz; parent = null; } public Point(int nx, int ny, int nz, Point nparent){ x = nx; y = ny; z = nz; parent = nparent; } public int getFCost(Point endPoint){ int fCost = 0; fCost = getMovementCost() + getHeuristicCost(endPoint); return fCost; } public int getMovementCost(){ int cost = 0; if (parent == null){ return cost; } else { if (parent.x != x){ if (parent.y != y){ if (parent.z != z){ cost = 17; } else { cost = 14; } } else { if (parent.z != z){ cost = 14; } else { cost = 10; } } } else { if (parent.y != y){ if (parent.z != z){ cost = 14; } else { cost = 10; } } else { if (parent.z != z){ cost = 10; } else { cost = 10; } } } } return cost; } public int getHeuristicCost(Point endPoint){ int cost = 0; int distanceX = Mathf.Abs(endPoint.x - this.x); int distanceY = Mathf.Abs(endPoint.y - this.y); int distanceZ = Mathf.Abs(endPoint.z - this.z); cost = (distanceX + distanceY + distanceZ) * 13; return cost; } // Use this for initialization void Start () { } // Update is called once per frame void Update () { } public bool isEqualTo(Point point){ if ((this.x == point.x) & (this.y == point.y) & (this.z == point.z)){ return true; } else { return false; } } public Point[] getAdjacentPoints(){ Point[] adjacentPoints = {new Point(x+1, y, z, this), new Point(x+1, y+1, z, this), new Point(x+1, y-1, z, this), new Point(x-1, y, z, this), new Point(x-1, y+1, z, this), new Point(x-1, y-1, z, this), new Point(x, y-1, z, this), new Point(x, y+1, z, this) }; return adjacentPoints; } public Point[] getAdjacentPoints3d(){ List<Point> adjacentPoints = new List<Point>(); for (int nx = -1; nx <= 1; nx ++){ for (int ny = -1; ny <= 1; ny ++){ for(int nz = -1; nz <= 1; nz ++){ if ((nx != 0) | (ny != 0) | (nz != 0)){ adjacentPoints.Add(new Point(x + nx, y + ny, z + nz)); } } } } Point[] arr = (Point[])adjacentPoints.ToArray(); return arr; } }
100-degrees-celsius
Mine Carts test/Mine Carts test/Assets/Robots/Point.cs
C#
gpl3
2,427
using UnityEngine; using System.Collections; public class Follower : MonoBehaviour { private float x, y, z; public float rotationX, rotationY, rotationZ; bool madeTool = false; private const int LevelArea = 10000; private const int ScrollArea = 25; private const int ScrollSpeed = 25; private const int DragSpeed = 100; private const int ZoomSpeed = 25; private const int ZoomMin = 0; private const int ZoomMax = 1000; private const int PanSpeed = 50; private const int PanAngleMin = 30; private const int PanAngleMax = 80; private static Vector3 right = Vector3.right; private static Vector3 forward = Vector3.forward; private static Vector3 curRot; private static Quaternion rot; private static bool hasRotChanged = true; // Update is called once per frame void Update() { Controller.Update(); if (hasRotChanged){ rot = Quaternion.Euler(0,camera.transform.eulerAngles.y, 0); hasRotChanged = false; } curRot = camera.transform.eulerAngles; float negScroll = -ScrollSpeed * Time.deltaTime; float posScroll = ScrollSpeed * Time.deltaTime; // Init camera translation for this frame. var translation = Vector3.zero; var rotation = Vector3.zero; // Zoom in or out var zoomDelta = Input.GetAxis("Mouse ScrollWheel")*ZoomSpeed*Time.deltaTime; if (zoomDelta!=0){ translation -= Vector3.up * ZoomSpeed * zoomDelta; } // Start panning camera if zooming in close to the ground or if just zooming out. // var pan = camera.transform.eulerAngles.x - zoomDelta * PanSpeed; // // pan = Mathf.Clamp(pan, PanAngleMin, PanAngleMax); //if (zoomDelta < 0 || camera.transform.position.y < (ZoomMax / 2)) // // { // // camera.transform.eulerAngles = new Vector3(pan, 0, 0); // // } // Move camera with arrow keys translation += new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical")); rotation += new Vector3(Input.GetAxis ("RotateCamera"),Input.GetAxis ("RotateCamera2"),0); // Rotation Code // if (Input.GetKey("e")) // { // transform.Rotate(1,0,0); // } // if (Input.GetKey("z")) { // transform.Rotate(-1,0,0); //} // Move camera with mouse if (Input.GetMouseButton(2)) // MMB { // Hold button and drag camera around translation -= new Vector3(Input.GetAxis("Mouse X") * DragSpeed * Time.deltaTime, 0, Input.GetAxis("Mouse Y") * DragSpeed * Time.deltaTime); } else { if (Input.mousePosition.x < ScrollArea) { //translation += right * -ScrollSpeed * Time.deltaTime; translation += rotY(curRot.y, right, negScroll); //translation.z -= ordinal.z; } if (Input.mousePosition.x >= Screen.width - ScrollArea) { //translation += right * ScrollSpeed * Time.deltaTime; translation += rotY(curRot.y, right, posScroll); //translation.z += ordinal.z; } if (Input.mousePosition.y < ScrollArea) { //translation += forward * -ScrollSpeed * Time.deltaTime; translation += rotY (curRot.y, forward, negScroll); //translation.x -= ordinal.x; } if (Input.mousePosition.y > Screen.height - ScrollArea) { //translation += forward * ScrollSpeed * Time.deltaTime; translation += rotY (curRot.y, forward, posScroll); //translation.x += ordinal.x; } // change vector if it has changed this update /* if (rotVal != camera.transform.eulerAngles){ rotVal = camera.transform.eulerAngles; rot = rotate (rot, rotVal.y, new Vector3(0,1,0)); }//*/ //translation = x_Vectors(translation, ((new Vector3(rot.x, 0, rot.z)).normalized)+(new Vector3(1,1,1))); //translation = x_Vectors(translation, (new Vector3(rot.x, 0, rot.z)).normalized); } // Keep camera within level and zoom area var desiredPosition = camera.transform.position + translation; if (desiredPosition.x < -LevelArea || LevelArea < desiredPosition.x) { translation.x = 0; } if (desiredPosition.y < ZoomMin || ZoomMax < desiredPosition.y) { translation.y = 0; } if (desiredPosition.z < -LevelArea || LevelArea < desiredPosition.z) { translation.z = 0; } // Finally move camera parallel to world axis translation = rot * translation; if (rotation != Vector3.zero){ hasRotChanged = true; } if (rotation.x + camera.transform.eulerAngles.x > 80 && rotation.x + camera.transform.eulerAngles.x < 90){ rotation.x = 0; }else if( rotation.x + camera.transform.eulerAngles.x < 280 && rotation.x + camera.transform.eulerAngles.x > 270){ rotation.x = 280; } camera.transform.position += translation; camera.transform.eulerAngles += rotation; } } public static Vector3 x_Vectors(Vector3 a, Vector3 b){ return new Vector3(a.x * b.x, a.y * b.y, a.z * b.z); } // small problem for when yRot = 0, and probably for when yRot = 180 also public static Vector3 rotY(float yRot, Vector3 input, float scale){ Vector3 tVal = new Vector3(1, 0, 1) * scale; Vector3 iScale = input * scale; float fCos = Mathf.Cos(yRot); float fSin = Mathf.Sin(yRot); right = Vector3.right * (1-fSin); if (right.x == 0){ right.x = 1; if (fCos < 0){ right.x *= -1; } } forward = Vector3.forward * fCos; if (forward.z == 0){ forward.z = 1; if (fSin < 0){ forward.z *= -1; } } tVal = right + forward; /* float fCos = Mathf.Cos (yRot); float fSin = Mathf.Sin (yRot); float fSum = 1.0f-fCos; // multiply retVal by fCos tVal.z *= fSin; tVal.x *= fSin; if (yRot != 0 && yRot != 180){ // if iScale.x == 0 add tVal.x if (iScale.x == 0){ iScale.z *= 1+tVal.z; iScale.x += (tVal.x); }else if (iScale.z == 0){ iScale.x *= 1+tVal.x; iScale.z += (tVal.z); } }//*/ //print ("Dx, Dz = <"+(iScale.x-Camera.current.transform.position.x) + ", "+(iScale.z - Camera.current.transform.position.z) + ">"); // return iScale return x_Vectors(iScale, tVal); } // rotataes <pos> around an arbitrary axis -- not working how it should public static Vector3 rotate(Vector3 pos, float rot, Vector3 axis){ Vector3 retVal = Vector3.zero; Vector3 m_pos = pos, m_ax = axis; // m_pos = position, m_ax = rotation axis float m_rot = rot; float w; Matrix4x4 r = Matrix4x4.zero; // set matrix values according to m_ax value float fCos = Mathf.Cos (m_rot); float fSin = Mathf.Sin (m_rot); float fSum = 1.0f - fCos; m_ax.Normalize(); r.m00 = (m_ax.x * m_ax.x) * fSum + fCos; r.m01 = (m_ax.x * m_ax.y) * fSum - (m_ax.z * fSin); r.m01 = (m_ax.x * m_ax.z) * fSum + (m_ax.y * fSin); r.m10 = (m_ax.y * m_ax.x) * fSum + (m_ax.z * fSin); r.m11 = (m_ax.y * m_ax.y) * fSum + fCos; r.m12 = (m_ax.y * m_ax.z) * fSum - (m_ax.x * fSin); r.m20 = (m_ax.z * m_ax.x) * fSum - (m_ax.y * fSin); r.m21 = (m_ax.z * m_ax.y) * fSum + (m_ax.x * fSin); r.m22 = (m_ax.z * m_ax.z) * fSum + fCos; r.m03 = r.m13 = r.m23 = r.m30 = r.m31 = r.m32 = 0.0f; r.m33 = 1.0f; retVal.x = m_pos.x * r.m00 + m_pos.y * r.m10 + m_pos.z * r.m20 + r.m30; retVal.y = m_pos.x * r.m01 + m_pos.y * r.m11 + m_pos.z * r.m21 + r.m31; retVal.z = m_pos.x * r.m02 + m_pos.y * r.m12 + m_pos.z * r.m22 + r.m32; w = m_pos.x * r.m03 + m_pos.y * r.m13 + m_pos.z * r.m23 + r.m33; retVal.x /= w; retVal.y /= w; retVal.z /= w; print ("Rotation Vector = <"+retVal.x + ", "+ retVal.y + ", "+retVal.z + ">"); return retVal; } // Use this for initialization void Start () { Controller.Start(); } /* // Update is called once per frame void Update () { Controller.Update(); if (Input.GetKey(KeyCode.UpArrow)){ y += 1; } else if (Input.GetKey(KeyCode.DownArrow)){ y -= 1; } else if (Input.GetKey(KeyCode.RightArrow)){ x += 1; } else if (Input.GetKey(KeyCode.LeftArrow)){ x -= 1; } else if (Input.GetKey(KeyCode.A)){ rotationY += 1; } else if (Input.GetKey(KeyCode.D)){ rotationY -= 1; } else if (Input.GetKey(KeyCode.W)){ rotationX += 1; } else if (Input.GetKey(KeyCode.S)){ rotationX -= 1; } else if (Input.GetKey(KeyCode.Z)){ rotationZ += 1; } else if (Input.GetKey(KeyCode.X)){ rotationZ -= 1; } z += ((Input.GetAxis("Mouse ScrollWheel"))); transform.position = getVector(); transform.Rotate((rotationX), (rotationY), (rotationZ)); rotationX = 0; rotationY = 0; rotationZ = 0; } public Vector3 getVector(){ Vector3 vector = new Vector3(x, y, z); return vector; }*/ }
100-degrees-celsius
Mine Carts test/Mine Carts test/Assets/Camera Stuff/Follower.cs
C#
gpl3
9,022
using UnityEngine; public class GUIManager : MonoBehaviour { public Tutorial tutorial; private ISideMenu selection; private ISideMenu standardMenu = new NoSelectionMenu(); void Start() { selection = standardMenu; } void OnGUI () { Rect SidePane = GUILayout.Window(0, new Rect(10,10,Screen.width/8, Screen.height - 20), selection.SideMenu, "");; Rect MessagePane = GUILayout.Window(1, new Rect(Screen.width/8 + 20, 5*Screen.height/6 -10, Screen.width/6, Screen.height/6), tutorial.Message, "Tutorial"); if (Input.GetMouseButtonUp(0) && !MessagePane.Contains(new Vector2(Input.mousePosition.x, Screen.height - Input.mousePosition.y)) && !SidePane.Contains(new Vector2(Input.mousePosition.x, Screen.height - Input.mousePosition.y))) { Ray ray = Camera.main.ScreenPointToRay (Input.mousePosition); RaycastHit hit; if(Physics.Raycast(ray, out hit)) { selection = hit.transform.GetComponent(typeof(ISideMenu)) as ISideMenu; } else { selection = standardMenu; } } } } public interface ISideMenu { void SideMenu (int windowID); } public interface IMessage { void Message (int windowID); }
100-degrees-celsius
Mine Carts test/Mine Carts test/Assets/GUI/GUIManager.cs
C#
gpl3
1,163
using UnityEngine; using System; public class Tutorial : MonoBehaviour, IMessage { public string[] TutorialMessages; private int MessageIndex = 0; private Vector2 ScrollPosition = Vector2.zero; private void nextButton() { if (MessageIndex < TutorialMessages.Length-1) { if (GUILayout.Button("Next", GUILayout.Width(50))) { MessageIndex++; } } } private void previousButton() { if (MessageIndex > 0) { if (GUILayout.Button("Back", GUILayout.Width(50))) { MessageIndex--; } } } public void Message (int WindowID) { GUILayout.BeginVertical(); ScrollPosition = GUILayout.BeginScrollView(ScrollPosition); GUILayout.Label(TutorialMessages[MessageIndex]); GUILayout.EndScrollView(); GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); previousButton(); nextButton(); GUILayout.EndHorizontal(); GUILayout.EndVertical(); } }
100-degrees-celsius
Mine Carts test/Mine Carts test/Assets/GUI/Tutorial.cs
C#
gpl3
912
using UnityEngine; public class TestSelectable : MonoBehaviour, ISideMenu { public void SideMenu(int window) { GUILayout.Label("Something selected!"); } }
100-degrees-celsius
Mine Carts test/Mine Carts test/Assets/GUI/TestSelectable.cs
C#
gpl3
161
using UnityEngine; public class NoSelectionMenu : ISideMenu { public NoSelectionMenu () { } public void SideMenu(int window) { GUILayout.Label("Nothing selected"); } }
100-degrees-celsius
Mine Carts test/Mine Carts test/Assets/GUI/NoSelectionMenu.cs
C#
gpl3
180
using UnityEngine; using System; using System.Collections.Generic; using System.Linq; using System.Text; // goes through the entire group's tracklist starting from one location and finds all singly contained groups, then returns them all // static class TrackIterator { /* returns an array of Track lists that correspond to all individual and non-connected paths along the track * parameters: * original : The original TrackGroup that is going to be looked through * references: The neighboring Track pieces of the one that was remove just before this is called */ // Currently in an infinite loop. Fix on Friday // UPDATE ON PROGRESS: Finished, needs refinement later; decently fast currently // RE: UPDATE -- Not quite finished, not recognizing that the number of members is changing in each group // RE: RE: UPDAte -- Seems to work fine for now // STATUS UPDATE: Needs to be revised to work entirely with HashSets instead of Lists. Hopefully will not need any more changes than that static public HashSet<Track>[] findBrokenPaths(TrackGroup original, Track[] references) { HashSet<HashSet<Track>> finalList = new HashSet<HashSet<Track>>(); HashSet<Track> skip = new HashSet<Track>(); // holds a skip list to make sure that the same path isn't iterate over more than once int numSubLists = -1; int numIt; int MaxIt = 30; // start with one reference and continue until the last reference has been checked foreach (Track worker in references) { numIt = 0; // if skippable list isn't empty, check to see if current worker is in it if (skip.Count > 0) { if (skip.Contains(worker)){ continue; } } // populate open list HashSet<Track> open = new HashSet<Track>(); Track[] n_List = worker.getNeighbors(); // changed to Track[] n_List from int[] n_List to solve type error foreach(Track n in n_List){ // TODO need to redo this foreach loop probably, changed type from "int n in n_List" to "Track n in n_List" open.Add (n); //open.Add(original.getTrackByID(n.ID)); // changed from .getTrackByID(n) to .getTrackByID(n.ID) :: temporary measure until IDs are done away with } // we can probably assume that since we are only dealing with one list for the moment all neighbors are in the same list. Thus this can be changed to just // open.Add(n); // initialize closed list to just the worker HashSet<Track> closed = new HashSet<Track>(); closed.Add(worker); // now iterate through the now populated open list for as long as there are pieces within the open list bool end = false; while (!end){ // end will == true when open list has no objects within // get new options for open list from neighbors of current open list HashSet<Track> addList = new HashSet<Track>(); foreach(Track o in open){ if (o != null) { n_List = o.getNeighbors(); foreach (Track n in n_List) { //addList.Add(original.getTrackByID(n)); if (original.contains(n)){ addList.Add (n); } } } } // send all open Tracks to the remove list HashSet<Track> removeList = new HashSet<Track>(); foreach(Track o in open){ removeList.Add(o); } // now remove foreach(Track r in removeList){ open.Remove(r); closed.Add(r); } // clear remove removeList.Clear(); // add the new options from add to open list foreach(Track a in addList){ open.Add(a); } // clear add addList.Clear(); // check to see if current open list contains a reference Track foreach(Track r in references){ if (open.Contains(r)){ skip.Add(r); } } // now make sure that if closed has an item then it cannot be in open foreach (Track c in closed) { if (open.Contains(c)) { open.Remove(c); } } // now finally check to see if there are no Tracks in the open list if (open.Count == 0) { end = true; } numIt++; if (numIt >= MaxIt) { end = true; } /* Debug code, not really necesary right now printList(closed, "Closed"); printList(open, "Open"); printList(remove, "Remove"); printList(add, "Add"); Console.WriteLine("Size of Open = {0}", open.Count); Console.ReadKey(); Console.Clear(); */ } numSubLists++; finalList.Add(new HashSet<Track>()); foreach (Track c in closed) { finalList.ElementAt(numSubLists).Add(c); } } if (numSubLists >= 0){ return finalList.ToArray(); } return null; // worst case scenario, should not happen! } static private void printList(List<Track> list, string name) { Console.WriteLine("{0}", name); foreach (Track T in list) { Console.WriteLine("\tTrack[{0}] is in list", T.ID); } } }
100-degrees-celsius
Mine Carts test/Mine Carts test/Assets/Tracks/TrackIterator.cs
C#
gpl3
6,148
using UnityEngine; using System; public class TrackConstants : MonoBehaviour { public int railWidth; public int railOffset; public int maxTrackSectionLength; public int maxTrackVertexLength; }
100-degrees-celsius
Mine Carts test/Mine Carts test/Assets/Tracks/TrackConstants.cs
C#
gpl3
197
using UnityEngine; using System; public class Terminal : Track { public Transform cart; protected override void Start () { base.Start(); Transform newCart = Instantiate(cart) as Transform; newCart.position = coord; newCart.rotation = Quaternion.LookRotation(rot); newCart.position = coord + 2*newCart.transform.up; newCart.GetComponent<Cart>().startTerminal = this; } }
100-degrees-celsius
Mine Carts test/Mine Carts test/Assets/Tracks/Terminal.cs
C#
gpl3
395
using UnityEngine; using System; using System.Collections.Generic; using System.Linq; using System.Text; /* Manages Track and TrackGroup Objects via a simple interface so that the * programmer does not need all of the ins and outs of the stuff to * get things to work properly. Does most of the hard labor autonomously * * Hopefully just a data set to do work so might not need to be bothered by Unity * Other revisions are necessary to make this work right. */ class TrackManager : MonoBehaviour { /* Private variable declarations */ private HashSet<TrackGroup> TG_List; // changed from List<T> to a HashSet<T> public TrackManager() { //Console.Write("TrackManager Initialized!\n"); TG_List = new HashSet<TrackGroup>(); // changed to a HashSet from a List // add a TrackGroup to TG_List so that it does not have to be done later; good for initialization purposes TG_List.Add(new TrackGroup()); } // for now will just do nothing but confirm initialization // *** REMOVED the destructor ~TrackManager() since it really has no purpose. Automatic GC will take care of it *** private TrackGroup searchForContainingTrackGroup(Track t_Track){ foreach (TrackGroup TG in TG_List){ if (TG.contains(t_Track)){ return TG; } } return null; } private TrackGroup searchForContainingTrackGroup(int t_ID) { foreach (TrackGroup TG in TG_List){ if (TG.getNumMembers() > 0){ if (TG.contains(t_ID)){ Console.WriteLine("\nTrack[{0}] found in TrackGroup[{1}]\n", t_ID, TG.ID); return TG; } } } // if a valid TG is not found, return null return null; } private void printSubTracks(HashSet<Track>[] subTracks) { for (int i = 0; i < subTracks.Length; i++) { Console.WriteLine("SubTrack[{0}] has {1} members", i, subTracks[i].Count()); // print the members of subTracks[i] foreach (Track t_subTrack in subTracks[i]) { if (t_subTrack != null) { Console.Write("\t"); t_subTrack.printInfo(); } } } } // retroactively removes track[t_ID] when it clears out the data of t_TG and then doesn't add it back into other groups public bool removeTrack(Track t_Track){ TrackGroup t_TG = searchForContainingTrackGroup (t_Track); if (t_TG != null){ Track[] t_Neighbors = t_Track.getNeighbors(); foreach(Track T in t_Neighbors){ T.removeNeighbor(t_Track); t_Track.removeNeighbor(T); } HashSet<Track>[] subTracks = TrackIterator.findBrokenPaths(t_TG, t_Neighbors); if (subTracks == null){ return false; } printSubTracks(subTracks); if (subTracks.Length > 1){ t_TG.clearList(); for (int i = 0; i < subTracks.Length; i++){ bool foundEmpty = false; foreach (TrackGroup t__TG in TG_List){ if (t__TG.getNumMembers() == 0){// empty found foreach (Track t__Track in subTracks[i]){ if (t__Track != t_Track){ t__TG.addTrack(t__Track); } } foundEmpty = true; break; } } if (!foundEmpty){ TG_List.Add (new TrackGroup(subTracks[i])); } } } return true; } else{ return false; } } /* This entire section commented out but left in for clarity and because I don't want to retype all of the comments again. * Functionally the same as the method immediately above * public bool removeTrack(int t_ID) // find and remove track by track ID { // first get the trackgroup that t_ID is a part of TrackGroup t_TG = searchForContainingTrackGroup(t_ID); // a valid TrackGroup if found, null if not found // check to see if t_TG is valid if (t_TG != null) { #region hideme // now get the Track and its neighbors Track t_Track = t_TG.getTrackByID(t_ID); Track[] t_Neighbors = new Track[t_Track.getNumNeighbors()]; int[] t_TrackNeighborIDs = t_Track.getNeighbors(); // populate t_Neighbors for (int i = 0; i < t_TrackNeighborIDs.Length; i++) { t_Neighbors[i] = t_TG.getTrackByID(t_TrackNeighborIDs[i]); } // remove references between t_Track and t_Neighbors foreach (Track T in t_Neighbors) // not removing neighbors properly { T.removeNeighbor(t_Track.ID); t_Track.removeNeighbor(T.ID); //T.removeNeighbor(T.getID()); } // get a list of subtracks List<Track>[] subTracks = TrackIterator.findBrokenPaths(t_TG, t_Neighbors); // if subTracks for some reason == null then end this method if (subTracks == null) { return false; }// otherwise just continue as normal // print subTracks list printSubTracks(subTracks); #endregion // since we have our list of subtracks, check if the number of subtracks is > 1; if so then empty t_TG and discard it // so we can populate it anew as well as any other empty TrackGroups first if (subTracks.Length > 1) { t_TG.clearList(); // now that t_TG is clear we can start on populating everything for (int i = 0; i < subTracks.Length; i++) {// iterate through each subTracks list; try to find an empty list to populate or, failing that, create a new one to populate #region hideme bool foundEmpty = false; // first, look through TG_List to find an empty list foreach (TrackGroup t__TG in TG_List) { if (t__TG.getNumMembers() == 0) // empty list found! { // now iterate through subTracks[i] Track members and push them into t__TG foreach (Track t__Track in subTracks[i]) { // make sure that they are not adding in Track[t_ID] while going through this if (t__Track.ID != t_ID) { t__TG.addTrack(t__Track); } } // we have found an empty one so no need to keep searching foundEmpty = true; break; } } #endregion // if we are unable to find an empty TrackGroup we need to make one if (!foundEmpty) { TG_List.Add(new TrackGroup(subTracks[i])); // automatically populates TrackGroup // need to remove Track[t_ID] from this new TrackGroup //Track vt_Track = TG_List.Last().getTrackByID(t_ID); //TG_List.Last().removeTrack(vt_Track); } } }// otherwise do nothing else and no tracks have to be moved around so go ahead and exit by returning True return true; } else { Console.WriteLine("Track[{0}] Not found!", t_ID); return false; // in this case the t_ID is not found } } */ public bool addGroup(TrackGroup dummy){ // TODO finish working on this part! // first just add the dummy trackgroup into the manager TG_List.Add (dummy); float xHigh=0, yHigh=0, zHigh=0, xLow=0, yLow=0, zLow=0; Vector3 boxHigh, boxLow; // get TrackGroup dummy's bounding box foreach (Track track in dummy.getAllTracks()){ if (track == dummy.getAllTracks().First()){ // if the first track in the track set then set high and low to the first track's coord values xHigh = xLow = track.coord.x; yHigh = yLow = track.coord.y; zHigh = zLow =track.coord.z; }else{ // check x high and low if (track.coord.x > xHigh){ xHigh = track.coord.x; }else if(track.coord.x < xLow){ xLow = track.coord.x; } // check y high and low if (track.coord.y > yHigh){ yHigh = track.coord.y; }else if(track.coord.y < yLow){ yLow = track.coord.y; } // check z high and low if (track.coord.z > zHigh){ zHigh = track.coord.z; }else if(track.coord.z < zLow){ zLow = track.coord.z; } } } // currently these are very constrained and will actually have a box high and low slightly inside of the actual TrackGroup bounds // TODO fix to work with rotation as well, probably by checking each side (front/back) of the track on bounds to get the actual bounds boxHigh = new Vector3(xHigh,yHigh,zHigh); boxLow = new Vector3(xLow, yLow, zLow); // now that we have our bounding box for the dummy group we need to check to see if there are any nearby TrackPieces from other group(s) HashSet<Track> possibleNeighbors = new HashSet<Track>(); // any Tracks that are within the bounding box are placed here foreach (TrackGroup TG in TG_List){ // iterate through all TrackGroups if (TG != TG_List.Last()){ // except this new group that we just added foreach (Track T in TG.getAllTracks()){ if (isBetween(boxHigh, boxLow, T.coord)){ possibleNeighbors.Add (T); } } } } // now that we have all of our possible neighbors we can check each one for actual proximity to our track pieces, // get a list of actual connections, and connect the associated TrackGroups // if I rewrite the bool addTrack(...) routine then this may be the end of this section, just checking and adding the connections between tracks return false; // if for some reason everything fails } public bool isBetween(Vector3 high, Vector3 low, Vector3 input){ bool lowCheck = false, highCheck = false; // check high first if (high[0] > input[0] && high[1] > input[1] && high[2] > input[2]){ highCheck = true; } // check low if (low[0] < input[0] && low[1] < input[1] && low[2] < input[2]){ lowCheck = true; } // returns TRUE if the coordinate vector "input" is completely within the bounding box, otherwise false return lowCheck && highCheck; } public bool addTrack(Track dummy) { // Create a dummy Track object to place into a TrackGroup // Track dummy = new Track(xyz, abc), cullTrack; // Iterator that is incremented whenever the dummy track fulfulls the requirements to be added to a TrackGroup int numValidConnections = 0; float maxDistance = 1.2f; // used as first cull value List<Track> TG_F_CullIDs = new List<Track>(); // See if this dummy track can connect to any locations within any TrackGroups in TG_List foreach (TrackGroup TG in TG_List){ // disregard any TG that has zero members //Console.WriteLine("TG.getNumMembers = {0}", TG.getNumMembers()); if (TG.getNumMembers() > 0) // only do something with TG if it has at least 1 member { // some crap to cull out any TGs that are far away ( distance > maxDistance from any/all members) Track cullTrack = (TG.getClosestMember(dummy, maxDistance)); // just add the IDs to the list to make things easier if (cullTrack != null) { //Console.WriteLine("cullTrack = {0}", cullTrack.getID()); TG_F_CullIDs.Add(cullTrack); } } } // now that TG_F_CullIDs has been populated, if it has been populated that is, now check to see if dummy track can connect to any // of the Tracks in TG_F_CullIDs foreach (Track i in TG_F_CullIDs) { // for now let's just say that if the item is in TG_F_CullIDs then it is a valid connection numValidConnections++; } //Console.WriteLine("numValidConnections = {0}", numValidConnections); //Console.WriteLine("TG_F_CullIDs.Count = {0}", TG_F_CullIDs.Count()); if (numValidConnections == 0) { // try to find a TrackGroup with 0 members, if none are found then create new foreach (TrackGroup TG in TG_List) { if (TG.getNumMembers() == 0) { TG.addTrack(dummy); return true; // easy way to scoot out of this section quickly } } // if no empty track group is found, create a new one! TG_List.Add(new TrackGroup(dummy)); return true; } else // there are valid connections, now just need to figure out how to work them in together { // print out all connecting IDs /* foreach (Track T in TG_F_CullIDs) { Console.WriteLine("\tConnection: Track[{0}]", T.getID()); } Console.WriteLine(); */ if (numValidConnections == 1) { foreach (TrackGroup TG in TG_List) { // for each TrackGroup in the TrackGroup list search for the first valid connection in TG_F_CullIDs if (TG.contains(TG_F_CullIDs.ElementAt(0))) { dummy.addNeighbor(TG_F_CullIDs.ElementAt(0)); TG_F_CullIDs.ElementAt(0).addNeighbor(dummy); TG.addTrack(dummy); } } } else { // now to figure out which TrackGroups are being connected List<TrackGroup> TrackGroupConnectionSet = new List<TrackGroup>(); foreach (TrackGroup TG in TG_List) { foreach (Track T in TG_F_CullIDs) { if (TG.contains(T)) { TrackGroupConnectionSet.Add(TG); break; // makes sure that a TrackGroup is only added to the ConnectionSet once } } } foreach (Track T in TG_F_CullIDs) { dummy.addNeighbor(T); T.addNeighbor(dummy); } foreach (TrackGroup TG in TrackGroupConnectionSet) { if (TG == TrackGroupConnectionSet.ElementAt(0)) { continue; // skip the first group because it will always be the lowest index TrackGroup } else { TrackGroupConnectionSet.ElementAt(0).merge(TG.getAllTracks()); TG.clearList(); } } TrackGroupConnectionSet.ElementAt(0).addTrack(dummy); } return false; } } public void printItems(bool groups, bool tracks) { Console.WriteLine("TRACKMANAGER (TMAN) Member List"); Console.WriteLine("\tShow Groups: " + groups); Console.WriteLine("\tShow Tracks: " + tracks); foreach (TrackGroup TG in TG_List) { if (groups) { Console.Write("TrackGroup[{0}] has {1} Tracks\n", TG.ID, TG.getNumMembers()); } if (tracks){ TG.printMembers(); } } } }
100-degrees-celsius
Mine Carts test/Mine Carts test/Assets/Tracks/TrackManager.cs
C#
gpl3
15,996
using UnityEngine; using System; using System.Collections.Generic; using System.Linq; using System.Text; /* TrackGroup objects contain Track objects that are connected to each other in a single unified piece */ // funtionality to be added in next step: adding neighbor chains, destroying neighbor chains // step + 1 functionality: remove tracks, see if it causes a continuity problem, splitting group into multiple groups // TrackGroups are entirely just DataMembers and so do not need to have a Start method, I hope! class TrackGroup { /* Private variable declarations */ private static int S_ID = 0; private int _ID; public int ID { get { return _ID; } } private HashSet<Track> T_List; // changed to HashSet<Track> for search speed public TrackGroup() { _ID = S_ID++; T_List = new HashSet<Track>(); // changed to HashSet<Track> to match var declaration //Console.Write("\tNew TrackGroup["+m_ID+"] added!\n"); } public TrackGroup(Track firstMember) { _ID = S_ID++; T_List = new HashSet<Track>(); // changed to HashSet<Track> to match var declaration //Console.Write("\tNew TrackGroup["+m_ID+"] added!\n"); this.addTrack(firstMember); } public TrackGroup(HashSet<Track> allMembers) // changed from List<Track> to HashSet<Track> to match T_List typing { _ID = S_ID++; T_List = allMembers; } public int getNumMembers() { try { return T_List.Count(); // attempt to return the count } catch (System.ArgumentNullException) // if the count = 0 or T_List == null then return 0 { return 0; } } public void removeTrack(Track t) { Console.WriteLine("Attempting to remove Track[{0}] from TrackGroup[{1}]", t.ID, this._ID); T_List.Remove(t); // will remove the Track (t) IFF it is available for removal. #region SUPERFLOUS CODE! /* if (this.contains(t)) { Console.WriteLine("\tRemoval of Track[{0}] from TrackGroup[{1}] failed", t.ID, this._ID); Console.Write("\tTrying again but by index..."); // get index of t int index_t = T_List.IndexOf(t); Console.Write("Track[{0}]...", index_t); if (index_t >= 0 && index_t < T_List.Count()) { T_List.RemoveAt(index_t); } if (this.contains(t)) { Console.Write("Failed"); } else { Console.Write("Success"); } Console.WriteLine(); } else { Console.WriteLine("\tRemoval of Track[{0}] from TrackGroup[{1}] succeeded", t.ID, this.ID); } */ #endregion } public void addTrack(Track t) { // make sure that track t is not null if (t != null) { T_List.Add(t); } } //TODO alter this method to take advantage of the TrackConstants values and search UP TO 2x Length and 1.5x Width for a "Raycasting Box" to see if the Track could be close enough to collide with another TrackPiece along its rotational vector from its coordinate vector public Track getClosestMember(Track testTrack, float maxDistance) { if (getNumMembers() > 0) { float distance = 0.0f, pDistance = 0.0f; int firstID = T_List.First().ID; int bestID = firstID; Track retTrack = null; Vector3 t_coord = testTrack.coord, m_coord; foreach (Track t in T_List) { m_coord = t.coord; if (t.ID == firstID) { pDistance = Vector3.Distance(t_coord, m_coord); retTrack = t; // here just in case the firstID is also the lastID } else { distance = Vector3.Distance(t_coord, m_coord); if (pDistance > distance) { pDistance = distance; bestID = t.ID; retTrack = t; } } } //Console.WriteLine("Max Distance = {0} ; Best Distance = {1}; Best ID = {2}", maxDistance, pDistance,bestID); //Console.WriteLine("Best Distance <= Max Distance = {0}", pDistance <= maxDistance); if (pDistance <= maxDistance) { //Console.WriteLine("returnTrack.ID = {0}", retTrack.ID); return retTrack; } else { return null; } } else { return null; } } public bool contains(Track track) { return T_List.Contains(track); #region SUPERFLOUS with change from List<T> to HashSet<T> for the T_List variable /* foreach (Track T in T_List) { if (T.isEqual(track)) { return true; } } return false; //*/ #endregion } public bool contains(int trackID) // looks for trackID amongst its lists { // not sure of a quick way around this one other than just getting rid of it once IDs are phased out foreach (Track T in T_List) { if (T.ID == trackID) { return true; } } return false; } // shouldn't even need this anymore, as long as we know that the Track is in here then we can just grab it public Track getTrackByID(int trackID) { foreach (Track T in T_List){ if (T.ID == trackID) { return T; } } return null; // should never happen if contains(trackID) is done before this one } public void printMembers() { foreach (Track T in T_List) { Console.Write("\tTrack[{0}] has {1} Neighbors\n",T.ID,T.getNumNeighbors()); T.printNeighbors(); } } public HashSet<Track> getAllTracks() // Changed RetVal from List<Track> to HashSet<Track> { return T_List; } // TODO research fast HashSet merging public void merge(HashSet<Track> newItems) // Changed param-type of newItems from List<Track> to HashSet<Track> since they will be passed in as a HashSet instead of a List now {// there might be a faster way to merge hashsets but I am not sure of it at the moment. Research is needed foreach (Track T in newItems){ this.addTrack(T); } } public void clearList() { T_List.Clear(); } }
100-degrees-celsius
Mine Carts test/Mine Carts test/Assets/Tracks/TrackGroup.cs
C#
gpl3
6,991
using UnityEngine; using System.Collections.Generic; public class TrackFactory : MonoBehaviour { #region Properties //The constants governing track section size and smoothening are loaded dynamically. private static TrackConstants _constants; private static TrackConstants constants { get { if (_constants == null) { _constants = GameObject.FindObjectOfType(typeof(TrackConstants)) as TrackConstants; } return _constants; } } //The constants are extracted from TrackConstants public static int railWidth { get { return constants.railWidth; } } public static int railOffset { get { return constants.railOffset; } } public static int maxTrackSectionLength { get { return constants.maxTrackSectionLength; } } public static int maxTrackVertexLength { get { return constants.maxTrackVertexLength; } } //The rail and stopper prefabs is located when needed and made availible to all static methods. private static Transform _rail; public static Transform rail { get { //Fetch the rail object if it hasn't been fetchd yet if (_rail == null) { _rail = GameObject.FindWithTag("Rail Section").GetComponent<Transform>(); } return _rail; } } private static Transform _stopper; public static Transform stopper { get { //Fetch the stopper object if it hasn't been fetchd yet if (_stopper == null) { _stopper = GameObject.FindWithTag("Stopper Section").GetComponent<Transform>(); } return _stopper; } } private static Transform _terminal; public static Transform terminal { get { //Fetch the stopper object if it hasn't been fetchd yet if (_terminal == null) { _terminal = GameObject.FindWithTag("Terminal").GetComponent<Transform>(); } return _terminal; } } #endregion /*Generates a vector of Transforms, each of them being a track section. * Together, they form a track passing through each SplineControlPoint */ public static Spline3D[] genTrack(SplineControlPoint[] points, Transform type) { //First, subdivide the track into a set of track sections Spline3D[] paths = (new Spline3D(points)).Rasterize(maxTrackSectionLength); //Set the default type of the track foreach(Spline3D path in paths) { path.type = TrackFactory.rail; } //return the path for later use return paths; } public static Transform[] genRails(Spline3D[] paths) { List<Transform> tracks = new List<Transform>(); foreach(Spline3D path in paths) { if(path.type != TrackFactory.terminal) { path.Smooth(2); } tracks.Add(genRail(path, railWidth, railOffset, path.type, path.layer)); } return tracks.ToArray(); } /*This generates the mesh for the rail and sets up the rail script properties * for use by the track manager */ private static Transform genRail(Spline3D path, float railWidth, int offsetFactor, Transform type, int layer) { Transform newRail = MonoBehaviour.Instantiate(type) as Transform; //A railway has two rails Mesh leftMesh = genMesh (path, railWidth, offsetFactor); Mesh rightMesh = genMesh (path, railWidth, -offsetFactor); newRail.Find("LeftRail").GetComponent<MeshFilter>().mesh = leftMesh; newRail.Find("LeftRail").GetComponent<MeshCollider>().sharedMesh = leftMesh; newRail.Find("LeftRail").gameObject.layer = layer; newRail.Find("RightRail").GetComponent<MeshFilter>().mesh = rightMesh; newRail.Find("RightRail").GetComponent<MeshCollider>().sharedMesh = rightMesh; newRail.Find("RightRail").gameObject.layer = layer; //Constants for the track manager. newRail.GetComponent<Track>().coord = path.center; newRail.GetComponent<Track>().rot = path.direction; newRail.GetComponent<Track>().startControlPoint = path.startSplineControlPoint; newRail.GetComponent<Track>().endControlPoint = path.endSplineControlPoint; return newRail; } /* This is where the magic happens */ private static Mesh genMesh(Spline3D path, float railWidth, int offsetFactor) { Mesh mesh = new Mesh(); //Generating a mesh programatically requires a list of vertices and a list of integers // detailing what vertices form a triangle List<Vector3> verts = new List<Vector3>(); List<int> triangles = new List<int>(); /*From the points on the path, we deduce the foreward and sideways direction at that point * in the path. It's currently assumed that the up-direction for the path is the up-direction * of the world. This appears to cause inversions if the path goes upside-down. * Further testing is required to find out of it can happen in a realistic scenario or not */ Vector3 direction; Vector3 left; //We keep track of how many vertices have been processed, for the triangle array. int i = 0; foreach(Vector3[] pointPair in path) { //The foreward direction is taken to be from the start point to the // end point of the section under consideration. From this, the // local leftward direction is also deduced direction = pointPair[1] - pointPair[0]; left = railWidth * Vector3.Cross(Vector3.up, direction).normalized; //If this is the first section of the track, we need to set up the // front face. if(verts.Count == 0) { verts.Add(pointPair[0] + left + Vector3.up + offsetFactor*left); verts.Add(pointPair[0] + left - Vector3.up + offsetFactor*left); verts.Add(pointPair[0] - left + Vector3.up + offsetFactor*left); verts.Add(pointPair[0] - left - Vector3.up + offsetFactor*left); } //For each section, we then add the vertices of the back face. verts.Add(pointPair[1] + left + Vector3.up + offsetFactor*left); verts.Add(pointPair[1] + left - Vector3.up + offsetFactor*left); verts.Add(pointPair[1] - left + Vector3.up + offsetFactor*left); verts.Add(pointPair[1] - left - Vector3.up + offsetFactor*left); //And we set up the triangles for the track. Note that we only generate // triangles for the top, left and right side. The bottom of the track and // the front and back end don't have faces. //Top side triangles.AddRange(new int[] {i+4, i, i+2}); triangles.AddRange(new int[] {i+4, i+2, i+6}); //Left side triangles.AddRange(new int[] {i+6, i+2, i+3}); triangles.AddRange(new int[] {i+6, i+3, i+7}); //Right side triangles.AddRange(new int[] {i, i+4, i+1}); triangles.AddRange(new int[] {i+1, i+4, i+5}); //Finally, we increment the counter holding the vertices processed by 4, since // we process 4 vertices at a time. i += 4; } Vector3[] vertices = verts.ToArray(); Vector2[] uvs = new Vector2[vertices.Length]; for(int j = 0; i < uvs.Length; i++) { uvs[j] = new Vector2(vertices[j].x, vertices[j].z); i++; } //Finally, we add the vertices and faces to the mesh mesh.vertices = vertices; mesh.triangles = triangles.ToArray(); mesh.uv = uvs; //Calculate the normals for propper physics behavior mesh.RecalculateNormals(); //And return the mesh. return mesh; } }
100-degrees-celsius
Mine Carts test/Mine Carts test/Assets/Tracks/TrackFactory.cs
C#
gpl3
7,230
using UnityEngine; using System; using System.Collections.Generic; using System.Linq; using System.Text; public class Track : MonoBehaviour { #region Properties private static int S_ID = 0; // keeps a running tally of successive Track ID values private int _ID; // try to get rid of _ID values since there is currently no way to re-use old IDs. May have a workaround by keeping a list of no longer used ID values somewhere? public int ID { get { return _ID; } } public Vector3 coord { get; set; } public Vector3 rot { get; set; } public SplineControlPoint startControlPoint{ get; set;} public SplineControlPoint endControlPoint{ get; set;} //private List<Track> neighbors; // a list of neighboring tracks' IDs :: Changed from List<int> to List<Track> private HashSet<Track> neighbors; #endregion //MonoBehavior scripts can't have constructors. Instead we do the setup in the Start function // and pass extra information in by calling the setters of the properties that need to be set. protected virtual void Start() { _ID = S_ID++; //neighbors = new List<Track>(); neighbors = new HashSet<Track>(); } // neighbors is used to create track chains that are easy to follow // changed to (Track n_Track) from (int n_ID) public void addNeighbor(Track n_Track) { neighbors.Add(n_Track); //Console.WriteLine("Track[{0}] has added Track[{1}] to its list of neighbors.", m_ID, n_ID); } // Changed from (int n_ID) to (Track n_Track) public bool removeNeighbor(Track n_Track) { return neighbors.Remove(n_Track); // returns true if the neighbor ID existed and is now removed; false if the ID cannot be found } public int getNumNeighbors() { return neighbors.Count(); } // changed from RetVal int[] to Track[] public Track[] getNeighbors() { return neighbors.ToArray(); } public void printInfo(){ Console.WriteLine("Track -- Coord = {0}\tRot = {1}",coord, rot); } public void printNeighbors() { foreach (Track track in neighbors) // changed enumeration type from int to Track { /* Changing the amount of information displayed by this from just ID number to the Coordinates, Rotation values */ /* Can TrackType be added as an ENUM? or part of the TrackConstants by chance?? */ //Console.WriteLine("\t\tNeighbor: Track[{0}]", track.ID); Console.WriteLine("Neighbor -- Coord = {0}\tRot = {1}",track.coord, track.rot); } } public bool isEqual(Track t_Track) { try { // removed t_Track.ID == this.ID check return (t_Track.coord == this.coord) && (t_Track.rot == this.rot); } catch (NullReferenceException) { return false; } } }
100-degrees-celsius
Mine Carts test/Mine Carts test/Assets/Tracks/Track.cs
C#
gpl3
2,860
using UnityEngine; using System.Collections; public class BoilerManager : WorkshopManager { // Use this for initialization void Start () { ConstructionController.boilers.Add(this); } // Update is called once per frame void Update () { } public void OnMouseUp(){ queueJob(); } public void queueJob(){ } }
100-degrees-celsius
Mine Carts test/Mine Carts test/Assets/Infrastructure/Buildings/Steam/BoilerManager.cs
C#
gpl3
331
using UnityEngine; using System.Collections; public class InfiniteOreShopManager : WorkshopManager { // Use this for initialization void Start () { } // Update is called once per frame void Update () { } public void OnMouseUp(){ queueJob(); } public void queueJob(){ new MiningJob((int)transform.position.x, (int)transform.position.y, (int)transform.position.z); } }
100-degrees-celsius
Mine Carts test/Mine Carts test/Assets/Infrastructure/Buildings/Workshops/InfiniteOreShopManager.cs
C#
gpl3
393
using UnityEngine; using System.Collections; public class ForgeManager : WorkshopManager { bool matSelected; Bar bar; // Use this for initialization void Start () { queue = new ArrayList(); } // Update is called once per frame void Update () { if (queue.Count > 0){ Job j = (Job)queue[0]; if (j.percentageComplete > 100){ queue.RemoveAt(0); if (queue.Count > 0){ Controller.addJob((Job)queue[0]); } } } } public void OnMouseUp(){ queueJob(); } public void queueJob(){ clicked = true; } void OnGUI(){ if (clicked & !matSelected){ GUI.Box(new Rect(10, 10, 180, 190), "Forge"); if (queue.Count != 0){ ArrayList toBeRemoved = new ArrayList(); GUI.Box(new Rect(10, 205, 180, 23 * queue.Count + 25), "Queue"); int i = 0; foreach (Job job in queue){ if (GUI.Button(new Rect(15, 230 + 23 * i, 160, 20), (string) job.jobLabel)){ toBeRemoved.Add(job); } i++; } foreach (Job job in toBeRemoved){ queue.Remove(job); } } else { } try { if (GUI.Button (new Rect (159, 12, 25, 20), "X")){ clicked = false; } else if (GUI.Button (new Rect (20, 40, 160, 21), "Copper")) { matSelected = true; bar = (Bar)ItemList.copperBars[0]; } else if (GUI.Button (new Rect (20, 62, 160, 21), "Brass")) { matSelected = true; bar = (Bar)ItemList.brassBars[0]; } else if (GUI.Button (new Rect (20, 84, 160, 21), "Bronze")) { matSelected = true; bar = (Bar)ItemList.bronzeBars[0]; } else if (GUI.Button (new Rect (20, 106, 160, 21), "Aluminum")) { matSelected = true; bar = (Bar)ItemList.aluminumBars[0]; } else if (GUI.Button (new Rect (20, 128, 160, 21), "Iron")) { matSelected = true; bar = (Bar)ItemList.ironBars[0]; } else if (GUI.Button (new Rect (20, 150, 160, 21), "Steel")) { matSelected = true; bar = (Bar)ItemList.steelBars[0]; } else if (GUI.Button (new Rect (20, 172, 160, 21), "Galvanized Steel")) { matSelected = true; bar = (Bar)ItemList.galvanizedSteelBars[0]; } } catch { Debug.Log("No Bars"); matSelected = false; } } if (matSelected & clicked){ GUI.Box(new Rect(10, 10, 180, 220), "Forge"); try { if (GUI.Button (new Rect (159, 12, 25, 20), "X")){ matSelected = false; } else if (GUI.Button (new Rect (20, 40, 160, 21), "Forge head")) { clicked = false; matSelected = false; queue.Add(new ForgeRobotComponents(bar, (int)transform.position.x, (int)transform.position.y, (int)transform.position.z, 0)); } else if (GUI.Button (new Rect (20, 62, 160, 21), "Forge arms")) { clicked = false; matSelected = false; queue.Add(new ForgeRobotComponents(bar, (int)transform.position.x, (int)transform.position.y, (int)transform.position.z, 1)); } else if (GUI.Button (new Rect (20, 84, 160, 21), "Forge legs")) { clicked = false; matSelected = false; queue.Add(new ForgeRobotComponents(bar, (int)transform.position.x, (int)transform.position.y, (int)transform.position.z, 2)); } else if (GUI.Button (new Rect (20, 106, 160, 21), "Forge torso")) { clicked = false; matSelected = false; queue.Add(new ForgeRobotComponents(bar, (int)transform.position.x, (int)transform.position.y, (int)transform.position.z, 3)); } else if (GUI.Button (new Rect (20, 128, 160, 21), "Forge tank")) { clicked = false; matSelected = false; queue.Add(new ForgeRobotComponents(bar, (int)transform.position.x, (int)transform.position.y, (int)transform.position.z, 4)); } else if (GUI.Button (new Rect (20, 150, 160, 21), "Forge mining tool")) { clicked = false; matSelected = false; queue.Add(new ForgeRobotComponents(bar, (int)transform.position.x, (int)transform.position.y, (int)transform.position.z, 5)); } else if (GUI.Button (new Rect (20, 172, 160, 21), "Forge construction tool")) { clicked = false; matSelected = false; queue.Add(new ForgeRobotComponents(bar, (int)transform.position.x, (int)transform.position.y, (int)transform.position.z, 6)); } else if (GUI.Button (new Rect (20, 194, 160, 21), "Forge deconstruction tool")) { clicked = false; matSelected = false; queue.Add(new ForgeRobotComponents(bar, (int)transform.position.x, (int)transform.position.y, (int)transform.position.z, 7)); } if (queue.Count > 1){ try { Controller.removeJob((Job)queue[queue.Count - 1]); } catch { } } } catch { Debug.Log("No Bars"); } } } }
100-degrees-celsius
Mine Carts test/Mine Carts test/Assets/Infrastructure/Buildings/Workshops/ForgeManager.cs
C#
gpl3
4,586
using UnityEngine; using System.Collections; public class SmelterManager : WorkshopManager { // Use this for initialization void Start () { queue = new ArrayList(); } // Update is called once per frame void Update () { if (queue.Count > 0){ Job j = (Job)queue[0]; if (j.percentageComplete > 100){ queue.RemoveAt(0); if (queue.Count > 0){ Controller.addJob((Job)queue[0]); } } } } public void OnMouseUp(){ queueJob(); } public void queueJob(){ clicked = true; } void OnGUI(){ if (clicked){ GUI.Box(new Rect(10, 10, 180, 230), "Smelter"); if (queue.Count != 0){ GUI.Box(new Rect(10, 245, 180, 23 * queue.Count + 25), "Queue"); int i = 0; ArrayList toBeRemoved = new ArrayList(); foreach (Job job in queue){ if (GUI.Button(new Rect(15, 270 + 23 * i, 160, 20), (string) job.jobLabel)){ toBeRemoved.Add(job); } i++; } foreach (Job job in toBeRemoved){ queue.Remove(job); } } try { if (GUI.Button (new Rect (159, 12, 25, 20), "X")){ clicked = false; } else if (GUI.Button (new Rect (20, 40, 160, 20), "Smelt Iron")) { clicked = false; queue.Add(new SmeltOre((int)transform.position.x, (int)transform.position.y, (int)transform.position.z, (Ore) (ItemList.ironOre[0]))); } else if (GUI.Button (new Rect (20, 62, 160, 20), "Smelt Tin")) { clicked = false; queue.Add(new SmeltOre((int)transform.position.x, (int)transform.position.y, (int)transform.position.z, (Ore) (ItemList.tinOre[0]))); } else if (GUI.Button (new Rect (20, 84, 160, 20), "Smelt Aluminum")) { clicked = false; queue.Add(new SmeltOre((int)transform.position.x, (int)transform.position.y, (int)transform.position.z, (Ore) (ItemList.aluminumOre[0]))); } else if (GUI.Button (new Rect (20, 106, 160, 20), "Smelt Copper")) { clicked = false; queue.Add(new SmeltOre((int)transform.position.x, (int)transform.position.y, (int)transform.position.z, (Ore) (ItemList.copperOre[0]))); } else if (GUI.Button (new Rect (20, 128, 160, 20), "Smelt Zinc")) { clicked = false; queue.Add(new SmeltOre((int)transform.position.x, (int)transform.position.y, (int)transform.position.z, (Ore) (ItemList.zincOre[0]))); } else if (GUI.Button (new Rect (20, 150, 160, 20), "Smelt Brass")) { clicked = false; queue.Add(new SmeltBrass((int)transform.position.x, (int)transform.position.y, (int)transform.position.z, (Bar) ItemList.zincBars[0], (Bar) (ItemList.copperBars[0]))); } else if (GUI.Button (new Rect (20, 172, 160, 20), "Smelt Bronze")) { clicked = false; queue.Add(new SmeltBronze((int)transform.position.x, (int)transform.position.y, (int)transform.position.z, (Bar) (ItemList.tinBars[0]), (Bar) (ItemList.copperBars[0]))); } else if (GUI.Button (new Rect (20, 194, 160, 20), "Smelt Steel")) { clicked = false; queue.Add(new SmeltSteel((int)transform.position.x, (int)transform.position.y, (int)transform.position.z)); } else if (GUI.Button (new Rect (20, 216, 160, 20), "Galvanize Steel")) { clicked = false; queue.Add(new SmeltGalvanizedSteel((int)transform.position.x, (int)transform.position.y, (int)transform.position.z, (Bar) ItemList.zincBars[0], (Bar) (ItemList.steelBars[0]))); } if (queue.Count > 1){ try { Controller.removeJob((Job)queue[queue.Count - 1]); } catch { } } } catch { Debug.Log("No ore"); } } } }
100-degrees-celsius
Mine Carts test/Mine Carts test/Assets/Infrastructure/Buildings/Workshops/SmelterManager.cs
C#
gpl3
3,514
using UnityEngine; using System.Collections; public class WorkshopManager : MonoBehaviour { protected bool clicked; protected ArrayList queue; // Use this for initialization void Start () { } // Update is called once per frame void Update () { } }
100-degrees-celsius
Mine Carts test/Mine Carts test/Assets/Infrastructure/Buildings/Workshops/WorkshopManager.cs
C#
gpl3
268
using UnityEngine; using System.Collections; public class AssemblyLineManager : WorkshopManager { // Use this for initialization void Start () { queue = new ArrayList(); } // Update is called once per frame void Update () { if (queue.Count > 0){ Job j = (Job)queue[0]; if (j.percentageComplete > 100){ queue.Remove(j); if (queue.Count > 0){ Controller.addJob((Job)queue[0]); } } } } public void OnMouseUp(){ queueJob(); } public void queueJob(){ clicked = true; } void OnGUI(){ if (clicked){ GUI.Box(new Rect(10, 10, 180, 60), "Assembly Line"); ArrayList toBeRemoved = new ArrayList(); if (queue.Count != 0){ GUI.Box(new Rect(10, 75, 180, 23 * queue.Count + 25), "Queue"); int i = 0; foreach (Job job in queue){ if (GUI.Button(new Rect(15, 270 + 23 * i, 160, 20), (string) job.jobLabel)){ toBeRemoved.Add(job); } i++; } foreach (Job job in toBeRemoved){ queue.Remove(job); } } try { if (GUI.Button (new Rect (159, 12, 25, 20), "X")){ clicked = false; } else if (GUI.Button (new Rect (15, 40, 160, 20), "Assemble Robot")){ clicked = false; queue.Add(new AssembleRobot((int)transform.position.x, (int)transform.position.y, (int)transform.position.z, (Arms)ItemList.arms[0], (Legs)ItemList.legs[0], (Head)ItemList.heads[0], (Torso)ItemList.torsos[0], (Tank)ItemList.tanks[0])); if (queue.Count > 1){ Controller.removeJob((Job)queue[queue.Count - 1]); } } } catch { Debug.Log("No components"); } } } }
100-degrees-celsius
Mine Carts test/Mine Carts test/Assets/Infrastructure/Buildings/Workshops/AssemblyLineManager.cs
C#
gpl3
1,624
using UnityEngine; using System.Collections; public static class ConstructionController { public static ArrayList boilers = new ArrayList(); }
100-degrees-celsius
Mine Carts test/Mine Carts test/Assets/Infrastructure/ConstructionController.cs
C#
gpl3
151
using UnityEngine; using System.Collections; public class TestTrack : MonoBehaviour { // Use this for initialization void Start () { //We'll generate 2 track sections SplineControlPoint[] track1 = new SplineControlPoint[2]; SplineControlPoint[] track2 = new SplineControlPoint[2]; //Generate the spline control points for track section 1 track1[0] = new SplineControlPoint(new Vector3(0, 50, 0), new Vector3(1,0,0), new float[] {50, 50}); track1[1] = new SplineControlPoint(new Vector3(100, 0, 0), new Vector3(1,0,0), new float[] {50, 50}); //Generate a track from these spline control points Spline3D[] trackSections1 = TrackFactory.genTrack(track1, TrackFactory.rail); //Add terminals to trackSections1 trackSections1[0].type = TrackFactory.terminal; trackSections1[trackSections1.Length-1].type = TrackFactory.terminal; //Generate the spline control points for track section 2, using the end point of one section of trackSections1 as a starting point track2[0] = trackSections1[3].endSplineControlPoint; track2[0].weights = new float[] {50,50}; track2[1] = new SplineControlPoint(new Vector3(100, 0, -100), new Vector3(1,0,0), new float[] {50, 50}); //Generate a track from these spline control points Spline3D[] trackSections2 = TrackFactory.genTrack(track2, TrackFactory.rail); //Adjust the layers of the track sections just after the switch so the cart can go the right way trackSections1[4].layer = LayerMask.NameToLayer("Tracks going left"); trackSections2[0].layer = LayerMask.NameToLayer("Tracks going right"); //Convert the track sections into meshes TrackFactory.genRails(trackSections1); TrackFactory.genRails(trackSections2); } }
100-degrees-celsius
Mine Carts test/Mine Carts test/Assets/TestTrack.cs
C#
gpl3
1,719
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace MC_AI_002 { // goes through the entire group's tracklist starting from one location and finds all singly contained groups, then returns them all // static class TrackIterator { /* returns an array of Track lists that correspond to all individual and non-connected paths along the track * parameters: * original : The original TrackGroup that is going to be looked through * references: The neighboring Track pieces of the one that was remove just before this is called */ // Currently in an infinite loop. Fix on Friday // UPDATE ON PROGRESS: Finished, needs refinement later; decently fast currently // RE: UPDATE -- Not quite finished, not recognizing that the number of members is changing in each group // RE: RE: UPDAte -- Seems to work fine for now static public List<Track>[] findBrokenPaths(TrackGroup original, Track[] references) { List<List<Track>> finalList = new List<List<Track>>(); List<Track> skip = new List<Track>(); // holds a skip list to make sure that the same path isn't iterate over more than once int numSubLists = -1; int numIt; int MaxIt = 30; // start with one reference and continue until the last reference has been checked foreach (Track worker in references) { numIt = 0; // if skippable list isn't empty, check to see if current worker is in it if (skip.Count > 0) { if (skip.Contains(worker)){ continue; } } // populate open list List<Track> open = new List<Track>(); int[] n_List = worker.getNeighbors(); foreach(int n in n_List){ open.Add(original.getTrackByID(n)); } // initialize closed list to just the worker List<Track> closed = new List<Track>(); closed.Add(worker); // now iterate through the now populated open list for as long as there are pieces within the open list bool end = false; while (!end){ // end will == true when open list has no objects within // get new options for open list from neighbors of current open list List<Track> add = new List<Track>(); foreach(Track o in open){ if (o != null) { n_List = o.getNeighbors(); foreach (int n in n_List) { add.Add(original.getTrackByID(n)); } } } // send all open Tracks to the remove list List<Track> remove = new List<Track>(); foreach(Track o in open){ remove.Add(o); } // now remove foreach(Track r in remove){ open.Remove(r); closed.Add(r); } // clear remove remove.Clear(); // add the new options from add to open list foreach(Track a in add){ open.Add(a); } // clear add add.Clear(); // check to see if current open list contains a reference Track foreach(Track r in references){ if (open.Contains(r)){ skip.Add(r); } } // now make sure that if closed has an item then it cannot be in open foreach (Track c in closed) { if (open.Contains(c)) { open.Remove(c); } } // now finally check to see if there are no Tracks in the open list if (open.Count == 0) { end = true; } numIt++; if (numIt >= MaxIt) { end = true; } /* Debug code, not really necesary right now printList(closed, "Closed"); printList(open, "Open"); printList(remove, "Remove"); printList(add, "Add"); Console.WriteLine("Size of Open = {0}", open.Count); Console.ReadKey(); Console.Clear(); */ } numSubLists++; finalList.Add(new List<Track>()); foreach (Track c in closed) { finalList.ElementAt(numSubLists).Add(c); } } if (numSubLists >= 0){ return finalList.ToArray(); } return null; // worst case scenario, should not happen! } static private void printList(List<Track> list, string name) { Console.WriteLine("{0}", name); foreach (Track T in list) { Console.WriteLine("\tTrack[{0}] is in list", T.getID()); } } } }
100-degrees-celsius
MC_AI_002/MC_AI_002/TrackIterator.cs
C#
gpl3
5,918
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace MC_AI_002 { /* Manages Track and TrackGroup Objects via a simple interface so that the * programmer does not need all of the ins and outs of the stuff to * get things to work properly. Does most of the hard labor autonomously */ class TrackManager { /* Private variable declarations */ private List<TrackGroup> TG_List; public TrackManager() { //Console.Write("TrackManager Initialized!\n"); TG_List = new List<TrackGroup>(); // add a TrackGroup to TG_List so that it does not have to be done later; good for initialization purposes TG_List.Add(new TrackGroup()); } // for now will just do nothing but confirm initialization ~TrackManager() { Console.WriteLine("TrackManager Destroyed!"); foreach (TrackGroup TG in TG_List) { // iterate through and empty each list TG.clearList(); } TG_List.RemoveRange(0,TG_List.Count()); TG_List = null; } // does nothing but confirm object destruction private TrackGroup searchForContainingTrackGroup(int t_ID) { foreach (TrackGroup TG in TG_List){ if (TG.getNumMembers() > 0){ if (TG.contains(t_ID)){ Console.WriteLine("\nTrack[{0}] found in TrackGroup[{1}]\n", t_ID, TG.getID()); return TG; } } } // if a valid TG is not found, return null return null; } private void printSubTracks(List<Track>[] subTracks) { for (int i = 0; i < subTracks.Length; i++) { Console.WriteLine("SubTrack[{0}] has {1} members", i, subTracks[i].Count()); // print the members of subTracks[i] foreach (Track t_subTrack in subTracks[i]) { if (t_subTrack != null) { Console.WriteLine("\tTrack[{0}]", t_subTrack.getID()); } } } } // retroactively removes track[t_ID] when it clears out the data of t_TG and then doesn't add it back into other groups public bool removeTrack(int t_ID) // find and remove track by track ID { // first get the trackgroup that t_ID is a part of TrackGroup t_TG = searchForContainingTrackGroup(t_ID); // a valid TrackGroup if found, null if not found // check to see if t_TG is valid if (t_TG != null) { // now get the Track and its neighbors Track t_Track = t_TG.getTrackByID(t_ID); Track[] t_Neighbors = new Track[t_Track.getNumNeighbors()]; int[] t_TrackNeighborIDs = t_Track.getNeighbors(); // populate t_Neighbors for (int i = 0; i < t_TrackNeighborIDs.Length; i++) { t_Neighbors[i] = t_TG.getTrackByID(t_TrackNeighborIDs[i]); } // remove references between t_Track and t_Neighbors foreach (Track T in t_Neighbors) // not removing neighbors properly { T.removeNeighbor(t_Track.getID()); t_Track.removeNeighbor(T.getID()); //T.removeNeighbor(T.getID()); } // get a list of subtracks List<Track>[] subTracks = TrackIterator.findBrokenPaths(t_TG, t_Neighbors); // if subTracks for some reason == null then end this method if (subTracks == null) { return false; }// otherwise just continue as normal // print subTracks list printSubTracks(subTracks); // since we have our list of subtracks, check if the number of subtracks is > 1; if so then empty t_TG and discard it // so we can populate it anew as well as any other empty TrackGroups first if (subTracks.Length > 1) { t_TG.clearList(); // now that t_TG is clear we can start on populating everything for (int i = 0; i < subTracks.Length; i++) {// iterate through each subTracks list; try to find an empty list to populate or, failing that, create a new one to populate bool foundEmpty = false; // first, look through TG_List to find an empty list foreach (TrackGroup t__TG in TG_List) { if (t__TG.getNumMembers() == 0) // empty list found! { // now iterate through subTracks[i] Track members and push them into t__TG foreach (Track t__Track in subTracks[i]) { // make sure that they are not adding in Track[t_ID] while going through this if (t__Track.getID() != t_ID) { t__TG.addTrack(t__Track); } } // we have found an empty one so no need to keep searching foundEmpty = true; break; } } // if we are unable to find an empty TrackGroup we need to make one if (!foundEmpty) { TG_List.Add(new TrackGroup(subTracks[i])); // automatically populates TrackGroup // need to remove Track[t_ID] from this new TrackGroup //Track vt_Track = TG_List.Last().getTrackByID(t_ID); //TG_List.Last().removeTrack(vt_Track); } } }// otherwise do nothing else and no tracks have to be moved around so go ahead and exit by returning True return true; } else { Console.WriteLine("Track[{0}] Not found!", t_ID); return false; // in this case the t_ID is not found } } public bool addTrack(float[] xyz, float[] abc) { // Create a dummy Track object to place into a TrackGroup Track dummy = new Track(xyz, abc), cullTrack; // Iterator that is incremented whenever the dummy track fulfulls the requirements to be added to a TrackGroup int numValidConnections = 0; float maxDistance = 1.2f; // used as first cull value List<Track> TG_F_CullIDs = new List<Track>(); // See if this dummy track can connect to any locations within any TrackGroups in TG_List foreach (TrackGroup TG in TG_List){ // disregard any TG that has zero members //Console.WriteLine("TG.getNumMembers = {0}", TG.getNumMembers()); if (TG.getNumMembers() > 0) // only do something with TG if it has at least 1 member { // some crap to cull out any TGs that are far away ( distance > maxDistance from any/all members) cullTrack = (TG.getClosestMember(dummy, maxDistance)); // just add the IDs to the list to make things easier if (cullTrack != null) { //Console.WriteLine("cullTrack = {0}", cullTrack.getID()); TG_F_CullIDs.Add(cullTrack); } } } // now that TG_F_CullIDs has been populated, if it has been populated that is, now check to see if dummy track can connect to any // of the Tracks in TG_F_CullIDs foreach (Track i in TG_F_CullIDs) { // for now let's just say that if the item is in TG_F_CullIDs then it is a valid connection numValidConnections++; } //Console.WriteLine("numValidConnections = {0}", numValidConnections); //Console.WriteLine("TG_F_CullIDs.Count = {0}", TG_F_CullIDs.Count()); if (numValidConnections == 0) { // try to find a TrackGroup with 0 members, if none are found then create new foreach (TrackGroup TG in TG_List) { if (TG.getNumMembers() == 0) { TG.addTrack(dummy); return true; // easy way to scoot out of this section quickly } } // if no empty track group is found, create a new one! TG_List.Add(new TrackGroup(new Track(dummy))); return true; } else // there are valid connections, now just need to figure out how to work them in together { // print out all connecting IDs /* foreach (Track T in TG_F_CullIDs) { Console.WriteLine("\tConnection: Track[{0}]", T.getID()); } Console.WriteLine(); */ if (numValidConnections == 1) { foreach (TrackGroup TG in TG_List) { // for each TrackGroup in the TrackGroup list search for the first valid connection in TG_F_CullIDs if (TG.contains(TG_F_CullIDs.ElementAt(0))) { dummy.addNeighbor(TG_F_CullIDs.ElementAt(0).getID()); TG_F_CullIDs.ElementAt(0).addNeighbor(dummy.getID()); TG.addTrack(dummy); } } } else { // now to figure out which TrackGroups are being connected List<TrackGroup> TrackGroupConnectionSet = new List<TrackGroup>(); foreach (TrackGroup TG in TG_List) { foreach (Track T in TG_F_CullIDs) { if (TG.contains(T)) { TrackGroupConnectionSet.Add(TG); break; // makes sure that a TrackGroup is only added to the ConnectionSet once } } } foreach (Track T in TG_F_CullIDs) { dummy.addNeighbor(T.getID()); T.addNeighbor(dummy.getID()); } foreach (TrackGroup TG in TrackGroupConnectionSet) { if (TG == TrackGroupConnectionSet.ElementAt(0)) { continue; // skip the first group because it will always be the lowest index TrackGroup } else { TrackGroupConnectionSet.ElementAt(0).merge(TG.getAllTracks()); TG.clearList(); } } TrackGroupConnectionSet.ElementAt(0).addTrack(dummy); } return false; } } public void printItems(bool groups, bool tracks) { Console.WriteLine("TRACKMANAGER (TMAN) Member List"); Console.WriteLine("\tShow Groups: " + groups); Console.WriteLine("\tShow Tracks: " + tracks); foreach (TrackGroup TG in TG_List) { if (groups) { Console.Write("TrackGroup[{0}] has {1} Tracks\n", TG.getID(), TG.getNumMembers()); } if (tracks){ TG.printMembers(); } } } } }
100-degrees-celsius
MC_AI_002/MC_AI_002/TrackManager.cs
C#
gpl3
12,748
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace MC_AI_002 { /* TrackGroup objects contain Track objects that are connected to each other in a single unified piece */ // funtionality to be added in next step: adding neighbor chains, destroying neighbor chains // step + 1 functionality: remove tracks, see if it causes a continuity problem, splitting group into multiple groups class TrackGroup { /* Private variable declarations */ private static int S_ID = 0; private int m_ID; private List<Track> T_List; public TrackGroup() { m_ID = S_ID++; T_List = new List<Track>(); //Console.Write("\tNew TrackGroup["+m_ID+"] added!\n"); } public TrackGroup(Track firstMember) { m_ID = S_ID++; T_List = new List<Track>(); //Console.Write("\tNew TrackGroup["+m_ID+"] added!\n"); this.addTrack(firstMember); } public TrackGroup(List<Track> allMembers) { m_ID = S_ID++; T_List = allMembers; } public int getNumMembers() { try { return T_List.Count(); // attempt to return the count } catch (System.ArgumentNullException) // if the count = 0 or T_List == null then return 0 { return 0; } } public void removeTrack(Track t) { Console.WriteLine("Attempting to remove Track[{0}] from TrackGroup[{1}]", t.getID(), this.getID()); T_List.Remove(t); if (this.contains(t)) { Console.WriteLine("\tRemoval of Track[{0}] from TrackGroup[{1}] failed", t.getID(), this.getID()); Console.Write("\tTrying again but by index..."); // get index of t int index_t = T_List.IndexOf(t); Console.Write("Track[{0}]...", index_t); if (index_t >= 0 && index_t < T_List.Count()) { T_List.RemoveAt(index_t); } if (this.contains(t)) { Console.Write("Failed"); } else { Console.Write("Success"); } Console.WriteLine(); } else { Console.WriteLine("\tRemoval of Track[{0}] from TrackGroup[{1}] succeeded", t.getID(), this.getID()); } } public void addTrack(Track t) { // make sure that track t is not null if (t != null) { T_List.Add(new Track(t)); } } public Track getClosestMember(Track testTrack, float maxDistance) { if (getNumMembers() > 0) { float distance = 0.0f, pDistance = 0.0f; int firstID = T_List.First().getID(); int bestID = firstID; Track retTrack = null; float[] t_coord = testTrack.getCoords(), m_coord; foreach (Track t in T_List) { m_coord = t.getCoords(); if (t.getID() == firstID) { pDistance = getDistance(t_coord, m_coord); retTrack = t; // here just in case the firstID is also the lastID } else { distance = getDistance(t_coord, m_coord); if (pDistance > distance) { pDistance = distance; bestID = t.getID(); retTrack = t; } } } //Console.WriteLine("Max Distance = {0} ; Best Distance = {1}; Best ID = {2}", maxDistance, pDistance,bestID); //Console.WriteLine("Best Distance <= Max Distance = {0}", pDistance <= maxDistance); if (pDistance <= maxDistance) { //Console.WriteLine("returnTrack.ID = {0}", retTrack.getID()); return retTrack; } else { return null; } } else { return null; } } public float getDistance(float[] a, float[] b) { return (float)Math.Sqrt((a[0] - b[0]) * (a[0] - b[0]) + (a[1] - b[1]) * (a[1] - b[1]) + (a[2] - b[2]) * (a[2] - b[2])); } public int getID() { return m_ID; } public bool contains(Track track) { foreach (Track T in T_List) { if (T.isEqual(track)) { return true; } } return false; } public bool contains(int trackID) // looks for trackID amongst its lists { foreach (Track T in T_List) { if (T.getID() == trackID) { return true; } } return false; } public Track getTrackByID(int trackID) { foreach (Track T in T_List){ if (T.getID() == trackID) { return T; } } return null; // should never happen if contains(trackID) is done before this one } public void printMembers() { foreach (Track T in T_List) { Console.Write("\tTrack[{0}] has {1} Neighbors\n",T.getID(),T.getNumNeighbors()); T.printNeighbors(); } } public List<Track> getAllTracks() { return T_List; } public void merge(List<Track> newItems) { foreach (Track T in newItems){ this.addTrack(T); } } public void clearList() { T_List.Clear(); } } }
100-degrees-celsius
MC_AI_002/MC_AI_002/TrackGroup.cs
C#
gpl3
6,479
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("MC_AI_002")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("MC_AI_002")] [assembly: AssemblyCopyright("Copyright © 2012")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("cbde1266-3dae-45ce-8c17-8d7a45e927e6")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
100-degrees-celsius
MC_AI_002/MC_AI_002/Properties/AssemblyInfo.cs
C#
gpl3
1,394
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace MC_AI_002 { class Track { private static int S_ID = 0; private int m_ID; private float[] m_Coord, m_Rot; private List<int> m_Neighbors; // a list of neighboring tracks' IDs public Track(Track dummyTrack) { this.m_ID = dummyTrack.m_ID; this.m_Coord = dummyTrack.m_Coord; this.m_Rot = dummyTrack.m_Rot; this.m_Neighbors = dummyTrack.m_Neighbors; //Console.Write("\t\tTrack[" + m_ID + "] created from DummyTrack[" + m_ID + "]\n"); } public Track(float[] xyz, float[] abc) { m_ID = S_ID++; m_Coord = xyz; m_Rot = abc; m_Neighbors = new List<int>(); //Console.Write("\t\tTrack[" + m_ID + "] Created\n"); } public float[] getCoords() { return m_Coord; } public float[] getRot() { return m_Rot; } public int getID() { return m_ID; } // m_Neighbors is used to create track chains that are easy to follow public void addNeighbor(int n_ID) { m_Neighbors.Add(n_ID); //Console.WriteLine("Track[{0}] has added Track[{1}] to its list of neighbors.", m_ID, n_ID); } public bool removeNeighbor(int n_ID) { return m_Neighbors.Remove(n_ID); // returns true if the neighbor ID existed and is now removed; false if the ID cannot be found } public int getNumNeighbors() { return m_Neighbors.Count(); } public int[] getNeighbors() { return m_Neighbors.ToArray(); } public void printNeighbors() { foreach (int id in m_Neighbors) { Console.WriteLine("\t\tNeighbor: Track[{0}]", id); } } public bool isEqual(Track t_Track) { try { return (t_Track.getID() == this.m_ID) && (t_Track.getCoords() == this.m_Coord) && (t_Track.getRot() == this.m_Rot); } catch (NullReferenceException) { return false; } } } }
100-degrees-celsius
MC_AI_002/MC_AI_002/Track.cs
C#
gpl3
2,432
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace MC_AI_002 { class Program { static void Main(string[] args) { OperationTimer.initialize(); List<int> tc = new List<int>(); tc.Add(Environment.TickCount); TrackManager tman = new TrackManager(); OperationTimer.Start(); for (int i = 0; i < 5; i++) { tman.addTrack(new float[] { (float)(i), 0, 0 }, new float[] { 0, 0, 0 }); } OperationTimer.End(); //OperationTimer.flush(); OperationTimer.Start(); for (int i = 0; i < 5; i++) { tman.addTrack(new float[] { (float)(i), 2, 0 }, new float[] { 0, 0, 0 }); } OperationTimer.End(); //OperationTimer.flush(); OperationTimer.Start(); for (int i = 0; i < 5; i++) { tman.addTrack(new float[] { -1, (float)(i), 0 }, new float[] { 0, 0, 0 }); } OperationTimer.End(); //OperationTimer.flush(); /* Track as it looks like now * -1 0 1 2 3 4 5 6 7 8 9 * 9 x * 8 x * 7 x * 6 x * 5 x * 4 x * 3 x * 2 x x x x x x * 1 x * 0 x x x x x x x x x x x */ tc.Add( Environment.TickCount); //tman.printItems(true, true); //tc_start = Environment.TickCount; OperationTimer.Start(); tman.removeTrack(12); OperationTimer.End(); tc.Add( Environment.TickCount); tman.printItems(true, true); List<int> sub = new List<int>(); for (int t = 1; t < tc.Count; t++) { sub.Add(tc.ElementAt(t) - tc.ElementAt(t - 1)); } foreach (int t in sub) { Console.WriteLine("Elapsed time in ms: {0}", t); } //tman.removeTrack(12); // attempt to remove again to test failure to find: SUCCESSFUL Console.ReadKey(); OperationTimer.flush(); Console.ReadKey(); } } }
100-degrees-celsius
MC_AI_002/MC_AI_002/Program.cs
C#
gpl3
2,523
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace MC_AI_002 { // static class that will store up start and stop times until the entries are printed, then it flushes the timer memory static class OperationTimer { static List<int> timeStart, timeEnd; static int starts = 0, ends = 0; static public void initialize() { timeStart = new List<int>(); timeEnd = new List<int>(); } static public void Start() { timeStart.Add(Environment.TickCount); starts++; } static public void End() { timeEnd.Add(Environment.TickCount); ends++; } // prints all start and corresponding end times, then resets all values static public void flush() { if (starts == ends) {// all starts have an end for (int i = 0; i < starts; i++) { Console.WriteLine("i = {0}: dT = {1}",i, timeEnd.ElementAt(i) - timeStart.ElementAt(i)); if (i != 0 && i % 10 == 0) { Console.WriteLine("\tPress any key to continue list"); Console.ReadKey(); Console.Clear(); } } } starts = 0; ends = 0; timeStart.Clear(); timeEnd.Clear(); } } }
100-degrees-celsius
MC_AI_002/MC_AI_002/OperationTimer.cs
C#
gpl3
1,536
\relax \@writefile{toc}{\contentsline {section}{\numberline {Aufgabe 3}Test A3}{3}} \@writefile{toc}{\contentsline {subsection}{\numberline {Aufgabe 3.1}}{3}} \@writefile{toc}{\contentsline {subsection}{\numberline {Aufgabe 3.2}}{4}} \@writefile{toc}{\contentsline {subsection}{\numberline {Aufgabe 3.3}}{5}} \@setckpt{A3}{ \setcounter{page}{6} \setcounter{equation}{0} \setcounter{enumi}{0} \setcounter{enumii}{0} \setcounter{enumiii}{0} \setcounter{enumiv}{0} \setcounter{footnote}{0} \setcounter{mpfootnote}{0} \setcounter{part}{0} \setcounter{section}{3} \setcounter{subsection}{3} \setcounter{subsubsection}{0} \setcounter{paragraph}{0} \setcounter{subparagraph}{0} \setcounter{figure}{0} \setcounter{table}{0} \setcounter{lstnumber}{1} \setcounter{lstlisting}{0} }
0x00f
Übung 2/A3.aux
TeX
gpl3
797
\section{Test A3} \def\firstcircle{(0,0) circle (1)} \def\secondcircle{(1,0) circle (1)} \def\thirdcircle{(0.5,-0.866025) circle (1)} %Aufgabe a \subsection{} \begin{tikzpicture}[fill=gray] % A^B \scope \clip \secondcircle; \fill \firstcircle; \endscope % A^C \scope \clip \thirdcircle; \fill \firstcircle; \endscope % outline \draw \firstcircle (0,1) node [text=black,above] {$A$} \secondcircle (1,1) node [text=black,above] {$B$} \thirdcircle (0.5,-1.866025) node [text=black,below] {$C$} (-2,-3) rectangle (3,2) node [text=black,above] {$U$}; \end{tikzpicture} \begin{displaymath} \begin{center} Es gilt zu beweisen: $A\cap{}(B\cup{}C) = (A\cap{}B)\cup{}(A\cap{}C)$ \end{center} \begin{array}{ll} B\cup{}C & = \{x\in{}U|(x\in{}B)\vee{}(x\in{}C)\} \\ A\cap{}(B\cup{}C) & = \{x\in{}U|(x\in{}A)\wedge{}((x\in{}B)\vee{}(x\in{}C))\} \\ A\cap{}B & = \{x\in{}U|(x\in{}A)\wedge{}(x\in{}B)\} \\ A\cap{}C & = \{x\in{}U|(x\in{}A)\wedge{}(x\in{}C)\} \\ (A\cap{}B)\cup{}(A\cap{}C) & = \{x\in{}U|((x\in{}A)\wedge{}(x\in{}B))\vee{}((x\in{}A)\wedge{}(x\in{}C))\} \\ \end{array} \end{displaymath} \begin{displaymath} \begin{array}{|c|c|c||c|c|c|c|c|} \hline A & B & C & B\vee{}C & A\wedge{}(B\vee{}C) & A\wedge{}B & A\wedge{}C & (A\wedge{}B)\vee{}(A\wedge{}C) \\ \hline \hline 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 \\ 1 & 1 & 0 & 1 & 1 & 1 & 0 & 1 \\ 1 & 0 & 1 & 1 & 1 & 0 & 1 & 1 \\ 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ \hline 0 & 1 & 1 & 1 & 0 & 0 & 0 & 0 \\ 0 & 1 & 0 & 1 & 0 & 0 & 0 & 0 \\ 0 & 0 & 1 & 1 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ \hline \end{array} \end{displaymath} Da alle Aussagen in $A\wedge{}(B\vee{}C)$ und $(A\wedge{}B)\vee{}(A\wedge{}C)$ immer zusammen WAHR oder FALSCH sind, gilt $A\cap{}(B\cup{}C) = (A\cap{}B)\cup{}(A\cap{}C)$ %Aufgabe b \subsection{} \begin{tikzpicture}[fill=gray] %A \scope \clip (-2,-3) rectangle (3,2); \fill \firstcircle; \endscope % A^B \scope \clip \secondcircle; \fill \firstcircle; \endscope % A^C \scope \clip \thirdcircle; \fill \firstcircle; \endscope % B^C \scope \clip \thirdcircle; \fill \secondcircle; \endscope % outline \draw \firstcircle (0,1) node [text=black,above] {$A$} \secondcircle (1,1) node [text=black,above] {$B$} \thirdcircle (0.5,-1.866025) node [text=black,below] {$C$} (-2,-3) rectangle (3,2) node [text=black,above] {$U$}; \end{tikzpicture} \begin{displaymath} \begin{center} Es gilt zu beweisen: $A\cup{}(B\cap{}C) = (A\cup{}B)\cap{}(A\cap{}C)$ \end{center} \begin{array}{ll} B\cap{}C & = \{x\in{}U|(x\in{}B)\wedge{}(x\in{}C)\} \\ A\cup{}(B\cap{}C) & = \{x\in{}U|(x\in{}A)\vee{}((x\in{}B)\wedge{}(x\in{}C))\} \\ A\cup{}B & = \{x\in{}U|(x\in{}A)\vee{}(x\in{}B)\} \\ A\cap{}C & = \{x\in{}U|(x\in{}A)\wedge{}(x\in{}C)\} \\ (A\cup{}B)\cap{}(A\cap{}C) & = \{x\in{}U|((x\in{}A)\vee{}(x\in{}B))\wedge{}((x\in{}A)\wedge{}(x\in{}C))\} \\ \end{array} \end{displaymath} \begin{displaymath} \begin{array}{|c|c|c||c|c|c|c|c|} \hline A & B & C & B\wedge{}C & A\vee{}(B\wedge{}C) & A\vee{}B & A\wedge{}C & (A\vee{}B)\wedge{}(A\wedge{}C) \\ \hline \hline 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 \\ 1 & 1 & 0 & 0 & 1 & 1 & 0 & 0 \\ 1 & 0 & 1 & 0 & 1 & 1 & 1 & 1 \\ 1 & 0 & 0 & 0 & 1 & 1 & 0 & 0 \\ \hline 0 & 1 & 1 & 1 & 1 & 1 & 0 & 0 \\ 0 & 1 & 0 & 0 & 0 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ \hline \end{array} \end{displaymath} \begin{displaymath} \begin{array}{ll} A\cup{}C & = \{x\in{}U|(x\in{}A)\vee{}(x\in{}C)\} \\ (A\cup{}B)\cap{}(A\cup{}C) & = \{x\in{}U|((x\in{}A)\vee{}(x\in{}B))\wedge{}((x\in{}A)\vee{}(x\in{}C))\} \\ \end{array} \end{displaymath} \begin{displaymath} \begin{array}{|c|c|c||c|c|c|} \hline A & B & C & A\vee{}B & A\vee{}C & (A\vee{}B)\wedge{}(A\vee{}C) \\ \hline \hline 1 & 1 & 1 & 1 & 1 & 1 \\ 1 & 1 & 0 & 1 & 1 & 1 \\ 1 & 0 & 1 & 1 & 1 & 1 \\ 1 & 0 & 0 & 1 & 1 & 1 \\ \hline 0 & 1 & 1 & 1 & 1 & 1 \\ 0 & 1 & 0 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 & 1 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 \\ \hline \end{array} \end{displaymath} Da die Aussagen in $A\vee{}(B\wedge{}C)$ und $(A\vee{}B)\wedge{}(A\wedge{}C)$ unterschiedlich WAHR oder FALSCH sind, gilt $A\cup{}(B\cap{}C) \neq{} (A\cup{}B)\cap{}(A\cap{}C)$. Stattdessen gilt aber $A\cup{}(B\cap{}C) = (A\cup{}B)\cap{}(A\cup{}C)$, da alle Aussagen in $A\vee{}(B\wedge{}C)$ und $(A\vee{}B)\wedge{}(A\vee{}C)$ immer zusammen WAHR oder FALSCH sind. %Aufgabe c. \subsection{} \begin{tikzpicture}[fill=gray] % U \scope \fill (-2,-2) rectangle (3,2); \endscope % A \scope \fill[white] \firstcircle; \endscope % B \scope \fill[white] \secondcircle; \endscope % outline \draw \firstcircle (0,1) node [text=black,above] {$A$} \secondcircle (1) (1,1) node [text=black,above] {$B$} (-2,-2) rectangle (3,2) node [text=black,above] {$H$}; \end{tikzpicture} \begin{displaymath} \begin{center} Es gilt zu beweisen: $(A\cup{})^{C} = A^{C}\cap{}B^{C}$ \end{center} \begin{array}{ll} B\cup{}C & = \{x\in{}U|(x\in{}B)\vee{}(x\in{}C)\} \\ A\cap{}(B\cup{}C) & = \{x\in{}U|(x\in{}A)\wedge{}((x\in{}B)\vee{}(x\in{}C))\} \\ A\cap{}B & = \{x\in{}U|(x\in{}A)\wedge{}(x\in{}B)\} \\ A\cap{}C & = \{x\in{}U|(x\in{}A)\wedge{}(x\in{}C)\} \\ (A\cap{}B)\cup{}(A\cap{}C) & = \{x\in{}U|((x\in{}A)\wedge{}(x\in{}B))\vee{}((x\in{}A)\wedge{}(x\in{}C))\} \\ \end{array} \end{displaymath} \begin{displaymath} \begin{array}{|c|c|c||c|c|c|c|c|} \hline A & B & C & B\vee{}C & A\wedge{}(B\vee{}C) & A\wedge{}B & A\wedge{}C & (A\wedge{}B)\vee{}(A\wedge{}C) \\ \hline \hline 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 \\ 1 & 1 & 0 & 1 & 1 & 1 & 0 & 1 \\ 1 & 0 & 1 & 1 & 1 & 0 & 1 & 1 \\ 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ \hline 0 & 1 & 1 & 1 & 0 & 0 & 0 & 0 \\ 0 & 1 & 0 & 1 & 0 & 0 & 0 & 0 \\ 0 & 0 & 1 & 1 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ \hline \end{array} \end{displaymath} Da alle Aussagen in $A\wedge{}(B\vee{}C)$ und $(A\wedge{}B)\vee{}(A\wedge{}C)$ immer zusammen WAHR oder FALSCH sind, gilt $A\cap{}(B\cup{}C) = (A\cap{}B)\cup{}(A\cap{}C)$
0x00f
Übung 2/A3.tex
TeX
gpl3
6,173
\relax \@setckpt{A2.tex}{ \setcounter{page}{3} \setcounter{equation}{0} \setcounter{enumi}{0} \setcounter{enumii}{0} \setcounter{enumiii}{0} \setcounter{enumiv}{0} \setcounter{footnote}{0} \setcounter{mpfootnote}{0} \setcounter{part}{0} \setcounter{section}{1} \setcounter{subsection}{0} \setcounter{subsubsection}{0} \setcounter{paragraph}{0} \setcounter{subparagraph}{0} \setcounter{figure}{0} \setcounter{table}{0} \setcounter{lstnumber}{1} \setcounter{lstlisting}{0} }
0x00f
Übung 2/A2.tex.aux
TeX
gpl3
495
\relax \@setckpt{A1.tex}{ \setcounter{page}{2} \setcounter{equation}{0} \setcounter{enumi}{0} \setcounter{enumii}{0} \setcounter{enumiii}{0} \setcounter{enumiv}{0} \setcounter{footnote}{0} \setcounter{mpfootnote}{0} \setcounter{part}{0} \setcounter{section}{0} \setcounter{subsection}{0} \setcounter{subsubsection}{0} \setcounter{paragraph}{0} \setcounter{subparagraph}{0} \setcounter{figure}{0} \setcounter{table}{0} \setcounter{lstnumber}{1} \setcounter{lstlisting}{0} }
0x00f
Übung 2/A1.tex.aux
TeX
gpl3
495
\section{} \subsection{} \begin{displaymath} \begin{array}{|c|c|c|c|c|} \hline A & B & A\land{}B & (\lnot{}A\lor{}\lnot{}B) & \lnot{}(\lnot{}A\lor{}\lnot{}B) \\ \hline \hline 0 & 0 & 0 & 1 & 0 \\ 0 & 1 & 0 & 1 & 0 \\ 1 & 0 & 0 & 1 & 0 \\ 1 & 1 & 1 & 0 & 1 \\ \hline \end{array} \end{displaymath} \\ \begin{displaymath} \begin{array}{|c|c|c|c|} \hline A & B & A\Rightarrow{}B & \lnot{}A\lor{}B \\ \hline \hline 0 & 0 & 1 & 1 \\ 0 & 1 & 1 & 1 \\ 1 & 0 & 0 & 0 \\ 1 & 1 & 1 & 1 \\ \hline \end{array} \end{displaymath} \\ \begin{displaymath} \begin{array}{|c|c|c|c|} \hline A & B & A\Leftrightarrow{}B & \lnot{}(\lnot{}A\lor{}\lnot{}B)\lor{}\lnot{}(A\lor{}B) \\ \hline \hline 0 & 0 & 1 & 1 \\ 0 & 1 & 0 & 0 \\ 1 & 0 & 0 & 0 \\ 1 & 1 & 1 & 1 \\ \hline \end{array} \end{displaymath} \\ \subsection{a} \begin{displaymath} \begin{array}{|c|c|c|} \hline A & B & \lnot{}(A\lor{}B) \\ \hline \hline 0 & 0 & 1 \\ 0 & 1 & 0 \\ 1 & 0 & 0 \\ 1 & 1 & 0 \\ \hline \end{array} \end{displaymath} \\ \subsection{b}
0x00f
Übung 2/A2.tex
TeX
gpl3
1,020
\relax \@writefile{toc}{\contentsline {section}{\numberline {Aufgabe 1}Test A1}{2}} \@setckpt{A1}{ \setcounter{page}{3} \setcounter{equation}{0} \setcounter{enumi}{0} \setcounter{enumii}{0} \setcounter{enumiii}{0} \setcounter{enumiv}{0} \setcounter{footnote}{0} \setcounter{mpfootnote}{0} \setcounter{part}{0} \setcounter{section}{1} \setcounter{subsection}{0} \setcounter{subsubsection}{0} \setcounter{paragraph}{0} \setcounter{subparagraph}{0} \setcounter{figure}{0} \setcounter{table}{0} \setcounter{lstnumber}{1} \setcounter{lstlisting}{0} }
0x00f
Übung 2/A1.aux
TeX
gpl3
569
\relax \@writefile{toc}{\contentsline {section}{\numberline {Aufgabe 2}}{2}} \@writefile{toc}{\contentsline {subsection}{\numberline {Aufgabe 2.1}}{2}} \@writefile{toc}{\contentsline {subsection}{\numberline {Aufgabe 2.2}a}{2}} \@writefile{toc}{\contentsline {subsection}{\numberline {Aufgabe 2.3}b}{2}} \@setckpt{A2}{ \setcounter{page}{3} \setcounter{equation}{0} \setcounter{enumi}{0} \setcounter{enumii}{0} \setcounter{enumiii}{0} \setcounter{enumiv}{0} \setcounter{footnote}{0} \setcounter{mpfootnote}{0} \setcounter{part}{0} \setcounter{section}{2} \setcounter{subsection}{3} \setcounter{subsubsection}{0} \setcounter{paragraph}{0} \setcounter{subparagraph}{0} \setcounter{figure}{0} \setcounter{table}{0} \setcounter{lstnumber}{1} \setcounter{lstlisting}{0} }
0x00f
Übung 2/A2.aux
TeX
gpl3
792
\relax \@setckpt{A3.tex}{ \setcounter{page}{3} \setcounter{equation}{0} \setcounter{enumi}{0} \setcounter{enumii}{0} \setcounter{enumiii}{0} \setcounter{enumiv}{0} \setcounter{footnote}{0} \setcounter{mpfootnote}{0} \setcounter{part}{0} \setcounter{section}{1} \setcounter{subsection}{0} \setcounter{subsubsection}{0} \setcounter{paragraph}{0} \setcounter{subparagraph}{0} \setcounter{figure}{0} \setcounter{table}{0} \setcounter{lstnumber}{1} \setcounter{lstlisting}{0} }
0x00f
Übung 2/A3.tex.aux
TeX
gpl3
495
\relax \catcode`"\active \select@language{ngerman} \@writefile{toc}{\select@language{ngerman}} \@writefile{lof}{\select@language{ngerman}} \@writefile{lot}{\select@language{ngerman}} \@input{A4.aux}
0x00f
Übung 2/Gesamtdoku.aux
TeX
gpl3
207
\section{Test A4} \begin{tikzpicture}[fill=gray] % left hand \scope \clip (-2,-2) rectangle (2,2) (1,0) circle (1); \fill (0,0) circle (1); \endscope % right hand \scope \clip (-2,-2) rectangle (2,2) (0,0) circle (1); \fill (1,0) circle (1); \endscope % outline \draw (0,0) circle (1) (0,1) node [text=black,above] {$1$} (1,0) circle (1) (1,1) node [text=black,above] {$2$} (-2,-2) rectangle (3,2); \end{tikzpicture}
0x00f
Übung 2/A4.tex
TeX
gpl3
443
\section{} \subsection{} \begin{displaymath} \begin{array}{|c|c||c|c|c|c|} \hline A & B & \lnot{}A & (\lnot{}A)\lor{}B & A\Rightarrow{}B & (A\Rightarrow{}B)\Leftrightarrow{}(\lnot{}A)\lor{}B \\ \hline \hline 0 & 0 & 1 & 1 & 1 & 1 \\ 0 & 1 & 1 & 1 & 1 & 1 \\ 1 & 0 & 0 & 0 & 0 & 1 \\ 1 & 1 & 0 & 1 & 1 & 1 \\ \hline \end{array} \end{displaymath} \begin{center} $(A\Rightarrow{}B)\Leftrightarrow{}(\lnot{}A)\lor{}B$ ist immer WAHR und daher eine Tautologie. \end{center} \subsection{} \begin{displaymath} \begin{array}{|c|c|c||c|c|c|c|c|} \hline A & B & C & A\Rightarrow{}B & B\Rightarrow{}C & ((A\Rightarrow{}B)\land{}(B\Rightarrow{}C)) & (A\Rightarrow{}C) & ((A\Rightarrow{}B)\land{}(B\Rightarrow{}C))\Rightarrow{}(A\Rightarrow{}C) \\ \hline \hline 0 & 0 & 0 & 1 & 1 & 1 & 1 & 1 \\ 0 & 0 & 1 & 1 & 1 & 1 & 1 & 1 \\ 0 & 1 & 0 & 1 & 0 & 0 & 1 & 1 \\ 0 & 1 & 1 & 1 & 1 & 1 & 1 & 1 \\ \hline 1 & 0 & 0 & 0 & 1 & 0 & 0 & 1 \\ 1 & 0 & 1 & 0 & 1 & 0 & 1 & 1 \\ 1 & 1 & 0 & 1 & 0 & 0 & 0 & 1 \\ 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 \\ \hline \end{array} \end{displaymath} \begin{center} $((A\Rightarrow{}B)\land{}(B\Rightarrow{}C))\Rightarrow{}(A\Rightarrow{}C)$ ist immer WAHR und daher eine Tautologie. \end{center}
0x00f
Übung 2/A1.tex
TeX
gpl3
1,226
\relax \@setckpt{A4.tex}{ \setcounter{page}{3} \setcounter{equation}{0} \setcounter{enumi}{0} \setcounter{enumii}{0} \setcounter{enumiii}{0} \setcounter{enumiv}{0} \setcounter{footnote}{0} \setcounter{mpfootnote}{0} \setcounter{part}{0} \setcounter{section}{1} \setcounter{subsection}{0} \setcounter{subsubsection}{0} \setcounter{paragraph}{0} \setcounter{subparagraph}{0} \setcounter{figure}{0} \setcounter{table}{0} \setcounter{lstnumber}{1} \setcounter{lstlisting}{0} }
0x00f
Übung 2/A4.tex.aux
TeX
gpl3
495
\documentclass{pi1} \usepackage{url} \usepackage{tikz} \begin{document} \maketitle{2}{06.11.2012}{Sebastian Offermann}{11}{Tim Godthardt}{Liliana Dargel}{Michael Schulze} %\input{A1} %\include{A2} %\include{A3} \include{A4} \end{document}
0x00f
Übung 2/Gesamtdoku.tex
TeX
gpl3
242
\relax \@writefile{toc}{\contentsline {section}{\numberline {Aufgabe 1}Test A4}{2}} \@setckpt{A4}{ \setcounter{page}{3} \setcounter{equation}{0} \setcounter{enumi}{0} \setcounter{enumii}{0} \setcounter{enumiii}{0} \setcounter{enumiv}{0} \setcounter{footnote}{0} \setcounter{mpfootnote}{0} \setcounter{part}{0} \setcounter{section}{1} \setcounter{subsection}{0} \setcounter{subsubsection}{0} \setcounter{paragraph}{0} \setcounter{subparagraph}{0} \setcounter{figure}{0} \setcounter{table}{0} \setcounter{lstnumber}{1} \setcounter{lstlisting}{0} }
0x00f
Übung 2/A4.aux
TeX
gpl3
569
package gibbs.seibert.CS406.VideoGameApp; import org.xml.sax.Attributes; import org.xml.sax.SAXException; import org.xml.sax.helpers.DefaultHandler; public class MyXMLHandler extends DefaultHandler { Boolean currentElement = false; String currentValue = null; public static SitesList sitesList = null; public static SitesList getSitesList() { return sitesList; } public static void setSitesList(SitesList sitesList) { MyXMLHandler.sitesList = sitesList; } /** * Called when tag starts ( ex:- <name>AndroidPeople</name> -- <name> ) */ @Override public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { currentElement = true; if (localName.equals("results")) { /** Start */ sitesList = new SitesList(); } else if (localName.equals("game")) { /** Get attribute value */ String attr = attributes.getValue("category"); sitesList.setCategory(attr); } } /** * Called when tag closing ( ex:- <name>AndroidPeople</name> -- </name> ) */ @Override public void endElement(String uri, String localName, String qName) throws SAXException { currentElement = false; /** set value */ if (localName.equalsIgnoreCase("game")) sitesList.setName(currentValue); else if (localName.equalsIgnoreCase("name")) sitesList.setWebsite(currentValue); } /** * Called to get tag characters ( ex:- <name>AndroidPeople</name> -- to get * AndroidPeople Character ) */ @Override public void characters(char[] ch, int start, int length) throws SAXException { if (currentElement) { currentValue = new String(ch, start, length); currentElement = false; } } }
0skillz63-test123
src/gibbs/seibert/CS406/VideoGameApp/MyXMLHandler.java
Java
gpl3
1,760
package gibbs.seibert.CS406.VideoGameApp; import java.util.ArrayList; /** Contains getter and setter method for variables */ public class SitesList { /** Variables */ private ArrayList<String> name = new ArrayList<String>(); private ArrayList<String> website = new ArrayList<String>(); private ArrayList<String> category = new ArrayList<String>(); /** * In Setter method default it will return arraylist change that to add */ public ArrayList<String> getName() { return name; } public void setName(String name) { this.name.add(name); } public ArrayList<String> getWebsite() { return website; } public void setWebsite(String website) { this.website.add(website); } public ArrayList<String> getCategory() { return category; } public void setCategory(String category) { this.category.add(category); } }
0skillz63-test123
src/gibbs/seibert/CS406/VideoGameApp/SitesList.java
Java
gpl3
885
package gibbs.seibert.CS406.VideoGameApp; import java.net.URL; import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; import org.xml.sax.InputSource; import org.xml.sax.XMLReader; import android.app.Activity; import android.os.Bundle; import android.widget.LinearLayout; import android.widget.TextView; public class MainActivity extends Activity { static final String RESPONSE = "reponse"; static final String ERROR = "error"; static final String LIMIT = "limit"; static final String PAGE_RESULTS = "page_results"; static final String TOTAL_RESULTS = "total_results"; static final String OFFSET = "offset"; static final String RESULTS = "results"; static final String GAME = "game"; static final String ID = "id"; static final String NAME = "name"; static final String RELEASE_DATE = "release_date"; static final String STATUS_CODE = "status_code"; // static final String RELEASE_MONTH = "release_month"; // static final String RELEASE_QUARTER = "release_month"; // static final String RELEASE_YEAR = "release_month"; /** Create Object For SiteList Class */ SitesList sitesList = null; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); /** Create a new layout to display the view */ LinearLayout layout = new LinearLayout(this); layout.setOrientation(1); /** Create a new textview array to display the results */ TextView name[]; TextView website[]; TextView category[]; try { /** Handling XML */ SAXParserFactory spf = SAXParserFactory.newInstance(); SAXParser sp = spf.newSAXParser(); XMLReader xr = sp.getXMLReader(); /** Send URL to parse XML Tags */ URL sourceUrl = new URL("http://api.giantbomb.com/games/?api_key=1619975a086e2cb970b415b36ee90c544bb2345e&field_list=name,id,original_release_date&platforms=20&format=xml"); /** Create handler to handle XML Tags ( extends DefaultHandler ) */ MyXMLHandler myXMLHandler = new MyXMLHandler(); xr.setContentHandler(myXMLHandler); xr.parse(new InputSource(sourceUrl.openStream())); } catch (Exception e) { System.out.println("XML Pasing Excpetion = " + e); } /** Get result from MyXMLHandler SitlesList Object */ sitesList = MyXMLHandler.sitesList; /** Assign textview array length by arraylist size */ name = new TextView[sitesList.getName().size()]; website = new TextView[sitesList.getName().size()]; category = new TextView[sitesList.getName().size()]; /** Set the result text in textview and add it to layout */ for (int i = 0; i < sitesList.getName().size(); i++) { name[i] = new TextView(this); name[i].setText("Name = " + sitesList.getName().get(i)); website[i] = new TextView(this); website[i].setText("Website = " + sitesList.getWebsite().get(i)); category[i] = new TextView(this); category[i].setText("Website Category = " + sitesList.getCategory().get(i)); layout.addView(name[i]); layout.addView(website[i]); layout.addView(category[i]); } /** Set the layout view to display */ setContentView(layout); } }
0skillz63-test123
src/gibbs/seibert/CS406/VideoGameApp/MainActivity.java
Java
gpl3
3,314
package com.plantplaces.service; import java.io.IOException; import java.util.ArrayList; import java.util.List; import android.content.Context; import com.plantplaces.dao.IPlantDAO; import com.plantplaces.dao.OfflinePlantDAO; import com.plantplaces.dao.OnlinePlantDAO; import com.plantplaces.dto.Plant; import com.plantplaces.dto.Specimen; /** * Plant Service when the mobile network is available. * * @author jonesb * */ public class PlantService implements IPlantService { // create a variable of type IPlantDAO. IPlantDAO onlinePlantDAO; IPlantDAO offlinePlantDAO; public PlantService(Context context) { onlinePlantDAO = new OnlinePlantDAO(); offlinePlantDAO = new OfflinePlantDAO(context); } @Override public List<String> fetchAllGenus() throws Exception { // TODO Auto-generated method stub ArrayList<String> allGenus = new ArrayList<String>(); allGenus.add("Abies"); allGenus.add("Abutilon"); allGenus.add("Abelia"); allGenus.add("Amelanchier"); allGenus.add("Amur"); allGenus.add("Acer"); return allGenus; } @Override public List<String> fetchAllCategories() throws Exception { // Create a colletion to store our default list of categories. ArrayList<String> allCategories = new ArrayList<String>(); allCategories.add("Shrub"); allCategories.add("Tree"); allCategories.add("Evergreen"); allCategories.add("Annual"); allCategories.add("Perennial"); allCategories.add("Grass"); allCategories.add("Vine"); // return the collection of categories. return allCategories; } @Override public List<Plant> fetchPlant(Plant plant) throws Exception { // find matching plants. ArrayList<Plant> fetchPlantsBySearch; try { fetchPlantsBySearch = onlinePlantDAO.fetchPlantsBySearch(plant); } catch (IOException e) { // we are here because there is a network exception. Switch to offline mode. // TODO create offline support. Meanwhile, rethrow exception. throw e; } return fetchPlantsBySearch; } @Override public List<Specimen> fetchAllSpecimens() throws Exception { return offlinePlantDAO.fetchAllSpecimens(); } @Override public void saveSpecimen(Specimen specimen) throws Exception { offlinePlantDAO.saveSpecimen(specimen); } }
12fsplantplacesmercurialdemo
src/com/plantplaces/service/PlantService.java
Java
lgpl
2,337
package com.plantplaces.service; import java.util.List; import com.plantplaces.dto.Plant; import com.plantplaces.dto.Specimen; /** * An interface for logic involving plants. * @author jonesb * */ public interface IPlantService { /** * Fetch all genus * @return a collection of all genus. */ public List<String> fetchAllGenus() throws Exception; /** * Fetch all plant categories * @return all plant categories. */ public List<String> fetchAllCategories() throws Exception; /** * Search for plants that contain the specified search criteria. * @param plant an object that contains search terms. * @return a collection of Plants that match the search criteria. * @throws Exception */ public List<Plant> fetchPlant(Plant plant) throws Exception; /** * Fetch all specimens in the database. * @return a collection of specimens. * @throws Exception */ public List<Specimen> fetchAllSpecimens() throws Exception; /** * Save the given Specimen. * @param specimen * @throws Exception */ public void saveSpecimen(Specimen specimen) throws Exception; }
12fsplantplacesmercurialdemo
src/com/plantplaces/service/IPlantService.java
Java
lgpl
1,161
/* * Copyright 2012 PlantPlaces.com */ package com.plantplaces.dto; /** * A specimen is a plant at a location with unique * values of its attributes. * @author jonesb * */ public class Specimen { @Override public String toString() { return getDescription() + " " + getLatitude() + " " + getLongitude(); } public int getId() { return id; } public void setId(int id) { this.id = id; } public int getPlantId() { return plantId; } public void setPlantId(int plantId) { this.plantId = plantId; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public double getLatitude() { return latitude; } public int getPublished() { return published; } public void setPublished(int published) { this.published = published; } public void setLatitude(double latitude) { this.latitude = latitude; } public double getLongitude() { return longitude; } public void setLongitude(double longitude) { this.longitude = longitude; } private int id; // primary key of the specimen. private int plantId; // foreign key back to the plant. private String description; // description of the specimen private double latitude; private double longitude; private int published = 0; }
12fsplantplacesmercurialdemo
src/com/plantplaces/dto/Specimen.java
Java
lgpl
1,380
package com.plantplaces.dto; import java.io.Serializable; public class Plant implements Serializable { String genus; String species; String cultivar; String commonName; String category; int minimumHeight; int maximumHeight; private int id; // the primary key from PlantPlaces.com @Override public String toString() { return genus + " " + species + " " + cultivar; } public String getGenus() { return genus; } public void setGenus(String genus) { this.genus = genus; } public String getSpecies() { return species; } public void setSpecies(String species) { this.species = species; } public String getCultivar() { return cultivar; } public void setCultivar(String cultivar) { this.cultivar = cultivar; } public String getCommonName() { return commonName; } public void setCommonName(String commonName) { this.commonName = commonName; } public String getCategory() { return category; } public void setCategory(String category) { this.category = category; } public int getMinimumHeight() { return minimumHeight; } public void setMinimumHeight(int minimumHeight) { this.minimumHeight = minimumHeight; } public int getMaximumHeight() { return maximumHeight; } public void setMaximumHeight(int maximumHeight) { this.maximumHeight = maximumHeight; } public void setId(int id) { this.id = id; } public int getId() { return id; } }
12fsplantplacesmercurialdemo
src/com/plantplaces/dto/Plant.java
Java
lgpl
1,483
/* * Copyright 2012 PlantPlaces.com */ package com.plantplaces.dao; import java.io.IOException; import org.apache.http.client.ClientProtocolException; /** * Access data from a network. * * @author jonesb * */ public interface INetworkDAO { /** * Given a URI, fetch the URI and return the response. * This method does not have any intelligence about the data it is sending or receiving; * it simply is in charge of sending the data over a network, and receiving the data * from the network. * @param uri The URI you wish to access. * @return the data returned after accessing the URI. */ public String request (String uri) throws ClientProtocolException, IOException ; }
12fsplantplacesmercurialdemo
src/com/plantplaces/dao/INetworkDAO.java
Java
lgpl
733
package com.plantplaces.dao; import java.io.IOException; import java.util.ArrayList; import org.apache.http.client.ClientProtocolException; import com.plantplaces.dto.Plant; import com.plantplaces.dto.Specimen; public class OnlinePlantDAO implements IPlantDAO { // attribute for our Network DAO. INetworkDAO networkDAO; public OnlinePlantDAO() { // instantiate our network DAO so that we can use it. networkDAO = new NetworkDAO(); } @Override public ArrayList<Plant> fetchPlantsBySearch(Plant searchPlant) throws IOException { // Create a collection to hold the returned plants. ArrayList<Plant> allPlants = new ArrayList<Plant>(); // assemble a URI. String genus = searchPlant.getGenus() != null ? searchPlant.getGenus() : ""; String species = searchPlant.getSpecies() != null ? searchPlant.getSpecies() : ""; String commonName = searchPlant.getCommonName() != null ? searchPlant.getCommonName() : ""; String uri = "http://plantplaces.com/perl/mobile/viewplants.pl?Genus=" + genus + "&Species=" + species + "&Common=" + commonName; // pass the assembled URI to the network DAO, receive the response. String response = networkDAO.request(uri); // split the response into its respective lines. Each line represents a plant. String[] lines = response.split("\n"); // iterate over each line of the response. for(String line : lines) { // parse the response by the delimiter. String[] plantData = line.split(";"); // make sure we have enough fields returned. if not, we have an invalid object. if (plantData.length > 4) { // create a new Plant object, fill it with the data from this line. Plant thisPlant = new Plant(); thisPlant.setId(Integer.parseInt(plantData[0])); thisPlant.setGenus(plantData[1]); thisPlant.setSpecies(plantData[2]); thisPlant.setCultivar(plantData[3]); thisPlant.setCommonName(plantData[4]); // Add the plant object to the ArrayList of all plant objects. allPlants.add(thisPlant); } } // return the ArrayList of all plant objects. return allPlants; } @Override public void saveSpecimen(Specimen specimen) throws Exception { // TODO Auto-generated method stub } @Override public ArrayList<Specimen> fetchAllSpecimens() throws Exception { // TODO Auto-generated method stub return null; } }
12fsplantplacesmercurialdemo
src/com/plantplaces/dao/OnlinePlantDAO.java
Java
lgpl
2,415
package com.plantplaces.dao; import java.io.IOException; import org.apache.http.client.ClientProtocolException; import org.apache.http.client.HttpClient; import org.apache.http.client.ResponseHandler; import org.apache.http.client.methods.HttpGet; import org.apache.http.impl.client.BasicResponseHandler; import org.apache.http.impl.client.DefaultHttpClient; public class NetworkDAO implements INetworkDAO { @Override public String request(String uri) throws ClientProtocolException, IOException { // Create the return variable. String returnString = ""; // create a default HttpClient object. HttpClient httpClient = new DefaultHttpClient(); // Create a get object with the URI that we have been provided. HttpGet httpGet = new HttpGet(uri); // Create a ResponseHandler to handle the response. ResponseHandler<String> responseHandler = new BasicResponseHandler(); // tie together the request and the response. returnString = httpClient.execute(httpGet, responseHandler); return returnString; } }
12fsplantplacesmercurialdemo
src/com/plantplaces/dao/NetworkDAO.java
Java
lgpl
1,076
/* * Copyright 2012 PlantPlaces.com */ package com.plantplaces.dao; import java.io.IOException; import java.util.ArrayList; import com.plantplaces.dto.Plant; import com.plantplaces.dto.Specimen; /** * CRUD operations for a Plant. * @author jonesb * */ public interface IPlantDAO { /** * Fetch plants that match the search criteria. * @param searchPlant a Plant DTO that contains search criteria. * @return a collection that contains Plants that match the given search criteria. */ public ArrayList<Plant> fetchPlantsBySearch(Plant searchPlant) throws IOException; /** * Save the specimen to the persistence layer. * @param specimen what we want to save. * @throws Exception in case there is a persistence exception that cannot be handled locally. */ public void saveSpecimen(Specimen specimen) throws Exception; /** * Return all specimens from the persistence layer. * @return a collection of Specimens. * @throws Exception in case there is a persistence exception that cannot be handled locally. */ public ArrayList<Specimen> fetchAllSpecimens() throws Exception; }
12fsplantplacesmercurialdemo
src/com/plantplaces/dao/IPlantDAO.java
Java
lgpl
1,158
package com.plantplaces.dao; import java.io.IOException; import java.util.ArrayList; import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; import com.plantplaces.dto.Plant; import com.plantplaces.dto.Specimen; public class OfflinePlantDAO extends SQLiteOpenHelper implements IPlantDAO { private static final String SPECIMENS_TABLE = "specimens"; private static final String PUBLISHED = "published"; private static final String DESCRIPTION = "description"; private static final String LONGITUDE = "longitude"; public static final String LATITUDE = "latitude"; public static final String PLANT_ID = "plantId"; public OfflinePlantDAO(Context context) { super(context, "plantplacessummer12", null, 1); } @Override public ArrayList<Plant> fetchPlantsBySearch(Plant searchPlant) throws IOException { // TODO Auto-generated method stub return null; } @Override public void onCreate(SQLiteDatabase db) { // TODO Auto-generated method stub db.execSQL("CREATE TABLE "+SPECIMENS_TABLE+" (_id INTEGER PRIMARY KEY AUTOINCREMENT, " + PLANT_ID + " INT, "+ LATITUDE + " TEXT, "+LONGITUDE+" TEXT, "+DESCRIPTION+" TEXT, "+PUBLISHED+" INT);"); db.execSQL("CREATE TABLE plants (_id INTEGER PRIMARY KEY AUTOINCREMENT, genus TEXT, species TEXT, cultivar TEXT, commonName TEXT, category TEXT, minimumHeight INT, maximumHeight INT);"); } @Override public void onUpgrade(SQLiteDatabase db, int arg1, int arg2) { // TODO Auto-generated method stub } @Override public void saveSpecimen(Specimen specimen) throws Exception { // create a ContentValues to hold the data we wish to save. ContentValues values = new ContentValues(); values.put(PLANT_ID, specimen.getPlantId()); values.put(LATITUDE, specimen.getLatitude()); values.put(LONGITUDE, specimen.getLongitude()); values.put(DESCRIPTION, specimen.getDescription()); values.put(PUBLISHED, specimen.getPlantId()); getWritableDatabase().insert(SPECIMENS_TABLE, LATITUDE, values); } @Override public ArrayList<Specimen> fetchAllSpecimens() throws Exception { ArrayList<Specimen> allSpecimens = new ArrayList<Specimen>(); // the SQL statement that will fetch specimens. String selectSQL = "SELECT * FROM " + SPECIMENS_TABLE; // run the query. Cursor specimenResults = getReadableDatabase().rawQuery(selectSQL, new String[0]); // see if we have results. if(specimenResults.getCount() > 0) { // move to the first row of the results. specimenResults.moveToFirst(); // iterate over the query result and populate our Specimen objects. while (!specimenResults.isAfterLast()) { // create and instantiate a Specimen object. Specimen thisSpecimen = new Specimen(); // populate the Specimen object. thisSpecimen.setId(specimenResults.getInt(0)); thisSpecimen.setPlantId(specimenResults.getInt(1)); thisSpecimen.setLatitude(specimenResults.getDouble(2)); thisSpecimen.setLongitude(specimenResults.getDouble(3)); thisSpecimen.setDescription(specimenResults.getString(4)); thisSpecimen.setPublished(specimenResults.getInt(5)); // add this specimen to the collection that will get returned. allSpecimens.add(thisSpecimen); // move to the next record in the results. specimenResults.moveToNext(); } } // return the results. return allSpecimens; } }
12fsplantplacesmercurialdemo
src/com/plantplaces/dao/OfflinePlantDAO.java
Java
lgpl
3,628
/* * Copyright PlantPlaces.com 2012 */ package com.plantplaces.ui; import android.content.Intent; import android.os.Bundle; import android.util.Log; import android.view.View; import android.view.View.OnClickListener; import android.widget.ArrayAdapter; import android.widget.AutoCompleteTextView; import android.widget.Button; import android.widget.EditText; import android.widget.Spinner; import android.widget.TextView; import android.widget.Toast; import com.plantplaces.dto.Plant; import com.plantplaces.service.IPlantService; import com.plantplaces.service.PlantServiceStub; /** * Enable searching of plants by several search criteria * @author jonesb * */ public class PlantSearchActivity extends PlantPlacesActivity { public static final String SELECTED_PLANT = "Selected Plant"; public static final String PLANT_SEARCH = "Plant Search"; private AutoCompleteTextView actGenus; private Spinner spnCategory; private IPlantService plantService; private Button btnPlantSearch; private EditText edtSpecies; private EditText edtCultivar; private TextView txtPlantResult; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); // we are associating the plant search layout with this activity. setContentView(R.layout.plantsearch); // initialize the plant service plantService = new PlantServiceStub(); try { // get a reference to the auto complete text. actGenus = (AutoCompleteTextView) findViewById(R.id.actGenus); // populate the auto complete text values from the PlantService actGenus.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_dropdown_item_1line, plantService.fetchAllGenus())); // get a reference to the spinner for categories. spnCategory = (Spinner) findViewById(R.id.spnCategory); // populate the spinner from our PlantService. spnCategory.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_dropdown_item_1line, plantService.fetchAllCategories())); } catch (Exception e) { Log.e(this.getClass().getName(), e.getMessage()); Toast.makeText(this, e.getMessage(), Toast.LENGTH_LONG).show(); } edtSpecies = (EditText) findViewById(R.id.edtSpecies); edtCultivar = (EditText) findViewById(R.id.edtCultivar); txtPlantResult = (TextView) findViewById(R.id.txtPlantResult); // get a reference to the search button. btnPlantSearch = (Button) findViewById(R.id.btnSearchPlants); // add a listener to the search button. btnPlantSearch.setOnClickListener(new OnClickListener(){ @Override public void onClick(View v) { searchPlants(); } }); } private void searchPlants() { // create a plant object populated with the search terms. Plant searchPlant = new Plant(); // start calling setters based on the UI elements. searchPlant.setGenus(actGenus.getText().toString()); searchPlant.setCategory(spnCategory.getSelectedItem().toString()); searchPlant.setSpecies(edtSpecies.getText().toString()); searchPlant.setCultivar(edtCultivar.getText().toString()); // place the Plant object into a bundle, so that we can pass it to the plant results screen. Bundle bundle = new Bundle(); bundle.putSerializable(PLANT_SEARCH, searchPlant); // create an intent for the plant results screen. Intent plantResultsIntent = new Intent(this, PlantResultsActivity.class); plantResultsIntent.putExtras(bundle); // call the intent for the plant results screen startActivityForResult(plantResultsIntent, 1); } /** * This is invoked when the Plant Result activity returns a result. */ @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { Bundle bundle = data.getExtras(); Plant selectedPlant = (Plant) bundle.getSerializable(SELECTED_PLANT); txtPlantResult.setText(selectedPlant.toString()); } }
12fsplantplacesmercurialdemo
src/com/plantplaces/ui/PlantSearchActivity.java
Java
lgpl
4,024
package com.plantplaces.ui; import java.util.List; import android.app.ListActivity; import android.content.Intent; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.ArrayAdapter; import android.widget.ListView; import android.widget.Toast; import com.plantplaces.dto.Plant; import com.plantplaces.service.IPlantService; import com.plantplaces.service.PlantService; /** * PlantResultsAcitivity shows a list of plants. * @author jonesbr * */ public class PlantResultsActivity extends ListActivity { IPlantService plantService; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); // initialize the plant service. plantService = new PlantService(this); Bundle bundle = getIntent().getExtras(); Plant plant = (Plant) bundle.getSerializable(PlantSearchActivity.PLANT_SEARCH); List<Plant> allPlants; try { allPlants = plantService.fetchPlant(plant); this.setListAdapter(new ArrayAdapter<Plant>(this, android.R.layout.simple_list_item_1, allPlants)); } catch (Exception e) { // TODO Auto-generated catch block Log.e(this.getClass().getName(), e.getMessage()); Toast.makeText(this, e.getMessage(), Toast.LENGTH_LONG).show(); } } @Override protected void onListItemClick(ListView l, View v, int position, long id) { // TODO Auto-generated method stub super.onListItemClick(l, v, position, id); // get the plant that the user selected. Plant selectedPlant = (Plant) this.getListAdapter().getItem(position); // send this plant back to the Plant Search Screen. Bundle bundle = new Bundle(); bundle.putSerializable(PlantSearchActivity.SELECTED_PLANT, selectedPlant); // get a reference to the current intent. Intent thisIntent = this.getIntent(); thisIntent.putExtras(bundle); this.setResult(RESULT_OK, thisIntent); finish(); } }
12fsplantplacesmercurialdemo
src/com/plantplaces/ui/PlantResultsActivity.java
Java
lgpl
2,006
package com.plantplaces.ui; import java.util.List; import android.app.ListActivity; import android.os.Bundle; import android.util.Log; import android.widget.ArrayAdapter; import android.widget.Toast; import com.plantplaces.dto.Specimen; import com.plantplaces.service.IPlantService; import com.plantplaces.service.PlantService; public class ShowSpecimensActivity extends ListActivity { IPlantService plantService; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); // init PlantService. plantService = new PlantService(this); // fetch all specimens. try { // fetch specimens. List<Specimen> allSpecimens = plantService.fetchAllSpecimens(); // populate the screen. this.setListAdapter(new ArrayAdapter<Specimen>(this, android.R.layout.simple_list_item_1, allSpecimens)); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); // showing a message box confirming the operation is complete. Toast.makeText(this, "Unable to retrieve specimens. Message: " + e.getMessage(), Toast.LENGTH_LONG).show(); Log.e(this.getClass().getName(), e.getMessage(), e); } } }
12fsplantplacesmercurialdemo
src/com/plantplaces/ui/ShowSpecimensActivity.java
Java
lgpl
1,278
package com.plantplaces.ui; import android.content.Intent; import android.location.Location; import android.location.LocationListener; import android.location.LocationManager; import android.os.Bundle; import android.util.Log; import android.view.MenuItem; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; import android.widget.Toast; import com.plantplaces.dto.Specimen; import com.plantplaces.service.IPlantService; import com.plantplaces.service.PlantService; /** * Find a latitude and longitude location. * * @author jonesbr * */ public class LocationFinder extends PlantPlacesActivity { private TextView txtLatitudeValue; private TextView txtLongitudeValue; private EditText edtDescription; private Button btnSaveSpecimen; private Button btnFindSpecimen; private Button btnShowSpecimens; private Button btnUploadSpecimens; // location coordinates. private double latitude; private double longitude; // LocationManager makes GPS locations available to us. private LocationManager locationManager; // LocationListener can listen to location events and perform actions when they occur. private LocationListener locationListener; // declare this as a variable, with time measured in seconds, so that we can allow the user to specify this as a preference in a future sprint. private int gpsInterval = 60; private IPlantService plantService; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.location); // initialize our plant service. plantService = new PlantService(this); txtLatitudeValue = (TextView) findViewById(R.id.txtLatitudeValue); txtLongitudeValue = (TextView) findViewById(R.id.txtLongitudeValue); edtDescription = (EditText) findViewById(R.id.edtDescription); btnSaveSpecimen = (Button) findViewById(R.id.btnSaveLocation); btnFindSpecimen = (Button) findViewById(R.id.btnFindSpecimen); btnShowSpecimens = (Button) findViewById(R.id.btnShowSpecimens); btnUploadSpecimens = (Button) findViewById(R.id.btnUploadSpecimens); // make an object of the listener type. OnClickListener saveListener = new SaveSpecimen(); // associate this button with the SaveSpecimen listener. // btnSaveSpecimen.setOnClickListener(saveListener); btnSaveSpecimen.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub save(); } } ); btnFindSpecimen.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub findSpecimen(); } } ); btnShowSpecimens.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { showSpecimens(); } }); btnUploadSpecimens.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { uploadSpecimens(); } }); // Initialize location manager for updates. locationManager = (LocationManager) getSystemService(LOCATION_SERVICE); // initialize location listener. initLocationListener(); // at this point, we know that both the Manager and Listener have been instantiated and assigned. // Thus, it is safe to start listeneing for updates. requestUpdates(); } /** * Not yet implemented. */ protected void uploadSpecimens() { // TODO Auto-generated method stub } protected void showSpecimens() { // redirect to an activity that will show specimens. Intent showSpecimensIntent = new Intent(this, ShowSpecimensActivity.class); startActivity(showSpecimensIntent); } private void initLocationListener() { // instantiate my location listener. locationListener = new LocationListener() { @Override public void onLocationChanged(Location location) { // When we are notified of a location event, update the respective attribute values. latitude = location.getLatitude(); longitude = location.getLongitude(); // also, update the UI TextViews. txtLatitudeValue.setText("" + latitude); txtLongitudeValue.setText("" + longitude); Toast.makeText(LocationFinder.this, "New GPS Location: " + latitude + " " + longitude, Toast.LENGTH_LONG).show(); } @Override public void onProviderDisabled(String provider) { // TODO Auto-generated method stub } @Override public void onProviderEnabled(String provider) { // TODO Auto-generated method stub } @Override public void onStatusChanged(String provider, int status, Bundle extras) { // TODO Auto-generated method stub } }; } /** * Find plants from which we can create specimens. * This will redirect us to the Plant Search screen. */ private void findSpecimen() { // create an intent to navigate to the next screen. Intent plantSearchIntent = new Intent(this, PlantSearchActivity.class); // invoke that intent, and indicate that we wish to receive a result. startActivityForResult(plantSearchIntent, 1); } /** * Save the specimen to the persistence layer. */ private void save() { String strLat = txtLatitudeValue.getText().toString(); String strLng = txtLongitudeValue.getText().toString(); String strDescription = edtDescription.getText().toString(); // create and populate our specimen. Specimen thisSpecimen = new Specimen(); thisSpecimen.setLatitude(Double.parseDouble(strLat)); thisSpecimen.setLongitude(Double.parseDouble(strLng)); thisSpecimen.setDescription(strDescription); thisSpecimen.setPlantId(1); // save the specimen, using the plant service. try { plantService.saveSpecimen(thisSpecimen); // showing a message box confirming the operation is complete. Toast.makeText(this, "Specimen Saved: " + strDescription, Toast.LENGTH_LONG).show(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); // showing a message box confirming the operation is complete. Toast.makeText(this, "Specimen Not Saved: " + strDescription + " Message: " + e.getMessage(), Toast.LENGTH_LONG).show(); Log.e(this.getClass().getName(), e.getMessage(), e); } } class SaveSpecimen implements OnClickListener { @Override public void onClick(View v) { save(); } } /** * Stop listening for locations. */ protected void removeUpdates() { locationManager.removeUpdates(locationListener); } /** * Start listening for locations. */ protected void requestUpdates() { // make sure that our publisher and subscriber have both been instantiated. if (locationListener != null && locationManager != null) { locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, gpsInterval * 1000, 0, locationListener); } } @Override protected void onPause() { // TODO Auto-generated method stub super.onPause(); // turn off locations. removeUpdates(); } @Override protected void onResume() { // TODO Auto-generated method stub super.onResume(); // restart updates requestUpdates(); } }
12fsplantplacesmercurialdemo
src/com/plantplaces/ui/LocationFinder.java
Java
lgpl
7,854
/* * Copyright 2012 PlantPlaces.com */ package com.plantplaces.ui; import android.app.Activity; import android.content.Intent; import android.view.Menu; import android.view.MenuItem; /** * Superclass that contains all common functionality for all Activities on the Plant Places mobile application. * @author jonesb * */ public class PlantPlacesActivity extends Activity { private static final int MENU_PLANT_SEARCH = 2; protected static final int MENU_LOCATION_SCREEN = 1; public PlantPlacesActivity() { super(); } @Override public boolean onCreateOptionsMenu(Menu menu) { // TODO Auto-generated method stub super.onCreateOptionsMenu(menu); // start to create menu options. // find location screen. menu.add(0, MENU_LOCATION_SCREEN, Menu.NONE, getString(R.string.mnuLocationScreen)); // plant search screen. menu.add(0, MENU_PLANT_SEARCH, Menu.NONE, getString(R.string.mnuPlantSearchScreen)); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // TODO Auto-generated method stub super.onOptionsItemSelected(item); switch (item.getItemId()) { case MENU_LOCATION_SCREEN: loadLocationScreen(); break; case MENU_PLANT_SEARCH: loadPlantSearchScreen(); break; } return true; } private void loadPlantSearchScreen() { // render the plant search screen. Intent plantSearchIntent = new Intent(this, PlantSearchActivity.class); startActivity(plantSearchIntent); } private void loadLocationScreen() { // render the location screen. Intent locationIntent = new Intent(this, LocationFinder.class); startActivity(locationIntent); } }
12fsplantplacesmercurialdemo
src/com/plantplaces/ui/PlantPlacesActivity.java
Java
lgpl
1,713
program kasat; {$APPTYPE CONSOLE} uses SysUtils; var a,b,x0,y0,x1,y1,r1,r2,c: real; begin readln(x0,y0,x1,y1,r1,r2); b:=(2*(r1+r2)*(y1-y0)+2*(x1-x0)*sqrt((r1+r2)*(r1+r2)+(y1-y0)*(y1-y0)+(x1-x0)*(x1-x0)))/ (2*((y1-y0)*(y1-y0)+(x1-x0)*(x1-x0))) ; a:=(2*(r1+r2)*(x1-x0)+2*(y1-y0)*sqrt((r1+r2)*(r1+r2)+(y1-y0)*(y1-y0)+(x1-x0)*(x1-x0))) / (2*((y1-y0)*(y1-y0)+(x1-x0)*(x1-x0))) ; c:=r1-a*x0-b*y0; Writeln(a ,'* x + ', b, '*y +', c, '= 0 '); b:=(2*(r1+r2)*(y1-y0)+2*(x1-x0)*sqrt((r1+r2)*(r1+r2)+(y1-y0)*(y1-y0)+(x1-x0)*(x1-x0))) / (2*((y1-y0)*(y1-y0)+(x1-x0)*(x1-x0))) ; a:=(2*(r1+r2)*(x1-x0)+2*(y1-y0)*sqrt((r1+r2)*(r1+r2)+(y1-y0)*(y1-y0)+(x1-x0)*(x1-x0))) / (2*((y1-y0)*(y1-y0)+(x1-x0)*(x1-x0))) ; c:=r1-a*x0-b*y0; Writeln(a ,'* x + ', b, '*y +' ,c, '= 0 '); b:=(2*abs((r1-r2))*(y1-y0)+2*(x1-x0)*sqrt((r1-r2)*(r1-r2)+(y1-y0)*(y1-y0)+(x1-x0)*(x1-x0))) / (2*((y1-y0)*(y1-y0)+(x1-x0)*(x1-x0))) ; a:=(2*abs((r1-r2))*(x1-x0)+2*(y1-y0)*sqrt((r1-r2)*(r1-r2)+(y1-y0)*(y1-y0)+(x1-x0)*(x1-x0))) / (2*((y1-y0)*(y1-y0)+(x1-x0)*(x1-x0))) ; c:=r1-a*x0-b*y0; Writeln(a ,'* x + ', b, '*y +' ,c, '= 0 '); b:=(2*abs((r1-r2))*(y1-y0)-2*(x1-x0)*sqrt((r1-r2)*(r1-r2)+(y1-y0)*(y1-y0)+(x1-x0)*(x1-x0))) / (2*((y1-y0)*(y1-y0)+(x1-x0)*(x1-x0))) ; a:=(2*abs((r1-r2))*(x1-x0)-2*(y1-y0)*sqrt((r1-r2)*(r1-r2)+(y1-y0)*(y1-y0)+(x1-x0)*(x1-x0))) / (2*((y1-y0)*(y1-y0)+(x1-x0)*(x1-x0))) ; c:=r1-a*x0-b*y0; Writeln(a ,'* x + ', b, '*y +', c, '= 0 '); REadln; end.
10102012-name
trunk/ 10102012-name/kasat.dpr
Pascal
gpl3
1,547
program vpkl; {$APPTYPE CONSOLE} uses SysUtils; var n,f,s,d,i:Integer; massX: array of Integer; massY: array of Integer; begin readln(n); d:=0; setlength(massX,n); setlength(massY,n); For i:=0 to n-1 do readln(massX[i],massY[i]); i:=0; F:=massX[i]*massY[i+1]-massx[i+1]*massY[i]+massX[i+1]*massY[i+2]-massx[i+2]*massY[i+1]+massX[i+2]*massY[i]-massx[i]*massY[i+2]; For i:=1 to n-3 do begin S:=massX[i]*massY[i+1]-massx[i+1]*massY[i]+massX[i+1]*massY[i+2]-massx[i+2]*massY[i+1]+massX[i+2]*massY[i]-massx[i]*massY[i+2]; If F*S<0 then d:=1; F:=S; end; i:=n-2; S:=massX[i]*massY[i+1]-massx[i+1]*massY[i]+massX[i+1]*massY[1]-massx[1]*massY[i+1]+massX[1]*massY[i]-massx[i]*massY[1]; If F*S<0 then d:=1; F:=S; i:=n-1; S:=massX[i]*massY[1]-massx[1]*massY[i]+massX[1]*massY[2]-massx[2]*massY[1]+massX[2]*massY[i]-massx[i]*massY[2]; If F*S<0 then d:=1; F:=S; If d=1 then Writeln('no') Else Writeln('Yes'); Readln; end.
10102012-name
trunk/ 10102012-name/vpkl.dpr
Pascal
gpl3
1,088
<?php //本地配置 session_start(); header('Content-Type: text/html; charset=utf-8'); //定义全局参数 //函数体要引用全局变量,即在函数体内申明如:global $a; $SystemConest=array(); $SystemConest[0]=dirname(__FILE__); $SystemConest[1]="guanli";//后台管理目录 $SystemConest[2]="admin";//超级帐号 $SystemConest[3]=1*1024*100;//充许文件上传的大小 $SystemConest[4]="/Public/upfiles/";//上传文件存放的路径 $SystemConest[5]=array('.zip','.rar','.jpg','.png','.gif','.wma','.rm','.wmv','.doc','.mpeg','.mp3','.avi');//充许文件上传类型 $SystemConest[6]="default";//风格样式名称 在/template 文件夹下 define("DQ","cd_");//主站数据表前缀 define("UHDQ","uchome_");//UCHOME数据表前缀 $SystemConest[7]=DQ; $SystemConest[8]="法轮功,淫,日你,日她,我日,易勇斌";//非法字符串,用“,”分隔 $SystemConest[9]="192.168.0.2";//数据库IP地址 $SystemConest[10]="xdreams";//数据库名 $SystemConest[11]="root";//数据库用户 $SystemConest[12]="sz123";//数据库密码 mzlsz$168_78R $SystemConest[13]="7659";//数据库端口 $SystemConest["db_user"]=$SystemConest[11];//数据库用户 $SystemConest["tourxmlpath"]="xml";//生成线路xml的路径,以相对网站根目录的始 $SystemConest["sys_suoluetu"]["w"]=240;//生成缩略图的宽度 $SystemConest["sys_suoluetu"]["h"]=190;//生成缩略图的宽度 $SystemConest["KZURL"]="http://kezhan.demo.mzl5.com";//客栈的二级域名 define("RootDir",$SystemConest[0]);//定义根目录为常量 define("Q","dsz");//定义入口文件的别2名 define("FGF","/");//定义url地址分割符 define("TempDir",RootDir."/template/".$SystemConest[6]);//定义模板文件的路径为常量 define("Syshoutai",$SystemConest[1]); define('HTML_DIR','Runtime/cachehtml'); define('DanxuangduofenC','|$#df&@|');//单项多分属性的内容分界符 define('DanxuangduofenT','|%@df&@|');//单项多分属性的内容再折分标题和内容时的分隔符 define("PICPATHsystem",(strstr($_SERVER['HTTP_HOST'],"127.0.0.1"))?"http://demo.mzl5.com":"http://demo.mzl5.com"); define("PICPATH",PICPATHsystem);//本站图片服务器地址 define('RUNTIME_ALLINONE', false); // 开启 ALLINONE 运行模式 define("SYS_SITENAME","梦之旅旅游网");//定义站点名称 define("SYS_UCHOMEURL",PICPATHsystem."/user");//定义社区的url地址 define("SYS_UCcenter",PICPATHsystem."/ducenter");//定义社区的url地址 //支付方式 //key值为标签的value值,值为标签的显示值 $PayType=array( ""=>"请选择", "支付宝"=>"支付宝", "环讯" =>"在线支付", "paypal"=>"贝宝", "网银"=>"网银", "转帐"=>"转帐", "财付通"=>"财付通" ); $SYS_config=array( "addYingx"=>6,//每个会员可以添加的线路印象条数 "pinglunmaxnum"=>5,//线路评论的最大数 "maxjifenduije"=>0.05,//积分在兑换金额时的最大比例这里为%5 "xfsjfnumdy1jenum"=>100,//在抵用时多少积分抵用1元人民币 "siteurl"=>"http://demo.mzl5.com",//网站主域名 "Gettourxoldurl"=>"http://www.dreams-travel.com",//获取老网站线路的地址 "tiqianzftime"=>6,//订单定金支付的限期,从下订单后多少小时后可支付 "yukuanzfqixuan"=>33,//余款支付的期限,从下单时间开始算 "smsuser"=>"szgl00006",//凌凯短信帐号 "smspass"=>"sz168msm",//凌凯短信密码 "tiaoshi"=>true,//是否开启调试和显示页面Trace信息 "cookiedoman"=>".mzl5.com",//cookie的作用域 "hotelpingnum"=>"(select count(*) as tnum from ".DQ."pinglun where pinglun2=a.hotel0) as ctnum",//在调用酒店列表时,要统计总的评论记录条数时的sql语句,可以直接写入语句里 "hotelpingtotalfen"=>"(select sum(pinglun9+pinglun10+pinglun11+pinglun12+pinglun13+pinglun14)as onenum from ".DQ."pinglun where pinglun2=a.hotel0) as allfs",//某个酒店的所有评论条数加起来的分数总和 ); //系统级函数 /** * 格式化url路由函数 要求把模块和操作和参数的分隔符分开 * @param $str url的字符串 * @param $pref 模块和操作的分隔符 * @param $can url参数的分隔符,?后面的 * */ function Sys_formaturl($str,$pref,$can){ $str1=str_replace($pref,$can,$str); return preg_replace("/".$can."/","/",$str1,2); } ?>
10npsite
trunk/global1.php
PHP
asf20
4,392
<?php //当是haomzl.com时加载global2.php 修改的时候要在这两个文件都修改 include (strstr($_SERVER['HTTP_HOST'],"haomzl.com"))?'global2.php':'global1.php'; ?>
10npsite
trunk/global.php
PHP
asf20
184
<?php session_start(); require "../global.php";//$dirname."/". require $SystemConest[0]."/"."inc/Uifunction.php"; unset($_SESSION['Login']); //注销login alert("/".$SystemConest[1]."",2,"退出成功"); ?>
10npsite
trunk/guanli/OutLogin.php
PHP
asf20
215
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>无标题文档</title> <style type="text/css"> <!-- body { background-image: url(/YKTGuanLi/Iamges/Left_P.jpg); margin-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; } --> </style> <link href="Inc/Css.css" rel="stylesheet" type="text/css" /> </head> <body> <table width="100%" height="21" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF"> <tr> <td></td> </tr> </table> <div align="center">POWERED BY 梦之旅 @2012 All xdreams.com </div> </body> </html>
10npsite
trunk/guanli/bottom.php
Hack
asf20
784
<? session_start(); require "../global.php"; ?> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>网站管理系统</title> <style type="text/css"> <!-- body { margin-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; } --> </style> <link href="Inc/Css.css" rel="stylesheet" type="text/css" /> </head> <body> <table width="100%" height="67" border="0" cellpadding="0" cellspacing="0" background="Iamges/Top_Logo.jpg"> <tr> <th width="151" height="67" align="left" valign="bottom" background="Iamges/Top_Logo.jpg" scope="col"></th> <th width="86" scope="col">&nbsp;</th> <th width="657" align="left" scope="col">&nbsp;</th> <th width="11" scope="col">&nbsp;</th> </tr> </table> <table width="100%" height="10" border="0" cellpadding="0" cellspacing="0" background="Iamges/Top_M_Line.jpg"> <tr> <td width="532"><img src="Iamges/Top_M_Left.jpg" width="532" height="10" /></td> <td></td> </tr> </table> <table width="100%" height="24" border="0" cellpadding="0" cellspacing="0" background="Iamges/Top_3_Line.jpg"> <tr> <td width="41"><img src="Iamges/Top_3_Left.jpg" width="41" height="24" /></td> <td width="312" class="Font12W">管理平台</td> <td width="38" align="right" valign="middle" class="Font12W">  <img src="Iamges/Admin.jpg" alt=" " width="17" height="17" /></td> <td width="135" align="right" valign="middle" class="Font12W">当前用户:<? echo $_SESSION["Login"][1]; ?> </td><? //特殊帐号显示?> <td width="17" align="right" valign="middle" class="Font12W"><img src="Iamges/Config.jpg" alt=" " width="17" height="17" /></td> <td width="57" align="right" valign="middle" class="Font12W"><div align="left"> <? if($_SESSION["Login"][1]==$SystemConest[2]) { ?> <a href="system/menusys/Index.php" target="mainFrame" class="Font12W">栏目管理</a> <? } ?> </div></td><? //特殊帐号显示结束?> <td width="19" align="center" valign="top" class="Font12W"><img src="Iamges/PassWord.jpg" alt=" " width="17" height="21" /></td> <td width="57" align="left" valign="middle" class="Font12W"><a href="system/adminsys/ModifyPassWord.php" target="mainFrame" class="Font12W">修改密码</a></td> <td width="15" align="center" valign="top" class="Font12W"><img src="Iamges/Exit.jpg" alt=" " width="15" height="19" /></td> <td width="158" align="left" valign="middle" class="Font12W"><a href="OutLogin.php" target="_top" class="Font12W">退出系统</a> <a href="createsomefiles.php" class="Font12W" target="mainFrame">生成常用文件</a></a></td> </tr> </table> <table width="100%" height="14" border="0" cellpadding="0" cellspacing="0" background="/<? echo $SystemConest[1];?>/Iamges/Top_4_Line.jpg"> <tr> <td width="146"><img src="Iamges/Top_4_Left.jpg" width="146"></td> <td ></td> </tr> </table> </body> </html>
10npsite
trunk/guanli/Top.php
PHP
asf20
3,045
<?php session_start(); require "../global.php"; define('APP_NAME', 'xdreamsguanli'); define("APP_DEBUG", true); //是否开启调式 require "../DThinkPHP/ThinkPHP.php"; ?>
10npsite
trunk/guanli/u.php
PHP
asf20
180
<? require "../global.php"; ?> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <style type="text/css"> body,td,th { font-size: 12px; } body { margin-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; } </style> <table width="423" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="80">&nbsp;</td> <td width="245">&nbsp;</td> <td width="98">&nbsp;</td> </tr> <tr> <td height="34">&nbsp;</td> <td><a href="/<? echo Q;?>public_createtoIndexpage">生成首页</a></td> <td>&nbsp;</td> </tr> <tr> <td height="34">&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> </tr> </table>
10npsite
trunk/guanli/createsomefiles.php
PHP
asf20
701
<?php require "../global.php";//$dirname."/". require RootDir."/".$SystemConest[1]."/system/Config.php"; require RootDir."/"."inc/Menu_js.php"; include RootDir."/"."inc/const.php"; require RootDir."/"."inc/Uifunction.php"; require RootDir."/".$SystemConest[1]."/UIFunction/adminClass.php"; require RootDir."/".$SystemConest[1]."/system/menusys/function.php"; $mydb=new YYBDB(); CheckRule($MenuId,$mydb,"","");//检查登陆权限 ?> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>营销型网站</title> <style type="text/css"> <!-- body { margin-right: 0px; background-image: url(Iamges/Left_P.jpg); margin-left: 0px; margin-top: 0px; margin-bottom: 0px; } --> </style> <link href="Inc/Css.css" rel="stylesheet" type="text/css"> </head> <body style="overflow-x:hidden;"> <table width="100%" height="460" border="0" cellpadding="0" cellspacing="0"> <tr> <td align="right" valign="top" ><table width="100%" height="460" border="0" cellpadding="0" cellspacing="0" style=""> <tr> <td align="center" valign="top"> <p class="Font12W">&nbsp;</p> <p class="Font12W"> <?php //菜单列表 $mydb=new YYBDB(); Menu_JS(ShowMenu($mydb,$_SESSION['Login'][0])); ?> </p> </tr> </table> <script language="javascript"> $("div[id^='System_Child_']").hide(); </script> </body> </html>
10npsite
trunk/guanli/Left.php
PHP
asf20
1,437
<html xmlns="http://www.w3.org/1999/xhtml"> <head> <link href="../Inc/Css.css" rel="stylesheet" type="text/css" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <style type="text/css"> body,td,th { font-size: 12px; } </style> </head> <body> <script language="javascript" src="/jsLibrary/jquery/jquery.js"></script> <script language="javascript" src="/jsLibrary/jquery/jquery.contextmenu.r2.js"></script> <script language="javascript" src="/jsLibrary/clearbox.js"></script> <script language="javascript"> $(document).ready(function(){ //把所有的输入框放是1970年的值清空 }); </script> <style> .titletdbg{background-color:#EAEAEA;} </style> <table width="800" border="1" cellspacing="0" cellpadding="0" align="center"> <tr> <td width="33%" height="38" align="center" style="font-size:16px; font-weight:bold">旅游产品客栈订单处理 </td> </tr> </table> <table width="800" border="1" cellspacing="0" cellpadding="0" align="center"> <form action="__URL__<{$Think.const.FGF}>hotelsaveisdo" method="post" name="form1"> <tr> <td width="117" height="39" align="center" class="titletdbg"><strong>订单号</strong></td> <td width="278">&nbsp;<{$rs.orderform3}></td> <td width="92" align="center" class="titletdbg"><strong>产品名称</strong></td> <td width="303">&nbsp;<a href="__KZURL__/hotel/view-id-<{$rs.orderform1}>" target="_blank"><{$rs.chotel1}></a></td> </tr> <tr> <td height="39" align="center" class="titletdbg"><strong>下单日期</strong></td> <td>&nbsp;<{$rs.orderform6|date="Y-m-d H:i:s",###}></td> <td align="center" class="titletdbg"><strong>预定日期</strong></td> <td>&nbsp;<{$rs.orderform9|date="Y-m-d H:i:s",###}></td> </tr> <tr> <td height="39" align="center" class="titletdbg"><strong>电子邮件</strong></td> <td>&nbsp;<{$rs.orderform26}></td> <td align="center" class="titletdbg"><strong>联系人</strong></td> <td>&nbsp;<{$rs.orderform5}></td> </tr> <tr> <td height="161" align="center" class="titletdbg"><strong>订单内容</strong></td> <td colspan="3">&nbsp;<{$rs.orderform10}> </td> </tr> <tr> <td height="39" align="center" class="titletdbg">确认书</td> <td colspan="3"><a target="_blank" href="__GROUP__/affirm/hotelzhifu/orderid/<{$rs.orderform3}>">支付确认书</a></td> </tr> <tr> <td height="39" align="center" class="titletdbg"><strong>是否处理该订单</strong></td> <td colspan="3">&nbsp;<{$rs.orderform11|ui_checkbox_shenghe="orderform11",###}>(√表示已处理)</td> </tr> <tr> <td height="39" align="center" class="titletdbg"><strong>处理意见</strong></td> <td colspan="3"> <input type="radio" name="orderform12" id="orderform12" value="1" <{$rs.orderform12|echoChecked="1",###}> > 欢迎你预定本产品,你的定单已接受,受理情况或部份变动请参考我们的处理意见<br> <input type="radio" name="orderform12" id="orderform12" value="2" <{$rs.orderform12|echoChecked="2",###}>> 欢迎你预定本产品,你指定的服务不能成行,推荐预定以下相近产品或服务<br> <input type="radio" name="orderform12" id="orderform12" value="3" <{$rs.orderform12|echoChecked="3",###}> > 对不起你的订单已失效,欢迎再次定购本网产品,谢谢你的支持</td> </tr> <tr> <td height="39" align="center" class="titletdbg">综合处理意见及理由</td> <td colspan="3"> <textarea name="orderform13" id="orderform13" cols="60" rows="7"><{$rs.orderform13}></textarea></td> </tr> <tr> <td height="39" align="center" class="titletdbg">总金额:</td> <td colspan="3"> <input type="text" name="orderform16" id="orderform16" size="8" value="<{$rs.orderform16}>"> 元,&nbsp;定金: <input type="text" name="orderform17" id="orderform17" size="8" value="<{$rs.orderform17}>"> 元,支付期限<input type="text" name="orderform18" id="orderform18" onClick="showCal(orderform18);" size="12" value="<{$rs.orderform18|date="Y-m-d",###}>"> 之前支付 </td> </tr> <tr> <td height="39" align="center" class="titletdbg">余款支付金额:</td> <td colspan="3"><input type="text" name="orderform19" id="orderform19" size="8" value="<{$rs.orderform19}>"> 元,支付期限:<input type="text" name="orderform20" id="orderform20" onClick="showCal(orderform20);" size="12" value="<{$rs.orderform20|date="Y-m-d",###}>"> 之前支付</td> </tr> <tr> <td height="39" colspan="4" align="center" class="titletdbg">工作人员:<input readonly type="text" name="orderform22" id="orderform22" value="<{$Think.session.Login.1}>"> <input type="hidden" name="orderform28" id="orderform28" value="<{$rs.orderform28|date="Y-m-d H:i:s",###}>"> <input name="issendmail" id="issendmail" type="checkbox" value="1"> 是否发送邮件,上一次处理时间:<{$rs.orderform28|date="Y-m-d H:i:s",###}> <br> 上次处理工作人员:<{$rs.orderform22}> <input name="mysubmit1" id="mysubmit1" type="submit" value="保存并提交回复" <if condition="($rs.orderform11 eq 1) and ($adminname neq 'admin') "> disabled="disabled" </if> > <input type="hidden" id="orderform0" name="orderform0" value="<{$rs.orderform0}>"> <input type="hidden" id="tomail" name="tomail" value="<{$rs.orderform26}>"> </td> </tr> </form> <form action="orderform_savekccycontent" method="post" name="formotherchili"> <tr> <td height="39" colspan="4" align="center" class="titletdbg"> </td> </tr> </form> <form action="__GROUP__/pay/savedingjing" method="post" name="pay_savedingjing"> <tr> <td height="39" align="center" class="titletdbg">订金确认</td> <td colspan="3"><if condition="$rs.pay6 eq 1"> 已确认 <else/> 未确认 </if> </td> </tr> <tr> <td height="39" align="center" class="titletdbg">订金金额</td> <td> <input type="text" name="pay3" id="pay3" value="<{$rs.pay3}>"></td> <td class="titletdbg">&nbsp;是否确认</td> <td >&nbsp; <{$rs.pay6|ui_checkbox_shenghe="pay6",###,"1"}>(若确认请打上勾) </td> </tr> <tr> <td height="39" align="center" class="titletdbg">支付方式</td> <td>&nbsp; <{$rs.pay5|ui_select_paytype="pay5",###}></td> <td class="titletdbg">支付时间</td> <td> <input type="text" name="pay4" id="pay4" onClick="showCal(pay4);" value="<{$rs.pay4|date='Y-m-d H:i:s',###}>"></td> </tr> <tr> <td height="39" align="center" class="titletdbg">备注</td> <td colspan="3"> <textarea name="pay11" id="pay11" cols="70" rows="5"><{$rs.pay11}></textarea></td> </tr> <tr> <td height="39" align="center" class="titletdbg">&nbsp;</td> <td colspan="3"><input type="submit" name="djmybutton" id="djmybutton" value="提 交" <if condition="$rs.pay6 eq 1">disabled="disabled"</if> > <input type="hidden" id="pay13" name="pay13" value="<{$Think.session.Login.1}>"> <input type="hidden" id="pay0" name="pay0" value="<{$rs.pay0}>"> <input type="hidden" id="orderid" name="orderid" value="<{$rs.orderform0}>"> <input type="hidden" id="orderno" name="orderno" value="<{$rs.orderform3}>"> </td> </tr> </form> <form action="__GROUP__/pay/saveyukuan" method="post" name="formd"> <tr> <td height="39" align="center" class="titletdbg">余款确认</td> <td colspan="3">&nbsp;<if condition="$rs.pay10 eq 1"> 已确认 <else/> 未确认 </if></td> </tr> <tr> <td height="39" align="center" class="titletdbg">余款金金额</td> <td> <input type="text" name="pay7" id="pay7" value="<{$rs.pay7}>"></td> <td class="titletdbg">&nbsp;余款确认</td> <td >&nbsp; <{$rs.pay10|ui_checkbox_shenghe="pay10",###,"1"}>(若确认请打上勾) </tr> <tr> <td height="39" align="center" class="titletdbg">支付方式</td> <td>&nbsp; <{$rs.pay9|ui_select_paytype="pay9",###}></td> <td class="titletdbg">支付时间</td> <td> <input type="text" name="pay8" id="pay8" onClick="showCal(pay8);" value="<{$rs.pay8|date='Y-m-d H:i:s',###}>"></td> </tr> <tr> <td height="39" align="center" class="titletdbg">备注</td> <td colspan="3"> <textarea name="pay12" id="pay12" cols="70" rows="5"><{$rs.pay12}></textarea></td> </tr> <tr> <td height="39" align="center" class="titletdbg">&nbsp;</td> <td colspan="3"><input type="submit" name="dmybutton" id="dmybutton" value="提 交" <if condition="$rs.pay10 eq 1">disabled="disabled"</if> > <input type="hidden" id="pay14" name="pay14" value="<{$Think.session.Login.1}>"> <input type="hidden" id="pay0" name="pay0" value="<{$rs.pay0}>"> <input type="hidden" id="orderid" name="orderid" value="<{$rs.orderform0}>"> </td> </tr> </form> </table> <script language="javascript"> $("#djmybutton").bind("click", function(){ djdpaytime=$("#paytimeearnestmoney").val(); if(!djdpaytime.match(/^[\d]{4}\-[\d]{1,2}\-[\d]{1,2}/)) { alert("订金的支付时间不能为空"); $("#paytimeearnestmoney").focus(); return false; } return true; }); </script> </body> </html>
10npsite
trunk/guanli/Tpl/default/orderform/hoteleditorder.htm
HTML
asf20
9,562
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>订单管理</title> <script src="/jsLibrary/jquery/jquery.js"></script> </head> <body> <link href="../../Inc/Css.css" rel="stylesheet" type="text/css" /> <table width="100%" border="1" cellspacing="0" cellpadding="0"> <tr bgcolor="#E0E0D3"> <td width="8%" height="37">订单号</td> <td width="10%">客栈名称</td> <td width="4%">姓名</td> <td width="6%">下单时间</td> <td width="7%">生效日</td> <td width="8%">定金通知</td> <td width="9%">定金支付结果/方式</td> <td width="13%">定金支付时间</td> <td width="10%">余款支付金额/方式</td> <td width="13%">余款支付时间</td> <td width="12%">操作</td> </tr> <volist name="rs" id="order"> <tr> <td width="8%" height="37"><a href="__URL__<{$Think.config.URL_PATHINFO_DEPR}>hoteleditorder<{$Think.config.URL_PATHINFO_DEPR}>id<{$Think.config.URL_PATHINFO_DEPR}><{$order.orderform0}>"><{$order.orderform3}></a></td> <td width="10%">&nbsp;<{$order.chotel1}></td> <td width="4%">&nbsp;<{$order.orderform5}></td> <td width="6%">&nbsp;<{$order.orderform6|date="Y-m-d H:i:s",###}></td> <td width="7%">&nbsp;<{$order.orderform9|date="Y-m-d",###}></td> <td width="8%">&nbsp;<{$order.orderform17}></td> <td width="9%">&nbsp; <if condition="$order.pay6 eq 1"> <{$order.pay3}>/ </if><{$order.pay5}> </td> <td width="13%">&nbsp;<{$order.pay4|date="Y-m-d H:i:s",###}></td> <td width="10%">&nbsp <if condition="$order.pay10 eq 1"> <{$order.pay7}> </if>/<{$order.pay9}> </td> <td width="13%">&nbsp;<{$order.pay8|date="Y-m-d",###}></td> <td width="12%">&nbsp;<a href="#">删除</a></td> </tr> </volist> </table> <div><{$show}></div> </body> </html>
10npsite
trunk/guanli/Tpl/default/orderform/innlist.htm
HTML
asf20
2,095
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title></title> </head> <body> </body> </html>
10npsite
trunk/guanli/Tpl/default/orderform/savekccycontent.htm
HTML
asf20
303
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>无标题文档</title> </head> <body> </body> </html>
10npsite
trunk/guanli/Tpl/default/orderform/saveisdo.htm
HTML
asf20
316
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>订单管理</title> <script src="/jsLibrary/jquery/jquery.js"></script> </head> <body> <link href="/guanli/Inc/Css.css" rel="stylesheet" type="text/css" /> <table width="100%" border="1" cellspacing="0" cellpadding="0"> <tr bgcolor="#E0E0D3"> <td width="8%" height="37">订单号</td> <td width="10%">产品名称</td> <td width="4%">姓名</td> <td width="6%">下单时间</td> <td width="7%">生效日</td> <td width="8%">定金通知</td> <td width="9%">定金支付结果/方式</td> <td width="13%">定金支付时间</td> <td width="10%">余款支付金额/方式</td> <td width="13%">余款支付时间</td> <td width="12%">操作</td> </tr> <volist name="rs" id="order"> <tr> <td width="8%" height="37"><a href="orderform<{$Think.config.URL_PATHINFO_DEPR}>editorder<{$Think.config.URL_PATHINFO_DEPR}>id<{$Think.config.URL_PATHINFO_DEPR}><{$order.orderform0}>"><{$order.orderform3}></a></td> <td width="10%">&nbsp;<{$order.orderform4}></td> <td width="4%">&nbsp;<{$order.orderform5}></td> <td width="6%">&nbsp;<{$order.orderform6|date="Y-m-d H:i:s",###}></td> <td width="7%">&nbsp;<{$order.orderform9|date="Y-m-d",###}></td> <td width="8%">&nbsp;<{$order.orderform17}></td> <td width="9%">&nbsp; <if condition="$order.pay6 eq 1"> <{$order.pay3}>/ </if><{$order.pay5}> </td> <td width="13%">&nbsp;<{$order.pay4|date="Y-m-d H:i:s",###}></td> <td width="10%">&nbsp <if condition="$order.pay10 eq 1"> <{$order.pay7}> </if>/<{$order.pay9}> </td> <td width="13%">&nbsp;<{$order.pay8|date="Y-m-d",###}></td> <td width="12%">&nbsp;<a href="#">删除</a></td> </tr> </volist> </table> <div><{$show}></div> </body> </html>
10npsite
trunk/guanli/Tpl/default/orderform/index.htm
HTML
asf20
2,097
<html xmlns="http://www.w3.org/1999/xhtml"> <head> <link href="../Inc/Css.css" rel="stylesheet" type="text/css" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <style type="text/css"> body,td,th { font-size: 12px; } </style> </head> <body> <script language="javascript" src="/jsLibrary/jquery/jquery.js"></script> <script language="javascript" src="/jsLibrary/jquery/jquery.contextmenu.r2.js"></script> <script language="javascript" src="/jsLibrary/clearbox.js"></script> <script language="javascript"> $(document).ready(function(){ //把所有的输入框放是1970年的值清空 }); </script> <style> .titletdbg{background-color:#EAEAEA;} </style> <table width="800" border="1" cellspacing="0" cellpadding="0" align="center"> <tr> <td width="33%" height="38" align="center" style="font-size:16px; font-weight:bold">旅游产品订单处理</td> </tr> </table> <table width="800" border="1" cellspacing="0" cellpadding="0" align="center"> <form action="orderform<{$Think.const.FGF}>saveisdo" method="post" name="form1"> <tr> <td width="117" height="39" align="center" class="titletdbg"><strong>订单号</strong></td> <td width="278">&nbsp;<{$rs.orderform3}></td> <td width="92" align="center" class="titletdbg"><strong>产品名称</strong></td> <td width="303">&nbsp;<{$rs.orderform4}></td> </tr> <tr> <td height="39" align="center" class="titletdbg"><strong>下单日期</strong></td> <td>&nbsp;<{$rs.orderform6|date="Y-m-d H:i:s",###}></td> <td align="center" class="titletdbg"><strong>预定日期</strong></td> <td>&nbsp;<{$rs.orderform9|date="Y-m-d H:i:s",###}></td> </tr> <tr> <td height="39" align="center" class="titletdbg"><strong>电子邮件</strong></td> <td>&nbsp;<{$rs.orderform26}></td> <td align="center" class="titletdbg"><strong>联系人</strong></td> <td>&nbsp;<{$rs.orderform5}></td> </tr> <tr> <td height="161" align="center" class="titletdbg"><strong>订单内容</strong></td> <td colspan="3">&nbsp;<{$rs.orderform10}> </td> </tr> <tr> <td height="39" align="center" class="titletdbg">确认书</td> <td colspan="3"><a target="_blank" href="/affirm<{$Think.const.FGF}>zhifu<{$Think.const.FGF}>orderid<{$Think.const.FGF}><{$rs.orderform3}>">支付确认书</a> <a target="_blank" href="/affirm<{$Think.const.FGF}>chutuantongzhi<{$Think.const.FGF}>orderid<{$Think.const.FGF}><{$rs.orderform3}>">出团通知书</a> (<a target="_blank" href="/affirm<{$Think.const.FGF}>chutuantongzhi<{$Think.const.FGF}>orderid<{$Think.const.FGF}><{$rs.orderform3}><{$Think.const.FGF}>showedit<{$Think.const.FGF}>yes"> <if condition="($rs.orderform30 neq '1') or ($Login.1 eq $adminname)">修改,</if> </a> <a target="_blank" href="/affirm<{$Think.const.FGF}>chutuantongzhi<{$Think.const.FGF}>orderid<{$Think.const.FGF}><{$rs.orderform3}><{$Think.const.FGF}>sendflag<{$Think.const.FGF}>yes"> <if condition="$rs.orderform30 eq '1'"> 已发送 <else /> 发送 </if> </a>) <if condition="$trs.tour4 eq '544'"> <assign name="hetongmoman" value="guoleihetong" /> <elseif condition="$trs.tour4 eq '563'" /> <assign name="hetongmoman" value="chujinghetong" /> </if> <a target="_blank" href="/affirm<{$Think.const.FGF}><{$hetongmoman}><{$Think.const.FGF}>orderid<{$Think.const.FGF}><{$rs.orderform3}>">旅游合同</a> (<a target="_blank" href="/affirm<{$Think.const.FGF}><{$hetongmoman}><{$Think.const.FGF}>orderid<{$Think.const.FGF}><{$rs.orderform3}><{$Think.const.FGF}>showedit<{$Think.const.FGF}>yes"> <if condition="($rs.orderform31 neq '1') or ($Login.1 eq $adminname)">修改,</if> </a><a target="_blank" href="/affirm<{$Think.const.FGF}><{$hetongmoman}><{$Think.const.FGF}>orderid<{$Think.const.FGF}><{$rs.orderform3}><{$Think.const.FGF}>sendflag<{$Think.const.FGF}>yes"> <if condition="$rs.orderform31 eq '1'"> 已发送 <else /> 发送 </if> </a>)</td> </tr> <tr> <td height="39" align="center" class="titletdbg"><strong>是否处理该订单</strong></td> <td colspan="3">&nbsp;<{$rs.orderform11|ui_checkbox_shenghe="orderform11",###}>(√表示已处理)</td> </tr> <tr> <td height="39" align="center" class="titletdbg"><strong>处理意见</strong></td> <td colspan="3"> <input type="radio" name="orderform12" id="orderform12" value="1" <{$rs.orderform12|echoChecked="1",###}> > 欢迎你预定本产品,你的定单已接受,受理情况或部份变动请参考我们的处理意见<br> <input type="radio" name="orderform12" id="orderform12" value="2" <{$rs.orderform12|echoChecked="2",###}>> 欢迎你预定本产品,你指定的服务不能成行,推荐预定以下相近产品或服务<br> <input type="radio" name="orderform12" id="orderform12" value="3" <{$rs.orderform12|echoChecked="3",###}> > 对不起你的订单已失效,欢迎再次定购本网产品,谢谢你的支持</td> </tr> <tr> <td height="39" align="center" class="titletdbg">综合处理意见及理由</td> <td colspan="3"> <textarea name="orderform13" id="orderform13" cols="60" rows="7"><{$rs.orderform13}></textarea></td> </tr> <tr> <td height="39" align="center" class="titletdbg">总金额:</td> <td colspan="3"> <input type="text" name="orderform16" id="orderform16" size="8" value="<{$rs.orderform16}>"> 元,&nbsp;定金: <input type="text" name="orderform17" id="orderform17" size="8" value="<{$rs.orderform17}>"> 元,支付期限<input type="text" name="orderform18" id="orderform18" onClick="showCal(orderform18);" size="12" value="<{$rs.orderform18|date="Y-m-d",###}>"> 之前支付 </td> </tr> <tr> <td height="39" align="center" class="titletdbg">余款支付金额:</td> <td colspan="3"><input type="text" name="orderform19" id="orderform19" size="8" value="<{$rs.orderform19}>"> 元,支付期限:<input type="text" name="orderform20" id="orderform20" onClick="showCal(orderform20);" size="12" value="<{$rs.orderform20|date="Y-m-d",###}>"> 之前支付</td> </tr> <tr> <td height="39" colspan="4" align="center" class="titletdbg">工作人员:<input readonly type="text" name="orderform22" id="orderform22" value="<{$Think.session.Login.1}>"> <input type="hidden" name="orderform28" id="orderform28" value="<{$rs.orderform28|date="Y-m-d H:i:s",###}>"> <input name="issendmail" id="issendmail" type="checkbox" value="1">是否发送邮件,第一次处理时间:<{$rs.orderform28|date="Y-m-d H:i:s",###}> <br> 上次处理工作人员:<{$rs.orderform22}> <input name="mysubmit1" id="mysubmit1" type="submit" value="保存并提交回复" <if condition="($rs.orderform11 eq 1) and ($adminname neq 'admin') "> disabled="disabled" </if> > <input type="hidden" id="orderform0" name="orderform0" value="<{$rs.orderform0}>"> <input type="hidden" id="tomail" name="tomail" value="<{$rs.orderform26}>"> </td> </tr> </form> <form action="orderform_savekccycontent" method="post" name="formotherchili"> <tr> <td height="39" colspan="4" align="center" class="titletdbg"> 处理客人操作的信息 <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="19%" height="32" align="right"><strong>客服人员处理意见</strong></td> <td> <textarea name="orderform24kn" cols="60" rows="8" id="orderform24kn"><{$rs.orderform24|getformcontent=###,"客内"}></textarea> </td> </tr> <tr> <td height="32">&nbsp;</td> <td>客服人员<input type="text" name="orderform24km" id="orderform24km" value="<{$rs.orderform24|getformcontent=###,"客名"}>"> 处理时间 <input type="text" name="orderform24ks" id="orderform24ks" onClick="showCal(orderform24ks);" value="<{$rs.orderform24|getformcontent=###,"客时"}>"> <input type="submit" name="submitd1" id="submitd1" value="提交"></td> </tr> <tr> <td width="19%" height="32" align="right"><strong>操作人员处理意见</strong></td> <td> <textarea name="orderform24cn" cols="60" rows="8" id="orderform24cn"><{$rs.orderform24|getformcontent=###,"操内"}></textarea></td> </tr> <tr> <td height="32">&nbsp;</td> <td>操作人员 <input type="text" name="orderform24cm" id="orderform24cm" value="<{$rs.orderform24|getformcontent=###,"操名"}>"> 处理时间 <input type="text" name="orderform24cs" id="orderform24cs" onClick="showCal(orderform24cs);" value="<{$rs.orderform24|getformcontent=###,"操时"}>"> <input type="submit" name="submitd2" id="submitd2" value="提交"></td> </tr> <tr> <td width="19%" height="32" align="right"><strong>财务人员处理意见</strong></td> <td> <textarea name="orderform24cain" cols="60" rows="8" id="orderform24cain"><{$rs.orderform24|getformcontent=###,"财内"}></textarea></td> </tr> <tr> <td height="32">&nbsp;</td> <td>财务人员 <input type="text" name="orderform24caim" id="orderform24caim" value="<{$rs.orderform24|getformcontent=###,"财名"}>"> 处理时间 <input type="text" name="orderform24cais" id="orderform24cais" onClick="showCal(orderform24cais);" value="<{$rs.orderform24|getformcontent=###,"财时"}>"> <input type="submit" name="submitd3" id="submitd3" value="提交"></td> </tr> <tr> <td width="19%" height="32" align="right"><strong>产品人员处理意见</strong></td> <td> <textarea name="orderform24cann" cols="60" rows="8" id="orderform24cann"><{$rs.orderform24|getformcontent=###,"产内"}></textarea></td> </tr> <tr> <td height="32">&nbsp;</td> <td>产品人员 <input type="text" name="orderform24canm" id="orderform24canm" value="<{$rs.orderform24|getformcontent=###,"产名"}>"> 处理时间 <input type="text" name="orderform24cans" id="orderform24cans" onClick="showCal(orderform24cans);" value="<{$rs.orderform24|getformcontent=###,"产时"}>"> <input type="submit" name="submitd4" id="submitd4" value="提交"></td> </tr> <input type="hidden" name="id" id="id" value="<{$rs.orderform0}>"> </form> </table> </td> </tr> <form action="pay_savedingjing" method="post" name="pay_savedingjing"> <tr> <td height="39" align="center" class="titletdbg">订金确认</td> <td colspan="3"><if condition="$rs.pay6 eq 1"> 已确认 <else/> 未确认 </if> </td> </tr> <tr> <td height="39" align="center" class="titletdbg">订金金额</td> <td> <input type="text" name="pay3" id="pay3" value="<{$rs.pay3}>"></td> <td class="titletdbg">&nbsp;是否确认</td> <td >&nbsp; <{$rs.pay6|ui_checkbox_shenghe="pay6",###,"1"}>(若确认请打上勾) </td> </tr> <tr> <td height="39" align="center" class="titletdbg">支付方式</td> <td>&nbsp; <{$rs.pay5|ui_select_paytype="pay5",###}></td> <td class="titletdbg">支付时间</td> <td> <input type="text" name="pay4" id="pay4" onClick="showCal(pay4);" value="<{$rs.pay4|date='Y-m-d H:i:s',###}>"></td> </tr> <tr> <td height="39" align="center" class="titletdbg">备注</td> <td colspan="3"> <textarea name="pay11" id="pay11" cols="70" rows="5"><{$rs.pay11}></textarea></td> </tr> <tr> <td height="39" align="center" class="titletdbg">&nbsp;</td> <td colspan="3"><input type="submit" name="djmybutton" id="djmybutton" value="提 交" <if condition="$rs.pay6 eq 1">disabled="disabled"</if> > <input type="hidden" id="pay13" name="pay13" value="<{$Think.session.Login.1}>"> <input type="hidden" id="pay0" name="pay0" value="<{$rs.pay0}>"> <input type="hidden" id="orderid" name="orderid" value="<{$rs.orderform0}>"> </td> </tr> </form> <form action="pay_saveyukuan" method="post" name="formd"> <tr> <td height="39" align="center" class="titletdbg">余款确认</td> <td colspan="3">&nbsp;<if condition="$rs.pay10 eq 1"> 已确认 <else/> 未确认 </if></td> </tr> <tr> <td height="39" align="center" class="titletdbg">余款金金额</td> <td> <input type="text" name="pay7" id="pay7" value="<{$rs.pay7}>"></td> <td class="titletdbg">&nbsp;余款确认</td> <td >&nbsp; <{$rs.pay10|ui_checkbox_shenghe="pay10",###,"1"}>(若确认请打上勾) </tr> <tr> <td height="39" align="center" class="titletdbg">支付方式</td> <td>&nbsp; <{$rs.pay9|ui_select_paytype="pay9",###}></td> <td class="titletdbg">支付时间</td> <td> <input type="text" name="pay8" id="pay8" onClick="showCal(pay8);" value="<{$rs.pay8|date='Y-m-d H:i:s',###}>"></td> </tr> <tr> <td height="39" align="center" class="titletdbg">备注</td> <td colspan="3"> <textarea name="pay12" id="pay12" cols="70" rows="5"><{$rs.pay12}></textarea></td> </tr> <tr> <td height="39" align="center" class="titletdbg">&nbsp;</td> <td colspan="3"><input type="submit" name="dmybutton" id="dmybutton" value="提 交" <if condition="$rs.pay10 eq 1">disabled="disabled"</if> > <input type="hidden" id="pay14" name="pay14" value="<{$Think.session.Login.1}>"> <input type="hidden" id="pay0" name="pay0" value="<{$rs.pay0}>"> <input type="hidden" id="orderid" name="orderid" value="<{$rs.orderform0}>"> </td> </tr> </form> </table> <script language="javascript"> $("#djmybutton").bind("click", function(){ djdpaytime=$("#paytimeearnestmoney").val(); if(!djdpaytime.match(/^[\d]{4}\-[\d]{1,2}\-[\d]{1,2}/)) { alert("订金的支付时间不能为空"); $("#paytimeearnestmoney").focus(); return false; } return true; }); </script> </body> </html>
10npsite
trunk/guanli/Tpl/default/orderform/editorder.htm
HTML
asf20
14,238
你的订单成功了,订单号为<{$Think.get.orderid}>.
10npsite
trunk/guanli/Tpl/default/Sendmail/ReceiveOrder.htm
HTML
asf20
59
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>无标题文档</title> </head> <body> </body> </html>
10npsite
trunk/guanli/Tpl/default/price/saveroomprice.htm
HTML
asf20
316
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <script src="/Public/jsLibrary/jquery/jquery.js"></script> <script src="/Public/jsLibrary/Jslibary.js"></script> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link href="/guanli/Inc/Css.css" rel="stylesheet" type="text/css" /> <title>时间段管理</title> </head> <body> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="9%" height="41">&nbsp;</td> <td width="91%"><h2>您现在操作的是:<{$hotelrs.hotel1}></h2></td> </tr> </table> <div style="margin-left:100px;"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <volist name="pricers" id="vo"> <tr> <td width="22%"><{$i}>、<{$vo.price1}></td><td width="78%"><a href="<{:U('price/timeduanhtm')}>/hid/<{$hid}>/action/edit/pid/<{$vo.price0}>">修改</a> , <a href="<{:U('price/timeduanhtm')}>/hid/<{$hid}>/action/del/pid/<{$vo.price0}>">删除</a></td> </tr> </volist> </table> <hr size="1" width="90%"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <form action="" method="post" name="formedit"> <tr> <td>&nbsp;</td> <td>您在做如下修改:</td> </tr> <tr> <td align="right">名称:</td> <td>&nbsp;<input name="duanname" id="duanname" size="32" type="text" /></td> </tr> <tr> <td align="right">起始时间:</td> <td><input name="starttime" id="starttime" size="32" type="text" /></td> </tr> <tr> <td align="right">结束时间:</td> <td><input name="overtime" id="overtime" size="32" type="text" /></td> </tr> <tr> <td width="12%" align="right">&nbsp;</td> <td width="88%">&nbsp;</td> </tr> </form> </table> </div> </body> </html>
10npsite
trunk/guanli/Tpl/default/price/timeduanhtm.htm
HTML
asf20
1,931
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <script src="/Public/jsLibrary/jquery/jquery.js"></script> <script src="/Public/jsLibrary/Jslibary.js"></script> <link href="/guanli/Inc/Css.css" rel="stylesheet" type="text/css" /> <title>房型及价格</title> </head> <body> <div><strong><a href="">进入本酒店所有的房型列表</a></strong></div> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <form action="<{:U('price/saveroomprice')}>" method="post" name="editpriceform" id="editpriceform"> <tr> <td width="32%" height="45" valign="top"> <div><strong>请选择下面的一个出发时间段修改:</strong></div> <select name="chufaduan" size="1" id="chufaduan"> <option value="">请选择...</option> <volist name="rsprice" id="vo"> <option <if condition="$pid eq $vo['price0']"> selected="selected"</if> value="<{$vo.price0}>"><{$vo.price1}></option> </volist> </select> <div><br> <a href="<{:U('hotelroom/edithotelprice')}>/rid/<{$rid}>">点击添加新的时间段:</a></div> </td> <td width="68%" height="45" valign="top"> <div><strong>房型:<{$rs.hotelroom1}></strong>(<span style="color:#F00" id="thischufaname"><{$thisv.price1}></span>)</div> <div>时间段名称:<input type="text" value="<{$thisv.price1}>" name="chufaname" id="chufaname" size="32"></div> <div>起始时间:<input readonly="readonly" type="text" value="<{$thisv.price13|date="Y-m-d",###}>" name="starttime" id="starttime" size="12" onClick="showCal(this);"></div> <div>结束时间:<input readonly="readonly" type="text" value="<{$thisv.price14|date="Y-m-d",###}>" name="overtime" id="overtime" size="12" onClick="showCal(this);"></div> <div>市场价:<input type="text" value="<{$thisv.price8}>" name="martkprice" id="martkprice" size="12"></div> <div>本站价:<input type="text" value="<{$thisv.price9}>" name="myprice" id="myprice" size="12"></div> <div>房 差:<input type="text" value="<{$thisv.price11}>" name="fangcha" id="fangcha" size="12"></div> <div>可预定间数:<input type="text" value="<{$thisv.price12}>" name="kucun" id="kucun" size="12"></div> <input type="button" value="修 改" name="mysubmit" id="mysubmit"> <input type="button" value="删 除" id="mybuttom" name="mybuttom" /></td> </tr> <input type="hidden" name="thisindex" id="thisindex" value="<{$thisv.price0}>"><!--显示当前正在修改的值--> <input type="hidden" name="rid" id="rid" value="<{$rid}>"> </form> </table> <script language="javascript"> $(document).ready(function(){ //var checkText=$("#chufaduan").find("option:selected").text();//获取选中的值,以便于右边计算 //给选择出发时间段的select绑定一个事件 $("#chufaduan").change(function(){ checkIndex=$("#chufaduan").val() window.location.href="/guanli/u.php/hotelroom/edithotelprice/rid/<{$rid}>/pid/"+checkIndex; }); //验证提交时数据 $("#mysubmit").bind("click",function(){ chufaname=$("#chufaname").val(); if(!nzeletype("chufaname","时间段名不能为空","string")) return false; if(!nzeletype("starttime","起始时间不能为空","date")) return false; if(!nzeletype("overtime","结束时间不能为空","date")) return false; if(!nzeletype("martkprice","请输入正确的市场价","float")) return false; if(!nzeletype("myprice","请输入正确的梦之旅价","float")) return false; if(!nzeletype("fangcha","请输入正确的房差,没有可填写0","int")) return false; if(!nzeletype("kucun","请输入正确的可预定房间数,没有可填写0","int")) return false; //下一步比较值的合理性 $("#editpriceform").submit(); return false; }); //================================初始化表单值 //当没有出发时间段时.做为新的值添加 var initpid="<{$pid}>"; if(initpid==""){ $("#starttime").val(""); $("#overtime").val(""); $("#thischufaname").html(" 加新的时间段值"); $("#mysubmit").val("添 加"); $("#mybuttom").hide(); } }); </script> </body> </html>
10npsite
trunk/guanli/Tpl/default/hotelroom/edithotelprice.htm
HTML
asf20
4,436
<script src="/Public/jsLibrary/jquery/jquery.js"></script> <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script> <script src="/Public/jsLibrary/Jslibary.js"></script> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>房型管理</title> <link href="/guanli/Inc/Css.css" rel="stylesheet" type="text/css" /> <style type="text/css"> a { font-size: 12px; } </style> </head> <body> 客栈列表<br> <table width="95%" border="0" align="center" cellpadding="0" cellspacing="1" > <Tr><TD> <a href="/guanli/system/menusys/Sys_Add.php?MenuId=<{$MenuId}>&OwerID=&PMID=<{$Think.get.PMID}>&Title=添加客栈列表" target="_self" class="Link12">添加房型</a> <a href="/guanli/system/price/Index.php?MenuId=612&PMID=<{$hid}>">进入时间段设置与管理</a> </td></tr> </table> <div style="margin-left:50px;"> <div>请选择下面的时间段: <select name="choosetime" id="choosetime"> <volist name="pricers" id="voprice"> <option <if condition="$pid eq $voprice['price0']">selected</if> value="<{$voprice['price0']}>::<{$voprice.price19}>"><{$voprice.price1}><{$voprice.price13|date="Y-m-d",###}>至<{$voprice.price14|date="Y-m-d",###}></option> </volist> </select> </div> </div> <table width="95%" border="0" cellspacing="0" cellpadding="0" align="center"> <form > <tr> <td width="30%">关键字:<input name="keyword" type="text" /> <input name="搜索" type="submit" value="搜索" /></td> <td width="67%"></td> <td width="3%">&nbsp;</td> </tr> </form> </table> <table width="95%" border="0" align="center" cellpadding="0" cellspacing="1" class="YKTtable"> <tr > <td width="45" class="YKTth"><div align="center">ID</div></td> <td width="178" class="YKTth">名称(房间类型)</td> <td width="58" class="YKTth">市场价</td> <td width="61" class="YKTth">梦之旅价</td> <td width="75" class="YKTth">提前预定天数</td> <td width="91" class="YKTth">定金支付比例</td> <td width="111" class="YKTth">库存数</td> <td width="111" class="YKTth">底价</td> <td width="165" class="YKTth"><div align="center">日历价格设置</div></td> <td width="168" class="YKTth"><div align="center">操 作</div></td> </tr> <form action="<{:U('price/saveroomprice')}>" method="post" name="rform" id="rform"> <volist name="rs" id="vo"> <tr id="price<{$vo.hotelroom0}>" data=""> <td class="YKTtd" ><div align=""> <{$vo.hotelroom0}> </div> </td> <td class="YKTtd" ><div align=""><{$vo.hotelroom1}> (<if condition="$vo.hotelroom4 eq '5755'">多床间<else />标准间</if>) </div> </td> <td class="YKTtd" ><div align=""><input name="marktprice<{$vo.hotelroom0}>" id="marktprice<{$vo.hotelroom0}>" type="text" size="4"></div> </td> <td class="YKTtd" ><div align=""><input name="mzlprice<{$vo.hotelroom0}>" id="mzlprice<{$vo.hotelroom0}>" type="text" size="4"></div> </td> <td class="YKTtd" ><div align=""><input name="tiqianyudin<{$vo.hotelroom0}>" id="tiqianyudin<{$vo.hotelroom0}>" type="text" size="4"></div> </td> <td class="YKTtd" ><div align=""><input name="zhifubili<{$vo.hotelroom0}>" id="zhifubili<{$vo.hotelroom0}>" type="text" size="4"></div> </td> <td class="YKTtd" ><div align=""><input value="" name="kucunshu<{$vo.hotelroom0}>" id="kucunshu<{$vo.hotelroom0}>" type="text" size="4"></div> </td> <td class="YKTtd" ><div align=""><input name="dijia<{$vo.hotelroom0}>" id="dijia<{$vo.hotelroom0}>" type="text" size="4"></div> </td> <td class="YKTtd" ><div align=""> <a href="/inc/calendarprice.php?MenuId=<{$MenuId}>&hid=<{$hid}>&tid=<{$vo.hotelroom0}>&fieldid=12">日历价格设置</a> </div> </td> <td class="YKTtd" ><div align="center"> <a href="/guanli/system/menusys/Sys_Update.php?MenuId=<{$MenuId}>&ID=<{$vo.hotelroom0}>&CMID=&PMID=<{$hid}>&OwerID=<{$vo.hotelroom0}>&Title=修改客栈列表&CurrPage=">修改房型</a> | <a href="/guanli/system/menusys/Sys_Delete.php?MenuId=<{$MenuId}>&ID=<{$vo.hotelroom0}>&CMID=&PMID=<{$hid}>&OwerID=<{$vo.hotelroom0}>&Title=删除客栈列表">删除房型</a> </div></td> </volist> <input type="hidden" value="<{$pid}>" name="thispid" id="thispid"> <input type="hidden" value="<{$hid}>" name="hid" id="hid"> <input type="hidden" value="<{$MenuId}>" name="MenuId" id="MenuId"> <input type="hidden" value="<{$Think.get.PMID}>" name="PMID" id="PMID"> <input type="hidden" value="" name="zv" id="zv"> </form> </table> <div align='right' style="margin-right:200px;"><input type="button" name="mysave" id="mysave" value="保 存"> </div> <script> $(document).ready(function(){ //========================每次选择后就重新加载 $("#choosetime").change(function(){ checkIndex=$("#choosetime").val(); tt=getkuohaostr(checkIndex,/^([\d]+)/); window.location.href="<{:U('hotelroom/listroom')}>/MenuId/<{$MenuId}>/hid/<{$hid}>/pid/"+tt+"/PMID/<{$Think.get.PMID}>"; }); //添加保存时的数据检查 $("#mysave").bind("click",function(){ var falg=0;//是否通过检查标识 $("input[id^='marktprice']").each(function(){ falg=0; id=$(this).attr("id"); if(!nzeletype(id,"请输入正确的市场价","float")) return false; falg=1; }); $("input[id^='mzlprice']").each(function(){ falg=0; id=$(this).attr("id"); if(!nzeletype(id,"请输入正确的梦之价","float")) return false; falg=1; }); if(falg==0){ return false; } //=============================================组合值 zvs="";//组合后的字符串 $("tr[id^='price']").each(function(){ pid=$(this).attr("id"); pid=pid.replace("price",""); zvs=zvs+"{id:"+pid+"}{scj:"+$("#marktprice"+pid).val()+"}{mzlj:"+$("#mzlprice"+pid).val()+"}{tiqianyudin:"+$("#tiqianyudin"+pid).val()+"}{zfbl:"+$("#zhifubili"+pid).val()+"}{dijia:"+$("#dijia"+pid).val()+"}{kucunshu:"+$("#kucunshu"+pid).val()+"},"; }); zvs=zvs.replace(/,$/,""); if(!zvs.match(/^[\{\w\:\.\,}]+$/)){ alert("格式不对,请认真填写"); return false; } $("#zv").val(zvs); $("#rform").submit(); }); //当没有选定的时间段值时,初始化默认第一个的值 pid="<{$pid}>"; //var checkText=$("#chufaduan").find("option:selected").text();//获取选中的值,以便于右边计算 if(pid!="0"){ initsrr="<{$initarr.price19}>"; inum=-1; if(initsrr!=""){ initarr=initsrr.split(","); inum=initarr.length; } //=====================循环给相应的dom赋值 $("input[id^='marktprice']").each(function(){ for(i=0;i<inum;i++){ thisid=$(this).attr("id"); thisid=thisid.replace("marktprice",""); temp=getkuohaostr(initarr[i],/\{id:([\d\.]+)\}/); if(temp==thisid) $(this).val(getkuohaostr(initarr[i],/\{scj:([\d\.]+)\}/)); } }); $("input[id^='mzlprice']").each(function(){ for(i=0;i<inum;i++){ thisid=$(this).attr("id"); thisid=thisid.replace("mzlprice",""); temp=getkuohaostr(initarr[i],/\{id:([\d\.]+)\}/); if(temp==thisid) $(this).val(getkuohaostr(initarr[i],/\{mzlj:([\d\.]+)\}/)); } }); $("input[id^='dijia']").each(function(){ for(i=0;i<inum;i++){ thisid=$(this).attr("id"); thisid=thisid.replace("dijia",""); temp=getkuohaostr(initarr[i],/\{id:([\d\.]+)\}/); if(temp==thisid) $(this).val(getkuohaostr(initarr[i],/\{dijia:([\d\.]+)\}/)); } }); $("input[id^='zhifubili']").each(function(){ for(i=0;i<inum;i++){ thisid=$(this).attr("id"); thisid=thisid.replace("zhifubili",""); temp=getkuohaostr(initarr[i],/\{id:([\d\.]+)\}/); if(temp==thisid) $(this).val(getkuohaostr(initarr[i],/\{zfbl:([\d\.]+)\}/)); } }); $("input[id^='tiqianyudin']").each(function(){ for(i=0;i<inum;i++){ thisid=$(this).attr("id"); thisid=thisid.replace("tiqianyudin",""); temp=getkuohaostr(initarr[i],/\{id:([\d\.]+)\}/); if(temp==thisid) $(this).val(getkuohaostr(initarr[i],/\{tiqianyudin:([\d\.]+)\}/)); } }); $("input[id^='kucunshu']").each(function(){ for(i=0;i<inum;i++){ thisid=$(this).attr("id"); thisid=thisid.replace("kucunshu",""); temp=getkuohaostr(initarr[i],/\{id:([\d\.]+)\}/); if(temp==thisid) $(this).val(getkuohaostr(initarr[i],/\{kucunshu:([\d\.]+)\}/)); } }); } if(pid=="0"){ var firststr =$("#choosetime").get(0).options[0].value;//获取第一项的值 inum=-1; $("#thispid").val(getkuohaostr(firststr,/^([\d]+)/)); if(firststr!=""){ firststr=firststr.replace(/^[\d]+\:\:/,""); initarr=firststr.split(","); inum=initarr.length; } //=====================循环给相应的dom赋值 $("input[id^='marktprice']").each(function(){ for(i=0;i<inum;i++){ thisid=$(this).attr("id"); thisid=thisid.replace("marktprice",""); temp=getkuohaostr(initarr[i],/\{id:([\d\.]+)\}/); if(temp==thisid) $(this).val(getkuohaostr(initarr[i],/\{scj:([\d\.]+)\}/)); } }); $("input[id^='mzlprice']").each(function(){ for(i=0;i<inum;i++){ thisid=$(this).attr("id"); thisid=thisid.replace("mzlprice",""); temp=getkuohaostr(initarr[i],/\{id:([\d\.]+)\}/); if(temp==thisid) $(this).val(getkuohaostr(initarr[i],/\{mzlj:([\d\.]+)\}/)); } }); $("input[id^='dijia']").each(function(){ for(i=0;i<inum;i++){ thisid=$(this).attr("id"); thisid=thisid.replace("dijia",""); temp=getkuohaostr(initarr[i],/\{id:([\d\.]+)\}/); if(temp==thisid) $(this).val(getkuohaostr(initarr[i],/\{dijia:([\d\.]+)\}/)); } }); $("input[id^='zhifubili']").each(function(){ for(i=0;i<inum;i++){ thisid=$(this).attr("id"); thisid=thisid.replace("zhifubili",""); temp=getkuohaostr(initarr[i],/\{id:([\d\.]+)\}/); if(temp==thisid) $(this).val(getkuohaostr(initarr[i],/\{zfbl:([\d\.]+)\}/)); } }); $("input[id^='tiqianyudin']").each(function(){ for(i=0;i<inum;i++){ thisid=$(this).attr("id"); thisid=thisid.replace("tiqianyudin",""); temp=getkuohaostr(initarr[i],/\{id:([\d\.]+)\}/); if(temp==thisid) $(this).val(getkuohaostr(initarr[i],/\{tiqianyudin:([\d\.]+)\}/)); } }); $("input[id^='kucunshu']").each(function(){ for(i=0;i<inum;i++){ thisid=$(this).attr("id"); thisid=thisid.replace("kucunshu",""); temp=getkuohaostr(initarr[i],/\{id:([\d\.]+)\}/); if(temp==thisid) $(this).val(getkuohaostr(initarr[i],/\{kucunshu:([\d\.]+)\}/)); } }); } //默认库存数,当没有库存数时,就默认房型里填写的值 显示格式为{id:值1} strl="{<volist name='rs' id='vo'><{$vo.hotelroom0}>:<{$vo.hotelroom8}>,</volist>}"; $("input[id^='kucunshu']").each(function(){ v=$(this).val(); if(v==""){ id=$(this).attr("id"); id=id.replace("kucunshu",""); aa=strl.match(/[\d]+\:[\d\.]*/g); if(aa!=null){ numx=aa.length; for(k=0;k<numx;k++){ tempjs=aa[k].match(/[\d]*$/); idn=getkuohaostr(aa[k],/([\d]+)\:/); if(idn==id && tempjs!=""){ $(this).val(tempjs); } } } } }); }); </script> </body> </html>
10npsite
trunk/guanli/Tpl/default/hotelroom/listroom.htm
HTML
asf20
11,682
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <script language=javascript> function doPrint() { bdhtml=window.document.body.innerHTML; sprnstr="<!--startprint-->"; eprnstr="<!--endprint-->"; prnhtml=bdhtml.substr(bdhtml.indexOf(sprnstr)+17); prnhtml=prnhtml.substring(0,prnhtml.indexOf(eprnstr)); window.document.body.innerHTML=prnhtml; window.print(); } </script> <title>支付返回结果页面</title> </head> <body> <if condition="$isprint eq 'yes'"> <div style="margin-top:10px; margin-bottom:10px;" align="center"><input name="printdo2" id="printdo2" onclick="doPrint()" type="button" value="打 印" /></div> </if> <!--startprint--> <style type="text/css"> *{margin:0 auto;padding:0;} img{border:0;} ul,li{marign:0;padding:0;} body,td,th { font-size: 12px; } body { margin-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; } tr .STY{ border-top: solid #D0D0D0; border-top-width: thin; } #main{width:600px;border:15px #6c6c6c solid;} #main .nei{width:568px;border:6px #b2b2b2 solid;padding-left:10px;padding-right:10px;} .nei h5{font-size:12px;border-bottom:1px #999999 dashed; text-align:left;font-weight:400;height:18px;margin-bottom:20px;} /*============================box'style=============================*/ .nei .logo{margin-top:10px;} .nei .box{width:470px;} .nei .box img{width:100px;height:58px;text-align:left;display:block;float:left;} .nei .box .bj{background:url(__PUBLIC__/images/zfbg1.gif) no-repeat top left;width:365px;height:95px;margin-left:0px;float:left;text-align:left;} .nei .box .bj2{width:365px;height:98px;float:left;text-align:left;background:url(__PUBLIC__/images/zfbg1_06-10.gif) left bottom no-repeat;position:relative;} .nei .box .bj2 h4{background:url(__PUBLIC__/images/zfbg1_01.gif) top left no-repeat;width:100%;height:8px;margin:0;padding:0;} .nei .box .bj2 h3{width:352px;height:85px;border-left:#7ba0c2 2px solid;border-right:2px #7ba0c2 solid;float:left;position:absolute;top:8px;left:1px;} /*========================================bj3'style======================================*/ .nei .box .bj3{width:365px;height:160px;float:left;text-align:left;background:url(__PUBLIC__/images/zfbg1_06-10.gif) left bottom no-repeat;position:relative;} .nei .box .bj3 h4{background:url(__PUBLIC__/images/zfbg1_01.gif) top left no-repeat;width:100%;height:8px;margin:0;padding:0;} .nei .box .bj3 h3{width:352px;height:145px;border-left:#7ba0c2 2px solid;border-right:2px #7ba0c2 solid;float:left;position:absolute;top:8px;left:1px;} a:link,a:visited{color:#6633FF;text-decoration:none;} a:hover{color:#FF3366;text-decoration:underline;} </style> <div id="main" align="center"> <div class="nei" align="center"> <img src="<{$SYS_config.siteurl}>/Public/images/logo.gif"> <div align="center"><strong>您的支付确认书<br> </strong></div> <div style="line-height:40px; height:40px;"></div> <div align="left"> <p><strong><{$rs.orderform5}></strong>先生/小姐,您好!<{$SYS_config.siteurl}><br /> 欢迎预订梦之旅, 您的支付已成功,下面是您的预订及支付信息,请您仔细阅读,若有疑问,随时咨询梦之旅客服人员! <br /> <br /> <br /> <br> </p> </div> <h5> </h5> <div align="left"> <table border="0"> <tbody> <tr> <td valign="top" width="100"><img src="<{$Think.PICPATH}>/Public/images/tu2.jpg" /></td> <td width="430"><table border="0" cellspacing="0" cellpadding="0" width="394"> <tbody> <tr> <td height="12" colspan="3"><img src="<{$Think.PICPATH}>/Public/images/zfbg1_t.gif" /></td> </tr> <tr> <td background="<{$SYS_config.siteurl}>/Public/images/zfbg1_l.gif" width="6"></td> <td width="100%"><table border="0" cellspacing="10" cellpadding="5" width="100%"> <tbody> <tr> <td width="25%" align="right"><strong>订单号:</strong></td> <td width="75%"><{$rs.orderform3}></td> </tr> <tr> <td align="right"><strong>姓&nbsp; 名:</strong></td> <td><{$rs.orderform5}></td> </tr> </tbody> </table></td> <td background="<{$SYS_config.siteurl}>/Public/images/zfbg1_r.gif" width="50"> </td> </tr> <tr> <td height="10" colspan="3"><img src="<{$SYS_config.siteurl}>/Public/images/zfbg1_b.gif" /></td> </tr> </tbody> </table></td> </tr> </tbody> </table> </div> <h5> </h5> <div align="left"> <table border="0"> <tbody> <tr> <td valign="top" width="128"><img src="<{$SYS_config.siteurl}>/Public/images/tu1.jpg" width="128" height="59" /></td> <td width="100%"><table border="0" cellspacing="0" cellpadding="0" width="361"> <tbody> <tr> <td height="12" colspan="3"><img src="<{$SYS_config.siteurl}>/Public/images/zfbg1_t.gif" /></td> </tr> <tr> <td background="<{$SYS_config.siteurl}>/Public/images/zfbg1_l.gif" width="7"></td> <td width="347">产品<br /> <hr /> <{$hotelrs.hotel1|htmlspecialchars=###}> <br /></td> <td background="<{$SYS_config.siteurl}>/Public/images/zfbg1_r.gif" width="7"> </td> </tr> <tr> <td height="10" colspan="3"><img src="<{$SYS_config.siteurl}>/Public/images/zfbg1_b.gif" /></td> </tr> </tbody> </table></td> </tr> </tbody> </table> <p align="left"><br /> <br /> </p> </div> <h5> </h5> <div align="left"> <table border="0"> <tbody> <tr> <td valign="top" width="100">集合及机场接送信息:</td> <td width="361"><table border="0" cellspacing="0" cellpadding="0" width="361"> <tbody> <tr> <td height="12" colspan="3"><img src="<{$SYS_config.siteurl}>/Public/images/zfbg1_t.gif" /></td> </tr> <tr> <td background="<{$SYS_config.siteurl}>/Public/images/zfbg1_l.gif" width="7"></td> <td width="347"> <if condition="$orderinfors.jiejisongjishengqin eq ''"> 无 <else /> </if> </td> <td background="<{$SYS_config.siteurl}>/Public/images/zfbg1_r.gif" width="7"> </td> </tr> <tr> <td height="10" colspan="3"><img src="<{$SYS_config.siteurl}>/Public/images/zfbg1_b.gif" /></td> </tr> </tbody> </table></td> </tr> </tbody> </table> </div> <h5> </h5> <div align="left"> <table border="0"> <tbody> <tr> <td valign="top" width="100"><img src="<{$SYS_config.siteurl}>/Public/images/tu4.jpg" /></td> <td width="361"><table border="0" cellspacing="0" cellpadding="0" width="361"> <tbody> <tr> <td height="12" colspan="3"><img src="<{$SYS_config.siteurl}>/Public/images/zfbg1_t.gif" /></td> </tr> <tr> <td background="<{$SYS_config.siteurl}>/Public/images/zfbg1_l.gif" width="7"></td> <td width="347"><table border="0" cellspacing="10" width="100%"> <tbody> <tr> <td width="50%" align="right"><strong>应付总金额:</strong></td> <td width="50%"><{$rs.orderform16}></td> </tr> <tr> <td align="right"><strong>定金支付金额:</strong></td> <td> ¥ <{$rs.pay3}>元 <if condition="$rs.pay6 neq 1">(未成功)</if> </td> </tr> <tr> <td align="right"><strong>支付方式:</strong></td> <td><{$rs.pay5}></td> </tr> <!-- 当定金支付成功并且余款大于0时显示--> <if condition="($rs.pay6 eq 1) and ($rs.pay7 gt 0)"> <tr> <td align="right">支付时间:</td> <td>&nbsp;<{$rs.pay4|date="Y-m-d",###}></td> </tr> <tr> <td align="right"></td> <td>&nbsp;</td> </tr> <tr> <td align="right">余款次支付金额</td> <td>&nbsp;¥ <{$rs.pay7}>元 <if condition="$rs.pay10 neq 1">(未成功)</if></td> </tr> <tr> <td align="right">支付时间</td> <td>&nbsp;<{$rs.pay8|date="Y-m-d",###}></td> </tr> <tr> <td align="right">支付方式</td> <td>&nbsp;<{$rs.pay9}></td> </tr> </if> <!-- 如果已经支付了第三次金额则显示出来--> <if condition="($payinfors.je3isconfim eq 1) and ($payinfors.je3 gt 0)"> </if> <!-- 如果已经支付了第四次金额则显示出来--> <if condition="($payinfors.je4isconfim eq 1) and ($payinfors.je4 gt 0)"> </if> </tbody> </table></td> <td background="<{$SYS_config.siteurl}>/Public/images/zfbg1_r.gif" width="7"> </td> </tr> <tr> <td height="10" colspan="3"><img src="<{$SYS_config.siteurl}>/Public/images/zfbg1_b.gif" /></td> </tr> </tbody> </table></td> </tr> </tbody> </table> </div> <h5>&nbsp;</h5> <div align="left"> <p><br /> 您也可以进入您的订单中获取与本面相同的支付确认书,<br> *关于取消及更改预订,请参考相关 退款保障!<br> <strong>联系方式:</strong> <br> <{$toursinfors.contactus}> </p> </div> <div align="center"></div> <p align="left"><br /> <a href="<{$hostname}>" target="_blank"><span lang="EN-US" xml:lang="EN-US">梦之旅官方网站</span></a></p> </div> </div> <!--endprint--> <if condition="$isprint eq 'yes'"> <div style="margin-top:20px;" align="center"><input name="printdo" id="printdo" onclick="doPrint()" type="button" value="打 印" /></div> </if> </body> </html>
10npsite
trunk/guanli/Tpl/default/affirm/hotelzhifu.htm
HTML
asf20
12,154
 <script src="/Public/jsLibrary/jquery/jquery.js"></script> <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>酒店管理</title> <link href="/guanli/Inc/Css.css" rel="stylesheet" type="text/css" /> <style type="text/css"> a { font-size: 12px; } </style> </head> <body> >客栈列表<br> <table width="95%" border="0" align="center" cellpadding="0" cellspacing="1" > <Tr><TD> <a href="../menusys/Sys_Add.php?MenuId=<{$MenuId}>&OwerID=&PMID=&Title=添加客栈列表" target="_self" class="Link12">添加客栈列表</a> </td></tr> </table> <table width="95%" border="0" cellspacing="0" cellpadding="0" align="center"> <form action="?MenuId=585" method="post" name="rform"> <tr> <td width="43%">关键字:<input name="keyword" type="text" /> <input name="搜索" type="submit" value="搜索" /></td> <td width="54%"></td> <td width="3%">&nbsp;</td> </tr> </form> </table> <table width="95%" border="0" align="center" cellpadding="0" cellspacing="1" class="YKTtable"> <tr > <td width="50" class="YKTth"><div align="center">ID</div></td> <td width="100" class="YKTth"><div align="center">客栈类别</div></td> <td width="200" class="YKTth"><div align="center">客栈名称</div></td> <td width="100" class="YKTth"><div align="center">地理类别</div></td> <td width="100" class="YKTth"><div align="center">合作方式</div></td> <td width="100" class="YKTth"><div align="center">审核</div></td> <td width="100" class="YKTth"><div align="center">加入时间</div></td> <td width="50" class="YKTth"><div align="center">排序</div></td> <td width="90" class="YKTth"><div align="center">房型及价格</div></td> <td class="YKTth"><div align="center">操 作</div></td> </tr> <volist name="rs" id="vo"> <tr> <td class="YKTtd" ><div align=""> <{$vo.hotel0}> </div> </td> <td class="YKTtd" ><div align=""> <{$vo.kzclass}> </div> </td> <td class="YKTtd" ><div align=""> <{$vo.hotel1}> </div> </td> <td class="YKTtd" ><div align=""> <{$vo.areav}> </div> </td> <td class="YKTtd" ><div align=""> <{$vo.hezuofs}> </div> </td> <td class="YKTtd" ><div align=""> <{$vo.isshenhe}></div> </td> <td class="YKTtd" ><div align=""> <{$vo.hotel24|date="Y-d-d h:i",###}></div> </td> <td class="YKTtd" ><div align=""> <{$vo.hotel25}> </div> </td> <td class="YKTtd" ><div align=""> <a href="#">房型及价格</a> </div> </td> <td class="YKTtd" ><div align="center"> <a href="/guanli/system/menusys/Sys_Update.php?MenuId=<{$MenuId}>&ID=<{$vo.hotel0}>&CMID=&PMID=&OwerID=<{$vo.hotel0}>&Title=修改客栈列表&CurrPage=">修改</a> | <a href="/guanli/system/menusys/Sys_Delete.php?MenuId=<{$MenuId}>&ID=<{$vo.hotel0}>&CMID=&PMID=&OwerID=<{$vo.hotel0}>&Title=删除客栈列表">删除</a> </div></td> </volist> </table> <div align='right'><div style='margin-right:30px;'><{$show}></div></div> </body> </html>
10npsite
trunk/guanli/Tpl/default/hotel/hotellist.htm
HTML
asf20
3,383
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>无标题文档</title> </head> <body> </body> </html>
10npsite
trunk/guanli/Tpl/default/pay/saveyukuan.htm
HTML
asf20
316
<html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>系统首页</title> <style type="text/css"> <!-- body,td,th { font-size: 12px; } body { margin-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; } --> </style></head> <body> <table width="100%" border="0" cellspacing="1" cellpadding="0" bgcolor="#999999" align="center" height="252"> <tr align=center bgcolor="#d6ded6"> <td height="22">&nbsp; </td> </tr> <tr bgcolor="#f0f3f0" align=center> <td height="227"><br> <br> <strong> <span style="color:#F00">祝你每天工作开心! </span> </strong> <br> <a href="http://www.dreams-travel.com" target="_blank">http://www.dreams-travel.com</a><br> <br> <span></span><br> <br> <font color="#0000ff"></font><br><br> <a href="http://www.dreams-travel.com" target="_blank">查看更多联系方式</a></td> </tr> </table> </body> </html>
10npsite
trunk/guanli/Main.php
Hack
asf20
1,169
<?php require "../global.php";?> <html > <head> <title>管理后台</title> <link href="../Inc/Css.css" rel="stylesheet" type="text/css" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> </head> <style type="text/css"> <!-- body { margin-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; } --> </style> <style type="text/css"> <!-- TD { color: #333333; VERTICAL-ALIGN: top; font-size: 12px; } //--> </style> <? //$dirname."/". require $SystemConest[0]."/"."inc/Uifunction.php"; if(isset($_SESSION["Login"])) { gourl("Main.html",1);//登陆成功前往 } include RootDir."/"."inc/const.php"; ?> <BODY bgColor=#006599 leftMargin=0 topMargin=0 marginheight="0" marginwidth="0"> <br><br><br><br> <TABLE class=tableborder cellSpacing=0 cellPadding=0 width=427 align=center border=0> <TBODY> <TR> <TD background=images/login/index_hz01.gif colSpan=3 height=64><table width="100%" height="51" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="14%" height="21">&nbsp;</td> <td width="86%">&nbsp;</td> </tr> <tr> <td>&nbsp;</td> <td><font color="#FFFFFF">管理后台登陆</font></td> </tr> </table></TD> </TR> <TR> <TD style="FONT-SIZE: 1px; LINE-HEIGHT: 1px" width=3 background=images/login/index_hz02.gif></TD> <TD style="BORDER-TOP: #666666 1px double" vAlign=top background=images/login/index_hz03.gif height=162><BR> <BR> <!-- --> <table width="100%" border="0" cellspacing="0" cellpadding="0" id="adminlogin" align="center"> <form name="form1" method="post" action="Login.php"> <tr> <td width="33%" align="right" class="td">帐 号:</td> <td width="67%" class="td"> <input type="text" name="UserName" size="20" style="border:1px solid #0D5C95;background:#fff;width:140px;height:21px;"> </td> </tr> <tr> <td width="33%" align="right" class="td">密 码:</td> <td width="67%" class="td"> <input type="password" name="PassWord" size="21" style="border:1px solid #0D5C95;background:#fff;width:140px;height:21px;"> </td> </tr> <!----> <tr> <td width="33%" class="td">&nbsp;</td> <td width="67%" class="td"> <input type=image height=33 width=83 src="images/login/index_hz04.gif" name="Submit"> </td> </tr> </form> </table> <!----> </TD> <TD style="FONT-SIZE: 1px; LINE-HEIGHT: 1px" width=3 background=images/login/index_hz02.gif></TD> </TR> <TR> <TD background=images/login/index_hz05.gif colSpan=3 height=127>&nbsp; </TD> </TR> </TBODY> </TABLE> </body> </html>
10npsite
trunk/guanli/index.php
PHP
asf20
3,253
<?php session_start(); require "../../../global.php";//$dirname."/". require RootDir."/"."inc/config.php"; require RootDir."/"."inc/Uifunction.php"; require RootDir."/".$SystemConest[1]."/UIFunction/adminClass.php"; require RootDir."/".$SystemConest[1]."/system/Config.php"; require RootDir."/".$SystemConest[1]."/system/menusys/function.php"; require RootDir."/".$SystemConest[1]."/system/classsys/function.php"; $mydb=new YYBDB(); //权限检查 $TableName=$mydb->getTableName($MenuId); CheckRule($MenuId,$mydb,$TableName,"");//检查登陆权限 $MenuId=$_REQUEST["MenuId"]; if(strlen(MenuId)==0) die; $CurrPage=$_REQUEST["CurrPage"]; ?> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>信息管理</title> <link href="../../Inc/Css.css" rel="stylesheet" type="text/css" /> </head> <body> <? echo CurrPosition($MenuId,$mydb) ?> <br> <? ShowList($mydb,$MenuId,$CurrPage,$StrWhere,"YKTtable","YKTth","YKTtd"); ?> </body> </html>
10npsite
trunk/guanli/system/info/index.php
PHP
asf20
1,056
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>文件上传</title> <link href="../../Inc/Css.css" rel="stylesheet" type="text/css" /> <style type="text/css"> <!-- body { margin-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; } --> </style></head> <body> <form action="SaveFile.php?Msg=<? echo $_REQUEST["ErrMsgID"];?>&MenuId=<? echo $_REQUEST["MenuId"]?>&FieldIndex=<? echo $_REQUEST["FieldIndex"]?>&ID=<? echo $_["ID"];?>" method="post" enctype="multipart/form-data" name="FileForm"> <div align="left"> <input name="file" type="file" class="InputNone" onChange="javasript:FileForm.submit();" > </div> </form> </body> </html>
10npsite
trunk/guanli/system/UpFileSys/File.php
PHP
asf20
727
<? function ShowAdminList($MenuId,$mydb) { global $SystemConest; global $TableName; $AdminFields=array(); $mydb->TableName=$TableName; $mydb->ArrFields=$AdminFields; $sqlrs="select * from ".$SystemConest[7].$mydb->TableName." order by ".$mydb->TableName."0"; $rsc=$mydb->db_query($sqlrs); ?> <form id="form1" name="form1" method="post" action="?MenuId=<? echo $_REQUEST["MenuId"];?>"> <table width="98%" border="0" align="center" cellspacing="1" class="YKTtable"> <tr class="YKTth" Height="25"> <th width="4%" scope="col">ID</th> <th width="18%" scope="col">用户名</th> <th width="14%" scope="col">密码</th> <th width="14%" scope="col">身份</th> <th width="19%" scope="col">mac地址</th> <th width="19%" scope="col">登陆区域</th> <th width="22%" scope="col">注册时间</th> <th width="23%" scope="col">操作</th> </tr> <? while($rs=$mydb->db_fetch_array($rsc)) { if($rs[1]!=$SystemConest[2]) { ?> <tr Height="25" class="YKTtd "> <td><div align="center"><? echo $rs[0];?> </div></td> <td><div align="center"><? echo $rs[1];?> </div></td> <td align="center">--</td> <td><div align="center"><? echo $rs[3];?> </div></td> <td><div align="center"><? echo $rs[4];?> </div></td> <td><div align="center"><? echo $rs[7];?> </div></td> <td><div align="center"><? echo $rs[5];?> </div></td> <td><div align="center"><a href="?MenuId=<? echo $_REQUEST["MenuId"];?>&Cmd=Del&CurrMenuId=<? echo $rs[0];?>" class="Link12">删除<!-- | 修改 --></a> | <a href="?MenuId=<? echo $_REQUEST["MenuId"];?>&CurrMenuId=<? echo $rs[0];?>">修改密码</a>| <a href="Rules.php?UserID=<? echo $rs[0];?>&MenuId=<? echo $MenuId?>" class="Link12">权限管理 </a></div></td> </tr> <? } } ?> <tr class="YKTth" > <td>&nbsp;</td> <td><label> <? $CurrMenuId=$_REQUEST["CurrMenuId"]; if($CurrMenuId!="") { $sqlrs="select * from ".$SystemConest[7].$mydb->TableName." where ".$mydb->TableName."0=".$CurrMenuId; $rsc=$mydb->db_query($sqlrs); $rs=$mydb->db_fetch_array($rsc); $id=$rs[0]; $UserName=$rs[1]; $PassWord=$rs[2]; $Uid=$rs[3]; $mac=$rs[4]; $area=$rs[7]; $regTime=$rs[5]; } ?> <div align="center"> <input type="hidden" value="<? echo $id?>" name="CurrMenuId"> <input type="text" name="sysadmin1" value="<? echo $UserName;?>"> </div> </label></td> <td align="center"><input type="text" name="sysadmin2" value="" size="16"></td> <td><div align="center"> <input type="text" name="sysadmin3" value="<? echo $Uid;?>" size="16"> </div></td> <td align="center"><input type="text" name="sysadmin4" id="sysadmin4" value="<?php echo $mac;?>"></td> <td align="center"><input type="text" name="sysadmin7" id="sysadmin7" value="<?php echo $area;?>"></td> <td><div align="center"> <input type="text" name="sysadmin5" Value="<? if(strlen($regTime)<4) { echo date("Y-m-d H:i:s"); } else { echo $regTime; } ?>" /> </div></td> <!--<td><label> <div align="center"> <select name="AdminSys4"> <option value="1" selected="selected">启用</option> <option value="0">禁用</option> </select> </div> </label></td> --> <td><label> <div align="center"> <? if($_REQUEST["CurrMenuId"]=="") { $temp1="Add"; $temp2="添加新用户"; } else { $temp1="Update"; $temp2="修改用户资料"; } ?> <input type="hidden" value="<? echo $temp1;?>" name="Cmd"> <input type="submit" name="Submit" value="<? echo $temp2;?>" /> </div> </label></td> </tr> </table> </form> <div style="margin-left:10px;"> 1、区域栏目表示,这个用户只能在哪个区域来登陆,多个用英文号分隔 例:公司,家里 . 那么还有一个地方的表里将配一个ip段表,把“公司”所属的ip段写在一起,在登陆时来验证 </div> <? } ?>
10npsite
trunk/guanli/system/adminsys/function.php
PHP
asf20
4,481
<? session_start(); require "../../../global.php";//$dirname."/". require RootDir."/"."inc/config.php"; require RootDir."/"."inc/Uifunction.php"; require RootDir."/".$SystemConest[1]."/UIFunction/adminClass.php"; require RootDir."/".$SystemConest[1]."/system/Config.php"; require RootDir."/".$SystemConest[1]."/system/menusys/function.php"; require RootDir."/".$SystemConest[1]."/system/classsys/function.php"; require "function.php"; require "AdminSysClass.php"; $mydb=new YYBDB(); $TableName=reTableName($mydb,$MenuId); CheckRule($MenuId,$mydb,$TableName,"");//检查登陆权限 $UserID=$_REQUEST["UserID"]; if(strlen($_REQUEST["Submit"])>0) { //权限控制 $MenuId=(int)($_REQUEST["MenuId"]); CheckRule($MenuId,$mydb,$TableName,"Update");//检查更新权限 //保存 AllRuleSave($mydb,$UserID,"Add"); } ?> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>权限管理</title> <link href="../../Inc/Css.css" rel="stylesheet" type="text/css" /> </head> <body> <form id="form1" name="form1" method="post" action=""> <? ShowMenuTile($mydb,$UserID) ?> <label> <div align="center"><br> <input type="submit" name="Submit" value=" 保存 "> <input type="button" name="Submit2" value=" 取消 " onClick="window.history.back();"/> </div> </label> </form> <div align="center"><span id="checkall" style="cursor:pointer;">全选</span> ,<span id="checkallno" style="cursor:pointer;">全不选</span></div> <script language="javascript"> $(document).ready(function(){ $("#checkall").bind("click",function(){ $(":checkbox").attr("checked",true); }); $("#checkallno").bind("click",function(){ $(":checkbox").removeAttr("checked"); }); }); </script> </body> </html>
10npsite
trunk/guanli/system/adminsys/Rules.php
PHP
asf20
1,850
<? session_start(); require "../../../global.php";//$dirname."/". require $SystemConest[0]."/"."inc/config.php"; require $SystemConest[0]."/"."inc/Uifunction.php"; require $SystemConest[0]."/".$SystemConest[1]."/System/Config.php"; require $SystemConest[0]."/".$SystemConest[1]."/UIFunction/adminClass.php"; require $SystemConest[0]."/".$SystemConest[1]."/System/MenuSys/function.php"; require$SystemConest[0]."/".$SystemConest[1]."/System/ClassSys/function.php"; ?> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>保存密码</title> <link href="/Inc/Css.css" rel="stylesheet" type="text/css"> </head> <body> <? $mydb=new YYBDB(); CheckRule($MenuId,$mydb,$SystemTablename[1],"");//检查登陆权限 $AdminFields=array(); $OldPwd=$_REQUEST["OldPwd"]; if(trim($OldPwd)=="") $OldPwd=""; $NewPwd=$_REQUEST["NewPWD"]; $RPwd=$_REQUEST["RPWD"]; if(md5($OldPwd)==$_SESSION["Login"][2]) { if(strlen($NewPwd)>4 && strlen($NewPwd)<=17) { if($NewPwd==$RPwd) { $AdminFields[0]=$_SESSION["Login"][0]; $AdminFields[2]=md5($_REQUEST["NewPWD"]); $mydb->TableName=$SystemTablename[1]; $mydb->ArrFields=$AdminFields; $mydb->Update(); $MyError=0; $Msg=""; } else { $Msg= ".密码输入不一致!"; $MyError=1; } } } else { $Msg=".旧密码输入错误!"; $MyError=1; } if($MyError==1) { MessgBox("/".$SystemConest[1]."/Iamges/Error.jpg",$Msg,"ModifyPassWord.php"); } else { MessgBox("/".$SystemConest[1]."/Iamges/Right.jpg",$Msg,"ModifyPassWord.php"); } ?> </body> </html>
10npsite
trunk/guanli/system/adminsys/ModifyPassWord_Save.php
PHP
asf20
1,726
<? class AdminSys extends YYBDB { var $UserName; var $PassWord; var $Info; var $Rule; var $GetID; function Class_Terminate() { unset($this); } //用户登陆 function Login() { global $SystemConest; $sqlrs="Select * From ".$SystemConest[7]."sysadmin Where sysadmin1='" .$this->UserName . "' And sysadmin2='". $this->PassWord . "'"; $rsc=$this->db_query($sqlrs); $num=$this->db_num_rows($rsc); $rs=$this->db_fetch_array($rsc); if($num>0) { $Login=$rs; echo "用户登陆成功!"; } else { echo "用户名或密码错误!"; } while($rs=$this->db_fetch_array($rsc)) { echo "用户登陆成功!"; $Login=NULL; } $_SESSION["Login"]=$Login; } //检测用户名 function CheckUserName() { if($this->GetID()==0) { return 0; } else { return 1; } } //注销 function OutLogin() { unset($_SESSION["Login"]); } //修改密码 function UpDatePassWord() { $this->Info[0]=$this->GetID(); $this->Info[1]=$UserName; $this->Info[2]=$PassWord; $this->ArrFields=$this->Info; $this->Update(); } //用户注册 //0-注册成功 //1-用户名重复 function Reg() { if($this->GetID()==0) { $this->ArrFields=$this->Info; $this->Add(); return 0; } else { return 1; } } //修改用户信息 function UpDateInfo() { $this->UpDatePassWord(); } //删除用户 function Dalete() { $this->Info[0]=$this->GetID(); $this->ArrFields=$this->Info; $this->Delete(); } //获取ID function GetID() { global $SystemConest; $sqlrs="Select * From ".$SystemConest[7]."sysadmin where sysadmin1='" . $this->UserName . "'"; $rsc=$this->db_query($sqlrs); $rs=$this->db_fetch_array($rsc); $num=$this->db_num_rows($rsc); if($num>0) { return $rs[0]; } else { return 0; } } } ?>
10npsite
trunk/guanli/system/adminsys/AdminSysClass.php
PHP
asf20
2,026
<?php session_start(); require "../../../global.php";//$dirname."/". require RootDir."/"."inc/config.php"; require RootDir."/"."inc/Uifunction.php"; require RootDir."/".$SystemConest[1]."/UIFunction/adminClass.php"; require RootDir."/".$SystemConest[1]."/system/Config.php"; require RootDir."/".$SystemConest[1]."/system/menusys/function.php"; require RootDir."/".$SystemConest[1]."/system/classsys/function.php"; require "function.php"; require "AdminSysClass.php"; $mydb=new YYBDB(); $TableName=reTableName($mydb,$MenuId); CheckRule($MenuId,$mydb,$TableName,"");//检查登陆权限 $Cmd=$_REQUEST["Cmd"]; $CurrMenuId=$_REQUEST["CurrMenuId"]; $AdminFields=array(); //添加用户 $MyAdminSys=new AdminSys(); $MyAdminSys->TableName=$TableName; if($Cmd=="Add") { CheckRule($MenuId,$mydb,$TableName,"Add");//检查增加权限 if(mb_strlen($_REQUEST[$TableName."1"])>4) { $AdminFields[1]=$_REQUEST[$TableName."1"]; if($_REQUEST[$TableName."2"]!="") $AdminFields[2]=md5($_REQUEST[$TableName."2"]); $AdminFields[3]=$_REQUEST[$TableName."3"]; $AdminFields[4]=$_REQUEST[$TableName."4"]; $AdminFields[5]=$_REQUEST[$TableName."5"]; $AdminFields[7]=$_REQUEST[$TableName."7"]; $MyAdminSys->UserName=$_REQUEST[$TableName."1"]; $MyAdminSys->Info=$AdminFields; $MyAdminSys->TableName=$TableName; if($MyAdminSys->Reg()==1) { $msg="用户名重复!"; } else { $msg=""; } } else { $msg="  用户名不能少于5位!"; } gourl("?MenuId=".$_REQUEST["MenuId"]."&Msg=".$msg,1); } //删除用户 if( $Cmd=="Del") { CheckRule($MenuId,$mydb,$TableName,"Del");//检查增加权限 $CurrMenuId=$_REQUEST["CurrMenuId"]; if(strlen($CurrMenuId)>0) { //删除用户的所有权限 AllRuleSave($mydb,$CurrMenuId,"Delete"); $mydb->TableName=$TableName; $AdminFields[0]=$CurrMenuId; $mydb->ArrFields=$AdminFields; $mydb->Delete(); $msg="  用户名删除成功!"; } gourl("?MenuId=".$_REQUEST["MenuId"]."&Msg=".$msg,1); } if( $Cmd=="Update") { CheckRule($MenuId,$mydb,$TableName,"Update");//检查增加权限 if(mb_strlen($_REQUEST[$TableName."1"])>4) { $AdminFields[1]=$_REQUEST[$TableName."1"]; if($_REQUEST[$TableName."2"]!="") $AdminFields[2]=md5($_REQUEST[$TableName."2"]); $AdminFields[3]=$_REQUEST[$TableName."3"]; $AdminFields[4]=$_REQUEST[$TableName."4"]; $AdminFields[5]=$_REQUEST[$TableName."5"]; $AdminFields[7]=$_REQUEST[$TableName."7"]; $MyAdminSys->UserName=$_REQUEST[$TableName."1"]; $MyAdminSys->Info=$AdminFields; $mydb->TableName=$TableName; $AdminFields[0]=$CurrMenuId; $mydb->ArrFields=$AdminFields; $mydb->UpdateFieldIdlist="1,2,3,4,5,7"; $mydb->Update(); $msg="更新成功"; } else { $msg="  用户名不能少于5位!"; } gourl("?MenuId=".$_REQUEST["MenuId"]."&Msg=".$msg,1); } ?> <html > <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>用户管理</title> <link href="../../Inc/Css.css" rel="stylesheet" type="text/css" /> </head> <body> <p> <? echo CurrPosition((int)($_REQUEST["MenuId"]),$mydb);?></p> <? $MenuId=$_REQUEST["MenuId"]; ShowAdminList($MenuId,$mydb); echo $_REQUEST["Msg"].""; ?> </body> </html>
10npsite
trunk/guanli/system/adminsys/Index.php
PHP
asf20
3,474
<?php session_start(); require "../../../global.php"; include $SystemConest[0]."/".$SystemConest[1]."/system/Config.php"; require_once $SystemConest[0]."/"."inc/config.php"; require_once $SystemConest[0]."/"."inc/Uifunction.php"; require_once $SystemConest[0]."/".$SystemConest[1]."/UIFunction/adminClass.php"; require_once $SystemConest[0]."/".$SystemConest[1]."/system/MenuSys/function.php"; require_once $SystemConest[0]."/".$SystemConest[1]."/system/ClassSys/function.php"; $mydb=new YYBDB(); CheckRule($MenuId,$mydb,"sysadmin","");//检查登陆权限 ?><html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>密码修改</title> <link href="../../Inc/Css.css" rel="stylesheet" type="text/css" /> </head> <body> <form name="form1" method="post" action="/<? echo $SystemConest[1];?>/System/AdminSys/ModifyPassWord_Save.php"> <table width="95%" height="266" border="0" align="center" cellpadding="0" cellspacing="1" class="YKTtable"> <tr class="YKTth"> <td height="26">   当前位置:密码修改</td> </tr> <tr class="YKTtd"> <td><table width="95%" border="0" align="center" cellpadding="0" cellspacing="1" class="TableLine"> <tr> <td width="27%" height="25" class="TdLine"><div align="right">*您的旧密码:</div></td> <td width="73%" class="TdLine"><label> <input name="OldPwd" type="password" class="InputNone" id="OldPwd"> </label></td> </tr> <tr> <td height="25" class="TdLine"><div align="right">*输入新密码:</div></td> <td class="TdLine"><input name="NewPWD" id="NewPWD" type="password" class="InputNone" > 密码<strong>5~16</strong>位。限用字母、数字、特殊字符。</td> </tr> <tr> <td height="25" class="TdLine"><div align="right">*新密码确认:</div></td> <td class="TdLine"><input name="RPWD" type="password" class="InputNone" id="RPWD"></td> </tr> </table> <p align="center"> <input type="image" name="sumbit" id="sumbit" src="../../Iamges/botton_baocun.png" /> </p></td> </tr> </table> </form> <script language="javascript"> $("#sumbit").bind("click",function(){ if($("#OldPwd").val()==""){ alert("旧密码不能为空"); $("#OldPwd").focus(); return false; } NewPWD=$("#NewPWD").val() if(NewPWD=="" || (NewPWD.length<5 || NewPWD.length>16) ){ alert("新密码长度为5至16之间"); $("#NewPWD").focus(); return false; } RPWD=$("#RPWD").val() if(NewPWD!=RPWD) { alert("两次密码不一样,请重新新输入"); $("#RPWD").focus(); return false; } }); </script> </body> </html>
10npsite
trunk/guanli/system/adminsys/ModifyPassWord.php
PHP
asf20
2,870
<?php session_start(); require "../../../global.php";//$dirname."/". require RootDir."/"."inc/config.php"; require RootDir."/"."inc/Uifunction.php"; require RootDir."/".$SystemConest[1]."/UIFunction/adminClass.php"; require RootDir."/".$SystemConest[1]."/system/Config.php"; require RootDir."/".$SystemConest[1]."/system/menusys/function.php"; require RootDir."/".$SystemConest[1]."/system/classsys/function.php"; $mydb=new YYBDB(); //权限检查 $TableName= $mydb->getTableName($MenuId); CheckRule($MenuId,$mydb,$TableName,"");//检查登陆权限 if(strlen(MenuId)==0) die; $CurrPage=$_REQUEST["CurrPage"]; ?> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>订单管理</title> <link href="../../Inc/Css.css" rel="stylesheet" type="text/css" /> </head> <body> <? echo CurrPosition($MenuId,$mydb) ?> <br> <? ShowList($mydb,$MenuId,$CurrPage,$StrWhere,"YKTtable","YKTth","YKTtd"); ?> </body> </html>
10npsite
trunk/guanli/system/orderform/Index.php
PHP
asf20
1,030
<? function SysSetForm($mydb) { $sqlrs="select * from ".$mydb->TableName." where ".$mydb->TableName."0 =".$mydb->ArrFields[0].""; $rsc=$mydb->db_query($sqlrs); $rs=$mydb->db_fetch_array($rsc); ?> <form id="form1" name="form1" method="post" action="Index_Save.php?MenuId=<? echo $_REQUEST["MenuId"];?>"> <p>&nbsp;</p> <table width="95%" border="0" align="center" cellpadding="2" cellspacing="0" class="TableLine"> <tr> <td colspan="3" height="10"></td> </tr> <tr> <td width="35%" class="TdLineBG"><div align="right">公司名称:</div></td> <td width="54%" class="TdLine"><label> <input name="SysSet1" type="text" value="<? echo $rs[1]?>" size="50" class="InputNone"/> </label></td> <td width="11%" class="TdLine">&nbsp;</td> </tr> <tr> <td class="TdLineBG"><div align="right">公司地址:</div></td> <td class="TdLine"><label> <input name="SysSet2" type="text" value="<? echo $rs[2]?>" size="50" class="InputNone"/> </label></td> <td class="TdLine">&nbsp;</td> </tr> <tr> <td class="TdLineBG"><div align="right">联系人:</div></td> <td class="TdLine"><label> <input name="SysSet3" type="text" value="<? echo $rs[3]?>" size="50" class="InputNone"/> </label></td> <td class="TdLine">&nbsp;</td> </tr> <tr> <td class="TdLineBG"> <div align="right">电话:</div></td> <td class="TdLine"><label> <input name="SysSet4" type="text" value="<? echo $rs[4]?>" size="50" class="InputNone"/> </label></td> <td class="TdLine">&nbsp;</td> </tr> <tr> <td class="TdLineBG"><div align="right">传真:</div></td> <td class="TdLine"><label> <input name="SysSet5" type="text" value="<? echo $rs[5]?>" size="50" class="InputNone"/> </label></td> <td class="TdLine">&nbsp;</td> </tr> <tr> <td class="TdLineBG"><div align="right">网址:</div></td> <td class="TdLine"><label> <input name="SysSet6" type="text" value="<? echo $rs[6]?> " size="50" class="InputNone"/> </label></td> <td class="TdLine">&nbsp;</td> </tr> <tr> <td class="TdLineBG"><div align="right">Email:</div></td> <td class="TdLine"><label> <input name="SysSet7" type="text" value="<? echo $rs[7]?>" size="50" class="InputNone"/> </label></td> <td class="TdLine">&nbsp;</td> </tr> <tr> <td class="TdLineBG"><div align="right">公司邮局:</div></td> <td class="TdLine"><label> <input name="SysSet8" type="text" value="<? echo $rs[8]?>" size="50" class="InputNone"/> </label></td> <td class="TdLine">&nbsp;</td> </tr> <tr> <td class="TdLineBG"><div align="right">邮编:</div></td> <td class="TdLine"><label> <input name="SysSet9" type="text" value="<? echo $rs[9]?>" class="InputNone"/> </label></td> <td class="TdLine">&nbsp;</td> </tr> <tr> <td class="TdLineBG"><div align="right">ICP号:</div></td> <td class="TdLine"><input name="SysSet10" type="text" value="<? echo $rs[10]?>" size="50" class="InputNone"/></td> <td class="TdLine">&nbsp;</td> </tr> <tr> <td height="30">&nbsp;</td> <td valign="bottom"><input type="image" name="sumbit" src="../../Iamges/botton_baocun.png" /></td> <td>&nbsp;</td> </tr> </table> </form> <? } function SysSetSave($mydb) { $SysSetFields=array(); for($i=1;$i<=10;$i++) { $SysSetFields[$i]=$_REQUEST["SysSet".$i]; } $SysSetFields[0]=1; $mydb->TableName="SysSet"; $mydb->ArrFields=$SysSetFields; $mydb->UpDate(); } ?>
10npsite
trunk/guanli/system/sysset/function.php
PHP
asf20
3,831
<?php session_start(); require "../../../global.php";//$dirname."/". require RootDir."/"."inc/config.php"; require RootDir."/"."inc/Uifunction.php"; require RootDir."/".$SystemConest[1]."/UIFunction/adminClass.php"; require RootDir."/".$SystemConest[1]."/system/Config.php"; require RootDir."/".$SystemConest[1]."/system/menusys/function.php"; require RootDir."/".$SystemConest[1]."/system/classsys/function.php"; require "function.php"; $mydb=new YYBDB(); $TableName= $mydb->getTableName($MenuId); CheckRule($MenuId,$mydb,$TableName,"Update");//检查登陆权限 ?> <html > <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>系统设置</title> <link href="../../Inc/Css.css" rel="stylesheet" type="text/css" /> </head> <body> <p> </p> <? SysSetSave($mydb); $myClass=new ADMINClass(); $myClass->smPicPath="../../Iamges/Right.jpg"; $myClass->smMsg="修改成功!"; $myClass->smURL="Index.php?MenuId=".$MenuId; $myClass->MessgBox(); ?> </body> </html>
10npsite
trunk/guanli/system/sysset/Index_Save.php
PHP
asf20
1,052
<?php session_start(); require "../../../global.php";//$dirname."/". require RootDir."/"."inc/config.php"; require RootDir."/"."inc/Uifunction.php"; require RootDir."/".$SystemConest[1]."/UIFunction/adminClass.php"; require RootDir."/".$SystemConest[1]."/system/Config.php"; require RootDir."/".$SystemConest[1]."/system/menusys/function.php"; require RootDir."/".$SystemConest[1]."/system/classsys/function.php"; $mydb=new YYBDB(); //权限检查 $TableName= $mydb->getTableName($MenuId); CheckRule($MenuId,$mydb,$TableName,"");//检查登陆权限 if(strlen($MenuId)==0) die; $CurrPage=isset($_REQUEST["CurrPage"])?$_REQUEST["CurrPage"]:""; ?> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>系统设置</title> <link href="../../Inc/Css.css" rel="stylesheet" type="text/css" /> </head> <body> <? echo CurrPosition($MenuId,$mydb) ?> <br> <? ShowList($mydb,$MenuId,$CurrPage,$StrWhere,"YKTtable","YKTth","YKTtd"); ?> </body> </html>
10npsite
trunk/guanli/system/sysset/Index.php
PHP
asf20
1,063
<?php session_start(); require "../../../global.php";//$dirname."/". require RootDir."/"."inc/config.php"; require RootDir."/"."inc/Uifunction.php"; require RootDir."/".$SystemConest[1]."/UIFunction/adminClass.php"; require RootDir."/".$SystemConest[1]."/system/Config.php"; require RootDir."/".$SystemConest[1]."/system/menusys/function.php"; require RootDir."/".$SystemConest[1]."/system/classsys/function.php"; $mydb=new YYBDB(); CheckRule($MenuId,$mydb,$System[13][3],"");//检查登陆权限 if(strlen($MenuId)==0) die; $CurrPage=$_REQUEST["CurrPage"]; ?> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>个人会员</title> <link href="../../Inc/Css.css" rel="stylesheet" type="text/css" /> </head> <body> <? echo CurrPosition($MenuId,$mydb) ?> <br> <? ShowList($mydb,$MenuId,$CurrPage,$StrWhere,"YKTtable","YKTth","YKTtd"); ?> </body> </html>
10npsite
trunk/guanli/system/pmenbersys/Index.php
PHP
asf20
970
<?php session_start(); require "../../../global.php";//$dirname."/". require RootDir."/"."inc/config.php"; require RootDir."/"."inc/Uifunction.php"; require RootDir."/".$SystemConest[1]."/UIFunction/adminClass.php"; require RootDir."/".$SystemConest[1]."/system/Config.php"; require RootDir."/".$SystemConest[1]."/system/menusys/function.php"; require RootDir."/".$SystemConest[1]."/system/classsys/function.php"; $mydb=new YYBDB(); //权限检查 $TableName= $mydb->getTableName($MenuId); CheckRule($MenuId,$mydb,$TableName,"");//检查登陆权限 if(strlen($MenuId)==0) die; $CurrPage=$_REQUEST["CurrPage"]; ?> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>旅游线路管理</title> <link href="../../Inc/Css.css" rel="stylesheet" type="text/css" /> </head> <body> <? echo CurrPosition($MenuId,$mydb) ?> <br> <? ShowList($mydb,$MenuId,$CurrPage,$StrWhere,"YKTtable","YKTth","YKTtd"); ?> </body> </html>
10npsite
trunk/guanli/system/tour/Index.php
PHP
asf20
1,032