Index: active_campus_explorer/pocket_ace_html/pages/maps.php =================================================================== --- active_campus_explorer/pocket_ace_html/pages/maps.php (revision 4449) +++ active_campus_explorer/pocket_ace_html/pages/maps.php (revision 4663) @@ -306,6 +306,10 @@ if(isset($mapOptionShowGraffiti) && $mapOptionShowGraffiti == "on") mapSetShow("graffiti", true); else mapSetShow("graffiti", false); + // Set the layered graffiti show option. + if(isset($mapOptionShowGraffiti) && $mapOptionShowGraffiti == "on") mapSetShow("layeredGraffiti", true); + else mapSetShow("layeredGraffiti", false); + // Set the category. $mapContext->setCategory($mapOptionCategory); @@ -551,6 +555,8 @@ else $reminders = array(); if(mapGetShow("graffiti")) $graffiti = $mapContext->graffiti(); else $graffiti = array(); +if(mapGetShow("layeredGraffiti")) $layeredGraffiti = $mapContext->layeredGraffiti(); +else $layeredGraffiti = array(); if(mapGetShow("messages")) { $messages = $mapContext->messages(); $conversations = $mapContext->conversations(); @@ -566,10 +572,11 @@ $history = mapsMarkHistoryItems($history); $reminders = mapsMarkReminderItems($reminders); $graffiti = mapsMarkGraffitiItems($graffiti); +$layeredGraffiti = mapsMarkLayeredGraffitiItems($layeredGraffiti); $messages = mapsMarkMessageItems($messages); $conversations = mapsMarkConversationItems($conversations); -$content = array_merge($usersinfo, $sites, $APs, $corrections, $operator, $history, $reminders, $graffiti , $messages, $conversations); +$content = array_merge($usersinfo, $sites, $APs, $corrections, $operator, $history, $reminders, $graffiti, $layeredGraffiti, $messages, $conversations); $content = mapsCoordsRealWorldToMap($content, $mapContext); $content = mapsSortContent($content); $collisions = mapsCreateCollision($content, $mapContext); Index: active_campus_explorer/pocket_ace_html/pages/graffiti-nearby.php =================================================================== --- active_campus_explorer/pocket_ace_html/pages/graffiti-nearby.php (revision 4449) +++ active_campus_explorer/pocket_ace_html/pages/graffiti-nearby.php (revision 4663) @@ -173,7 +173,11 @@ $options .= "\n"; addElement($options, "NO"); +// Show some of the layered graffiti tagged on the current target in a table view. +$graffitis = daRetrieveLayeredGraffitiAtTarget($graffitiTarget, $graffitiMaxToShow, $graffitiIndex, $graffitiSortKey); + addElement(guiLayeredGraffitiTableDisplay($graffitis, $graffitiTarget, $graffitiIndex),"NO"); + // Show some of the graffiti tagged on the current target in a table view. $graffitis = daRetrieveGraffitiAtTarget($graffitiTarget, $graffitiMaxToShow, $graffitiIndex, $graffitiSortKey); if(isset($graffitiPeekId)) { Index: active_campus_explorer/pocket_ace_html/pages/graffitiFirstThumbnail.php =================================================================== --- active_campus_explorer/pocket_ace_html/pages/graffitiFirstThumbnail.php (revision 0) +++ active_campus_explorer/pocket_ace_html/pages/graffitiFirstThumbnail.php (revision 4663) @@ -0,0 +1,46 @@ + Index: active_campus_explorer/pocket_ace_html/pages/graffiti-submit.php =================================================================== --- active_campus_explorer/pocket_ace_html/pages/graffiti-submit.php (revision 4449) +++ active_campus_explorer/pocket_ace_html/pages/graffiti-submit.php (revision 4663) @@ -135,8 +135,15 @@ } } +if(isset($graffitiType) && $graffitiType == "ink"){ + print("\n"); + print("\n"); + print("\n"); + exit; +} + // If graffitiType isn't set or is invalid, ask the user for the type. -if(!isset($graffitiType) || !($graffitiType == "text" || $graffitiType == "image" || $graffitiType == "sound")) { +if(!isset($graffitiType) || !($graffitiType == "text" || $graffitiType == "ink" || $graffitiType == "image" || $graffitiType == "sound")) { guiStartPage("Tag Graffiti", "Tag Graffiti"); addElement(guiGraffitiTypeForm($graffitiTarget)); guiEndPage(); Index: active_campus_explorer/pocket_ace_html/pages/graffitiDefault.php =================================================================== --- active_campus_explorer/pocket_ace_html/pages/graffitiDefault.php (revision 0) +++ active_campus_explorer/pocket_ace_html/pages/graffitiDefault.php (revision 4663) @@ -0,0 +1,45 @@ + Index: active_campus_explorer/pocket_ace_html/pages/graffitiBackground.php =================================================================== --- active_campus_explorer/pocket_ace_html/pages/graffitiBackground.php (revision 0) +++ active_campus_explorer/pocket_ace_html/pages/graffitiBackground.php (revision 4663) @@ -0,0 +1,47 @@ + Index: active_campus_explorer/pocket_ace_html/pages/graffitiThumbnail.php =================================================================== --- active_campus_explorer/pocket_ace_html/pages/graffitiThumbnail.php (revision 0) +++ active_campus_explorer/pocket_ace_html/pages/graffitiThumbnail.php (revision 4663) @@ -0,0 +1,46 @@ + Index: active_campus_explorer/pocket_ace_html/pages/Makefile.am =================================================================== --- active_campus_explorer/pocket_ace_html/pages/Makefile.am (revision 4449) +++ active_campus_explorer/pocket_ace_html/pages/Makefile.am (revision 4663) @@ -2,6 +2,6 @@ htmldir = $(prefix)/active_campus_explorer/pocket_ace_html/pages -html_DATA = reminder.php reminderBuddy.php profile-log.php profile.php maps.php buddies.php footer.php news.php sites.php log.php messages.php struct.php index.html list_msgs.php send_msg_frm.php send_msg.php my_active_campus_add_buddies.php my_active_campus_buddies.php my_active_campus_buddies_menu.php my_active_campus_groups.php my_active_campus_home.php my_active_campus_main_menu.php my_active_campus_mutual_buddies.php my_active_campus_wanted_buddies.php my_active_campus.php locator.php graffiti-nearby.php graffiti-submit.php apEditInterface.php apEdit.php icons.php mapOverlay.php control.php redirector.html mac.php mac_footer.php mac_buddy.php mac_buddy_action.php siteMaintenance.php apMaintenance.php blank.html history.php settings.php redirector.php upload.php domainEdit.php screenshots.php location.php icons_edit.php busroutes.html msg_form.php msg_history.php msg_list.php msg_tabs.php quick_phrases.php enable.php correctionMaintenance.php h323call.php h323mime.php h323info.php mac_buddy_admin.php remindershistory.php +html_DATA = reminder.php reminderBuddy.php profile-log.php profile.php maps.php buddies.php footer.php news.php sites.php log.php messages.php struct.php index.html list_msgs.php send_msg_frm.php send_msg.php my_active_campus_add_buddies.php my_active_campus_buddies.php my_active_campus_buddies_menu.php my_active_campus_groups.php my_active_campus_home.php my_active_campus_main_menu.php my_active_campus_mutual_buddies.php my_active_campus_wanted_buddies.php my_active_campus.php locator.php graffiti-nearby.php graffiti-submit.php apEditInterface.php apEdit.php icons.php mapOverlay.php control.php redirector.html mac.php mac_footer.php mac_buddy.php mac_buddy_action.php siteMaintenance.php apMaintenance.php blank.html history.php settings.php redirector.php upload.php domainEdit.php screenshots.php location.php icons_edit.php busroutes.html msg_form.php msg_history.php msg_list.php msg_tabs.php quick_phrases.php enable.php correctionMaintenance.php h323call.php h323mime.php h323info.php mac_buddy_admin.php remindershistory.php graffitiBackground.php graffitiDefault.php graffitiFirstThumbnail.php graffitiThumbnail.php EXTRA_DIST = $(html_DATA) Index: active_campus_explorer/pocket_ace_html/gui/graffiti_gui_fn.php =================================================================== --- active_campus_explorer/pocket_ace_html/gui/graffiti_gui_fn.php (revision 4449) +++ active_campus_explorer/pocket_ace_html/gui/graffiti_gui_fn.php (revision 4663) @@ -270,7 +270,71 @@ return($return); } +function guiLayeredGraffitiFromArrayDisplay($layeredGraffitis, $currentTarget = null, $selectedId = "") { + $return = ""; + + $return .= ""; + foreach($layeredGraffitis as $layeredGraffitiArray) + { + $return.= "
"; + } + $return .= "
"; + + return($return); +} + /** + * Display an array of layered graffiti as a table with a header. + * + * @param graffitis An array of graffiti thumbnails. + * + * @param currentTarget The current target of the graffiti page, or null if + * there isn't one (the code defaults to the map view target). + * + * @param selectedId The currently selected graffiti (so it can be displayed + * as such). + * + * @returns string HTML for the graffiti list. + */ +function guiLayeredGraffitiTableDisplay($graffitis, $currentTarget = null, $index = 0, $selectedId = "") { + $return = ""; + + $return .= "\n"; + $return .= "\n"; + + // Draw the columns for the icons. These nbsps are required or PocketIE + // 2000 might scale the images. They shouldn't be here for anything but + // PocketIE 2000 though, or there's too much space. + if(isPDA()) { + $return .= "\n"; + $return .= "\n"; + } + else { + $return .= "\n"; + $return .= "\n"; + } + + // The # of replies column. + $return .= "\n"; + + $return .= "\n"; + //$return .= "\n"; + $i=0; + foreach($graffitis as $graffiti) + { + if($i>=2){ + $return .= "\n"; + $i=0; + } + $i = $i +1; + $return.=guiLayeredGraffitiInListDisplay($graffiti, $currentTarget, $index, $selectedId); + } + $return .= "
        Ink Graffiti
"; + + return($return); +} + +/** * Display an array of graffiti as a table with a header. * * @param graffitis An array of graffiti classes. @@ -712,6 +776,14 @@ return $username; } +function guiLayeredGraffitiInListDisplay($graffiti, $currentTarget=null, $index = 0, $selectedId = "") { + $return = ""; + + $return .= "\n"; + + return($return); +} + function guiGraffitiInListDisplay($graffiti, $currentTarget=null, $index = 0, $selectedId = "") { $return = ""; @@ -768,6 +840,7 @@ $return .= "
"; $return.=input("RADIO", "graffitiType", "text", "", "", true) . "text" . br(); $return.=input("RADIO", "graffitiType", "image") . "image" . br(); + $return.=input("RADIO", "graffitiType", "ink") . "ink" . br(); // XXX This requires future work. //$return.=input("RADIO", "graffitiType", "sound") . "sound" . br(); $return .= "
"; Index: active_campus_explorer/pocket_ace_html/gui/maps_gui_fn.php =================================================================== --- active_campus_explorer/pocket_ace_html/gui/maps_gui_fn.php (revision 4449) +++ active_campus_explorer/pocket_ace_html/gui/maps_gui_fn.php (revision 4663) @@ -133,6 +133,7 @@ $return .= input("checkbox", "mapOptionShowReminders", "on", null, null, mapGetShow("reminders")) . "Reminders" . guiSpacer(); $return .= input("checkbox", "mapOptionShowMessages", "on", null, null, mapGetShow("messages")) . "Messages" . guiSpacer(); $return .= input("checkbox", "mapOptionShowGraffiti", "on", null, null, mapGetShow("graffiti")) . "Graffiti" . guiSpacer(); + $return .= input("checkbox", "mapOptionShowLayeredGraffiti", "on", null, null, mapGetShow("layeredGraffiti")) . "Ink graffiti" . guiSpacer(); $return .= hr(); @@ -738,6 +739,9 @@ elseif($collisions[$i][$j]['collision_contains'][$k] == "GRAFFITI") { array_push($mapCollisionDotObjects, new MapIconObject("collision:$i,$j,$x_used,$y_used,$z_used", $realX, $realY, $GLOBALS['ActiveCampus_file_system_home'] . "/active_campus_explorer/images/icons/magnify.png")); } + elseif($collisions[$i][$j]['collision_contains'][$k] == "LAYERED_GRAFFITI") { + array_push($mapCollisionDotObjects, new MapIconObject("collision:$i,$j,$x_used,$y_used,$z_used", $realX, $realY, $GLOBALS['ActiveCampus_file_system_home'] . "/active_campus_explorer/images/icons/magnify.png")); + } // Otherwise, it's a normal map point. else { @@ -780,6 +784,9 @@ elseif(in_array("GRAFFITI", $collisions[$i][$j]['collision_contains'])) { array_push($mapCollisionObjects, new MapTextObject("collision:$i,$j,$x_used,$y_used,$z_used", $x, $y, $collisions[$i][$j]["display"], "green")); } + elseif(in_array("LAYERED_GRAFFITI", $collisions[$i][$j]['collision_contains'])) { + // Layered graffiti are treated as dots. + } // Handle anything else. else { array_push($mapCollisionObjects, new MapTextObject("collision:$i,$j,$x_used,$y_used,$z_used", $x, $y, $collisions[$i][$j]["display"], "blue")); @@ -1048,6 +1055,7 @@ $corrections=array(); $reminders=array(); $graffiti=array(); + $layeredGraffiti=array(); $messages=array(); $conversations=array(); if(!is_array($collision["items"])) @@ -1083,6 +1091,10 @@ { array_push($graffiti, $item); } + elseif(mapsIsItemLayeredGraffiti($item)) + { + array_push($layeredGraffiti, $item); + } elseif(mapsIsItemMessage($item)) { array_push($messages, $item); @@ -1146,6 +1158,12 @@ $return .= guiGroupedContent( $groups, 'guiGraffitiFromArrayDisplay', null, false); } + if(count($layeredGraffiti)!=0) + { + $groups = array("Ink graffiti" => $layeredGraffiti); + $return .= guiGroupedContent( + $groups, 'guiLayeredGraffitiFromArrayDisplay', null, false); + } if(count($messages)!=0) { $groups = array("Messages" => $messages); Index: active_campus_explorer/pocket_ace_html/function/maps_fn.php =================================================================== --- active_campus_explorer/pocket_ace_html/function/maps_fn.php (revision 4449) +++ active_campus_explorer/pocket_ace_html/function/maps_fn.php (revision 4663) @@ -247,6 +247,17 @@ return($new_graffiti); } +function mapsMarkLayeredGraffitiItems($layeredGraffiti) { + $new_layeredGraffiti=array(); + + foreach($layeredGraffiti as $data) { + $data[$GLOBALS["maps_item_id_key"]]=$GLOBALS["maps_layeredGraffiti_item_id"]; + $data[$GLOBALS["maps_item_to_display_key"]] = 'XXX Layered graffiti'; + array_push($new_layeredGraffiti, $data); + } + return($new_layeredGraffiti); +} + function mapsIsItemCorrection($item) { if($item[$GLOBALS["maps_item_id_key"]]==$GLOBALS["maps_correction_item_id"]) @@ -308,6 +319,15 @@ } } +function mapsIsItemLayeredGraffiti($item) { + if($item[$GLOBALS["maps_item_id_key"]]==$GLOBALS["maps_layeredGraffiti_item_id"]) { + return(TRUE); + } + else { + return(FALSE); + } +} + function mapsIsItemBuddy($item) { if($item[$GLOBALS["maps_item_id_key"]]==$GLOBALS["maps_buddy_item_id"]) @@ -428,7 +448,7 @@ { //print("test L: $line: " . ($item[$GLOBALS["map_coord_x_key"]]/$GLOBALS["maps_char_width"]) . " " . ($position_pointer+$length_used) . br()); /*Test here to see if the item starts within the last entered text. Doesn't care about it if the item is the first scanned for the given line*/ - if(mapsIsItemDot($item) || mapsIsItemMessage($item) || mapsIsItemConversation($item)) { + if(mapsIsItemDot($item) || mapsIsItemMessage($item) || mapsIsItemConversation($item) || mapsIsItemLayeredGraffiti($item)) { mapsAddNewCollision($item, $line, $collisions, $mapContext); $latest_collision_scanned++; } @@ -466,7 +486,7 @@ /*Nothing could be rearanged, insert into existing collision*/ else { - if(in_array("DOT", $collisions[$line][$latest_collision_scanned]['collision_contains']) || in_array("MESSAGE", $collisions[$line][$latest_collision_scanned]['collision_contains']) || in_array("CONVERSATION", $collisions[$line][$latest_collision_scanned]['collision_contains'])) { + if(in_array("DOT", $collisions[$line][$latest_collision_scanned]['collision_contains']) || in_array("MESSAGE", $collisions[$line][$latest_collision_scanned]['collision_contains']) || in_array("CONVERSATION", $collisions[$line][$latest_collision_scanned]['collision_contains']) || in_array("LAYERED_GRAFFITI", $collisions[$line][$latest_collision_scanned]['collision_contains'])) { /*doesn't collide with anything, insert it has a new collisions*/ mapsAddNewCollision($item, $line, $collisions, $mapContext); //$latest_collision_scanned=count($collisions[$line])-1; @@ -724,6 +744,10 @@ $icon_to_use=$GLOBALS['ActiveCampus_file_system_home'] . "/active_campus_explorer/images/icons/magnify.png"; array_push($collision_contains,"GRAFFITI"); } + elseif(mapsIsItemLayeredGraffiti($item)) { + $icon_to_use=$GLOBALS['ActiveCampus_file_system_home'] . "/active_campus_explorer/images/icons/magnify.png"; + array_push($collision_contains,"LAYERED_GRAFFITI"); + } } function mapsAddNewCollision($item, $line, &$collisions, $mapContext) { @@ -805,6 +829,10 @@ { array_push($collisions[$line][$collision_number]["collision_contains"],"GRAFFITI"); } + elseif(mapsIsItemLayeredGraffiti($item)) + { + array_push($collisions[$line][$collision_number]["collision_contains"],"LAYERED_GRAFFITI"); + } $collision_contains=$collisions[$line][$collision_number]["collision_contains"]; $markup=""; @@ -844,6 +872,10 @@ { $markup.="G"; } + if(in_array("LAYERED_GRAFFITI", $collision_contains)) + { + $markup.="L"; + } $markup.=":"; $to_display=$markup . $collisions[$line][$collision_number]["#"]; Index: active_campus_explorer/pocket_ace_html/conf/maps_conf.php =================================================================== --- active_campus_explorer/pocket_ace_html/conf/maps_conf.php (revision 4449) +++ active_campus_explorer/pocket_ace_html/conf/maps_conf.php (revision 4663) @@ -65,6 +65,7 @@ $maps_message_item_id = "MESSAGE"; $maps_conversation_item_id = "CONVERSATION"; $maps_graffiti_item_id = "GRAFFITI"; +$maps_layeredGraffiti_item_id = "LAYERED_GRAFFITI"; $maps_overlay_name_var = "maps_overlay_name"; $maps_overlay_name_x_var = $maps_overlay_name_var . "_x"; Index: active_campus_explorer/soap/Makefile.am =================================================================== --- active_campus_explorer/soap/Makefile.am (revision 4449) +++ active_campus_explorer/soap/Makefile.am (revision 4663) @@ -2,7 +2,7 @@ htmldir = $(prefix)/active_campus_explorer/soap -html_DATA = ActiveCampus-soap.php auth.php buddies.php index.html messages.php jabber.php users.php location.php maps.php h323authentication.php projection.php +html_DATA = ActiveCampus-soap.php auth.php buddies.php index.html messages.php jabber.php users.php location.php maps.php h323authentication.php projection.php layerGraffiti.php EXTRA_DIST = $(html_DATA) Index: active_campus_explorer/soap/ActiveCampus-soap.php =================================================================== --- active_campus_explorer/soap/ActiveCampus-soap.php (revision 4449) +++ active_campus_explorer/soap/ActiveCampus-soap.php (revision 4663) @@ -136,6 +136,7 @@ require_once("h323authentication.php"); require_once("maps.php"); require_once("projection.php"); +require_once("layerGraffiti.php"); // Process the SOAP request. // XXX See php://input wrt HTTP_RAW_POST_DATA. Index: active_campus_explorer/soap/layerGraffiti.php =================================================================== --- active_campus_explorer/soap/layerGraffiti.php (revision 0) +++ active_campus_explorer/soap/layerGraffiti.php (revision 4663) @@ -0,0 +1,275 @@ + + * @date Fri Aug 2 15:57:08 PDT 2002 + */ +require_once("../conf/main_conf.php"); + +// Make sure we're being included from ActiveCampus-soap.php. +if(!isset($server) || !is_object($server)) exit; + + +$SOAPUpdateLayeredGraffitiSig = array("result" => "int", "username" => "string", "password" => "string", "data" => "base64Binary", "id" => "int"); +function SOAPUpdateLayeredGraffiti($username, $password, &$data, $id) { + global $SOAPUpdateLayeredGraffitiSig; + $function = "SOAPUpdateLayeredGraffiti"; + + // Type verification. + if(!typecheck($SOAPUpdateLayeredGraffitiSig, array(&$username, &$password, &$data, &$id))) return typeFault($function); + escape($SOAPUpdateLayeredGraffitiSig, array(&$username, &$password, &$data, &$id)); + + // Authentication. + if(!authenticate($username, $password)) return(authFault($function)); + + // Logging. + daLogSOAPCall($function); + + daUpdateLayeredGraffiti($id, &$data); + + return 0; +} +registerSOAP($server, 'SOAPUpdateLayeredGraffiti', $SOAPUpdateLayeredGraffitiSig, "Update blob of data from digital graffiti table."); + + +$SOAPInsertLayeredGraffitiByLocationSig = array("result" => "int", "username" => "string", "password" => "string", "data" => "string", "data2"=>"string", "data3"=>"string", "data4"=>"string", "thumbnail"=>"string", "x"=>"int", "y"=>"int", "z"=>"int", "layer"=>"int"); +function SOAPInsertLayeredGraffitiByLocation($username, $password, &$data, &$data2, &$data3, &$data4, &$thumbnail, $x, $y, $z, $layer ) { + global $SOAPInsertLayeredGraffitiByLocationSig; + $function = "SOAPInsertLayeredGraffitiByLocation"; + + // Type verification. + if(!typecheck($SOAPInsertLayeredGraffitiByLocationSig, array(&$username, &$password, &$data, &$data2, &$data3, &$data4, &$thumbnail, $x, $y, $z, $layer))) return typeFault($function); + escape($SOAPInsertLayeredGraffitiByLocationSig, array(&$username, &$password, &$data, &$data2, &$data3, &$data4, &$thumbnail, $x, $y, $z, $layer)); + + // Authentication. + if(!authenticate($username, $password)) return(authFault($function)); + + // Logging. + daLogSOAPCall($function); + $result = daInsertElement("none","none"); + $result = $result["last_insert_id()"]; + daInsertElementData($result, "application/x-ms-ink",&$data2); + daInsertElementData($result, "application/inkml",&$data); + daInsertElementData($result, "image/png",&$data3); + daInsertElementData($result, "text/plain",&$data4); + $elementID = $result; + $result = daInsertLayeredGraffitiByLocation(&$thumbnail, $x, $y, $z, $layer, $elementID); + if(!isset($result)) return typeFault($function); + + return $result["last_insert_id()"]; +} +registerSOAP($server, 'SOAPInsertLayeredGraffitiByLocation', $SOAPInsertLayeredGraffitiByLocationSig, "Insert blob of data from digital graffiti table."); + + +$SOAPInsertLayeredGraffitiBySiteSig = array("result" => "int", "username" => "string", "password" => "string", "data" => "string", "data2"=>"string", "data3"=>"string", "data4"=>"string", "thumbnail"=>"string", "site_id"=>"int"); +function SOAPInsertLayeredGraffitiBySite($username, $password, &$data, &$data2, &$data3, &$data4, &$thumbnail, $site_id ) { + global $SOAPInsertLayeredGraffitiBySiteSig; + $function = "SOAPInsertLayeredGraffitiBySite"; + + // Type verification. + if(!typecheck($SOAPInsertLayeredGraffitiBySiteSig, array(&$username, &$password, &$data, &$data2, &$data3, &$data4, &$thumbnail, $site_id))) return typeFault($function); + escape($SOAPInsertLayeredGraffitiBySiteSig, array(&$username, &$password, &$data, &$data2, &$data3, &$data4, &$thumbnail, $site_id)); + + // Authentication. + if(!authenticate($username, $password)) return(authFault($function)); + + // Logging. + daLogSOAPCall($function); + $result = daInsertElement("none","none"); + $result = $result["last_insert_id()"]; + daInsertElementData($result, "application/x-ms-ink",&$data2); + daInsertElementData($result, "application/inkml",&$data); + daInsertElementData($result, "image/png",&$data3); + daInsertElementData($result, "text/plain",&$data4); + $elementID = $result; + $result = daInsertLayeredGraffitiBySite(&$thumbnail, $site_id, $elementID); + if(!isset($result)) return typeFault($function); + + return $result["last_insert_id()"]; +} +registerSOAP($server, 'SOAPInsertLayeredGraffitiBySite', $SOAPInsertLayeredGraffitiBySiteSig, "Insert blob of data from digital graffiti table."); + +$SOAPInsertLayeredGraffitiByUserSig = array("result" => "int", "username" => "string", "password" => "string", "data" => "string", "data2"=>"string", "data3"=>"string", "data4"=>"string", "thumbnail"=>"string", "user_id"=>"int"); +function SOAPInsertLayeredGraffitiByUser($username, $password, &$data, &$data2, &$data3, &$data4, &$thumbnail, $user_id ) { + global $SOAPInsertLayeredGraffitiByUserSig; + $function = "SOAPInsertLayeredGraffitiByUser"; + + // Type verification. + if(!typecheck($SOAPInsertLayeredGraffitiByUserSig, array(&$username, &$password, &$data, &$data2, &$data3, &$data4, &$thumbnail, $user_id))) return typeFault($function); + escape($SOAPInsertLayeredGraffitiByUserSig, array(&$username, &$password, &$data, &$data2, &$data3, &$data4, &$thumbnail, $user_id)); + + // Authentication. + if(!authenticate($username, $password)) return(authFault($function)); + + // Logging. + daLogSOAPCall($function); + $result = daInsertElement("test","test desc"); + $result = $result["last_insert_id()"]; + daInsertElementData($result, "application/x-ms-ink",&$data2); + daInsertElementData($result, "application/inkml",&$data); + daInsertElementData($result, "image/png",&$data3); + daInsertElementData($result, "text/plain",&$data4); + $elementID = $result; + $result = daInsertLayeredGraffitiByUser(&$thumbnail, $user_id, $elementID); + if(!isset($result)) return typeFault($function); + + return $result["last_insert_id()"]; +} +registerSOAP($server, 'SOAPInsertLayeredGraffitiByUser', $SOAPInsertLayeredGraffitiByUserSig, "Insert blob of data from digital graffiti table."); + + +$SOAPSetBackgroundSig = array("result" => "int", "username" => "string", "password" => "string", "data" => "string", "root"=>"int"); +function SOAPSetBackground($username, $password, &$data, $root) { + global $SOAPSetBackgroundSig; + $function = "SOAPSetBackground"; + + // Type verification. + if(!typecheck($SOAPSetBackgroundSig, array(&$username, &$password, &$data, $root))) return typeFault($function); + escape($SOAPSetBackgroundSig, array(&$username, &$password, &$data, $root)); + + // Authentication. + if(!authenticate($username, $password)) return(authFault($function)); + + // Logging. + daLogSOAPCall($function); + + daSetGraffitiBackground($root, &$data); + + return 1; +} +registerSOAP($server, 'SOAPSetBackground', $SOAPSetBackgroundSig, "Insert new background for a layered graffiti."); + + +$SOAPInsertLayerSig = array("result" => "int", "username" => "string", "password" => "string", "data" => "string", "data2"=>"string", "data3"=>"string", "data4"=>"string", "thumbnail"=>"string", "graffiti"=>"int", "graffiti_root"=>"int"); +function SOAPInsertLayer($username, $password, &$data, &$data2, &$data3, &$data4, &$thumbnail, $graffiti, $root) { + global $SOAPInsertLayerSig; + $function = "SOAPInsertLayer"; + + // Type verification. + if(!typecheck($SOAPInsertLayerSig, array(&$username, &$password, &$data, &$data2, &$data3, &$data4, &$thumbnail, $graffiti, $root))) return typeFault($function); + escape($SOAPInsertLayerSig, array(&$username, &$password, &$data, &$data2, &$data3, &$data4, &$thumbnail, $graffiti, $root)); + + // Authentication. + if(!authenticate($username, $password)) return(authFault($function)); + + // Logging. + daLogSOAPCall($function); + $result = daInsertElement("test","test desc"); + $result = $result["last_insert_id()"]; + daInsertElementData($result, "application/x-ms-ink",&$data2); + daInsertElementData($result, "application/inkml",&$data); + daInsertElementData($result, "image/png",&$data3); + daInsertElementData($result, "text/plain",&$data4); + $elementID = $result; + $result = daInsertLayer(&$thumbnail, $graffiti, $root, $elementID); + if(!isset($result)) return typeFault($function); + + return $result["last_insert_id()"]; +} +registerSOAP($server, 'SOAPInsertLayer', $SOAPInsertLayerSig, "Insert blob of data from digital graffiti table."); + +$SOAPInsertLayeredGraffitiSig = array("result" => "int", "username" => "string", "password" => "string", "data" => "string", "data2"=>"string", "data3"=>"string", "data4"=>"string", "thumbnail"=>"string"); +function SOAPInsertLayeredGraffiti($username, $password, &$data, &$data2, &$data3, &$data4, &$thumbnail) { + global $SOAPInsertLayeredGraffitiSig; + $function = "SOAPInsertLayeredGraffiti"; + + // Type verification. + if(!typecheck($SOAPInsertLayeredGraffitiSig, array(&$username, &$password, &$data, &$data2, &$data3, &$data4, &$thumbnail))) return typeFault($function); + escape($SOAPInsertLayeredGraffitiSig, array(&$username, &$password, &$data, &$data2, &$data3, &$data4, &$thumbnail)); + + // Authentication. + if(!authenticate($username, $password)) return(authFault($function)); + + // Logging. + daLogSOAPCall($function); + $result = daInsertElement("test","test desc"); + $result = $result["last_insert_id()"]; + daInsertElementData($result, "application/x-ms-ink",&$data2); + daInsertElementData($result, "application/inkml",&$data); + daInsertElementData($result, "image/png",&$data3); + daInsertElementData($result, "text/plain",&$data4); + $elementID = $result; + $result = daInsertLayeredGraffitiNearby(&$thumbnail, $elementID); + if(!isset($result)) return typeFault($function); + + return $result["last_insert_id()"]; +} +registerSOAP($server, 'SOAPInsertLayeredGraffiti', $SOAPInsertLayeredGraffitiSig, "Insert blob of data from digital graffiti table."); + + +$SOAPGetLayeredGraffitiByIdSig = array("result" => "string", "username" => "string", "password" => "string", "id" => "int"); +function SOAPGetLayeredGraffitiById($username, $password, $id) { + global $SOAPGetLayeredGraffitiByIdSig; + $function = "SOAPGetLayeredGraffitiById"; + + // Type verification. + if(!typecheck($SOAPGetLayeredGraffitiByIdSig, array(&$username, &$password, &$id))) return typeFault($function); + escape($SOAPGetLayeredGraffitiByIdSig, array(&$username, &$password, &$id)); + + // Authentication. + if(!authenticate($username, $password)) return(authFault($function)); + + // Logging. + daLogSOAPCall($function); + + //$background = daGetGraffitiBackground($id); + $dbresult = daGetLayeredGraffitiById($id); + $result = ""; + $resultStr = ""; + foreach($dbresult as $dbresultvaluearr){ + $resultStr .= "".$dbresultvaluearr["id"].""; + $resultStr .= "".$dbresultvaluearr["elementData"].""; + $resultStr .= "".$dbresultvaluearr["mimeType"].""; +} +$result = $result . $resultStr; + + $result = $result . ""; + if(!isset($result)) return typeFault($function); + return $result; +} +registerSOAP($server, 'SOAPGetLayeredGraffitiById', $SOAPGetLayeredGraffitiByIdSig, "Get blob of data from the layered graffiti table by id."); + +?> Index: active_campus_explorer/functions/tool_fn.php =================================================================== --- active_campus_explorer/functions/tool_fn.php (revision 4449) +++ active_campus_explorer/functions/tool_fn.php (revision 4663) @@ -187,6 +187,10 @@ else if(!is_string($arguments[$i])) return false; } + else if($type == "base64Binary") { + // XXX + } + else if($type == "boolean") { // XXX Some version of nusoap maims this to string true/false, some Index: active_campus_explorer/functions/data_access/maps_data_access_fn.php =================================================================== --- active_campus_explorer/functions/data_access/maps_data_access_fn.php (revision 4449) +++ active_campus_explorer/functions/data_access/maps_data_access_fn.php (revision 4663) @@ -483,7 +483,12 @@ $result = daGetNearbyGraffiti($this->layerArea()); return $result; } - + + function layeredGraffiti() { + $result = daGetNearbyLayeredGraffiti($this->layerArea()); + return $result; + } + // Offset of the top corner of the map in pixels as relates to the scale. // What you probably want is bounds(). function pixelOffset() { @@ -776,6 +781,7 @@ else if($type == "reminders") $var = true; else if($type == "messages") $var = true; else if($type == "graffiti") $var = true; + else if($type == "layeredGraffiti") $var = true; else $var = false; } Index: active_campus_explorer/functions/data_access/db/graffiti_sql_fn.php =================================================================== --- active_campus_explorer/functions/data_access/db/graffiti_sql_fn.php (revision 4449) +++ active_campus_explorer/functions/data_access/db/graffiti_sql_fn.php (revision 4663) @@ -47,6 +47,77 @@ return sqlFetchArray(sqlQuery("SELECT id, subject, poster_id, type, date, anonymous, targetType, location_x, location_y, location_z, location_layer_id, siteId, userId, graffitiId, replyCount, activityTime, hasSubject, hasNoText FROM digital_graffiti WHERE id='$id'")); } +function dbGetLayeredGraffitiById($id){ + return resultsetToArray(sqlQuery("SELECT d.mime_type AS mimeType, d.element_data AS elementData, g.id AS id FROM graffiti AS g, element_data AS d, elements AS e WHERE d.element_id=e.id AND e.id=g.element_id AND (g.id='$id' OR g.root_id='$id');")); +} + +function dbGetDefaultGraffitiBackground(){ + $background_array = resultsetToArray(sqlQuery("SELECT b.image AS image FROM backgrounds AS b WHERE b.id=1;")); + return $background_array[0]["image"]; +} + +function dbGetGraffitiBackground($id){ + $background_array = resultsetToArray(sqlQuery("SELECT b.image AS image FROM `graffiti` AS g, backgrounds AS b WHERE g.id=$id AND b.id=g.background_id;")); + return $background_array[0]["image"]; +} + +function dbSetGraffitiBackground($id, $image){ + sqlQuery("INSERT INTO backgrounds (image) VALUES ('" . addSlashes($image) . "');"); + $newID = sqlFetchArray(sqlQuery("SELECT LAST_INSERT_ID();")); + + sqlQuery("UPDATE graffiti SET background_id='" . addSlashes($newID["last_insert_id()"]) . "' WHERE id='$id'"); + return 1; +} + +function dbUpdateLayeredGraffitiById($id, &$data) { + sqlQuery("UPDATE layered_graffiti SET data='" . addSlashes($data) . "' WHERE id='$id'"); +} + +function dbGetGraffitiOriginalThumbnail($id){ + $result = resultsetToArray(sqlQuery("SELECT first_thumbnail FROM graffiti WHERE id='$id';")); + return $result[0]["first_thumbnail"]; +} + +function dbGetGraffitiThumbnail($id){ + $result = resultsetToArray(sqlQuery("SELECT thumbnail FROM graffiti WHERE id='$id';")); + return $result[0]["thumbnail"]; +} + +function dbInsertLayer(&$thumbnail, $graffiti_id, $root_id, $element_id) { + $id = $GLOBALS["id"]; + $date = time(); + sqlQuery("INSERT INTO graffiti (graffiti_id , root_id, element_id, targetType, poster_id, date) VALUES ('" . addSlashes($graffiti_id) . "', '" . addSlashes($root_id) . "', '" . addSlashes($element_id) . "', 'graffiti', '" . addSlashes($id) . "', '" . addSlashes($date) . "');"); + sqlQuery("UPDATE graffiti SET thumbnail='".addSlashes(&$thumbnail)."' WHERE id=$root_id;"); + + return sqlFetchArray(sqlQuery("SELECT LAST_INSERT_ID();")); +} + +function dbInsertLayeredGraffitiByUser(&$thumbnail, $user_id, $element_id) { + $id = $GLOBALS["id"]; + $date = time(); + sqlQuery("INSERT INTO graffiti (user_id ,element_id, targetType, poster_id, date, first_thumbnail, thumbnail ) VALUES ('" . addSlashes($user_id) . "', '" . addSlashes($element_id) . "', 'user','" . addSlashes(&$thumbnail) . "', '" . addSlashes($id) . "', '" . addSlashes($date) . "');"); + + return sqlFetchArray(sqlQuery("SELECT LAST_INSERT_ID();")); +} + +function dbInsertLayeredGraffitiBySite(&$thumbnail, $site_id, $element_id) { + $id = $GLOBALS["id"]; + $date = time(); + sqlQuery("INSERT INTO graffiti (site_id ,element_id, targetType, date, poster_id, thumbnail, first_thumbnail ) VALUES ('" . addSlashes($site_id) . "', '" . addSlashes($element_id) . "', 'site', '" . addSlashes($date) . "', '" . addSlashes($id) . "', '". addSlashes(&$thumbnail) . "', '" . addSlashes(&$thumbnail)."');"); + + return sqlFetchArray(sqlQuery("SELECT LAST_INSERT_ID();")); +} + +function dbInsertLayeredGraffitiByLocation(&$thumbnail, $x,$y,$z,$layer_id, $element_id) { + $id = $GLOBALS["id"]; + $date = time(); + + sqlQuery("INSERT INTO graffiti (location_x,location_y,location_z,location_layer_id,element_id, targetType, poster_id, date, first_thumbnail, thumbnail ) VALUES ('" . addSlashes($x) . "', '" . addSlashes($y) . "', '" . addSlashes($z) . "', '" . addSlashes($layer_id) . "', '" . addSlashes($element_id) . "', 'location','" . addSlashes($id) . "', '" . addSlashes($date) . "', '" . addSlashes(&$thumbnail) . "', '". addSlashes(&$thumbnail)."');"); + + + return sqlFetchArray(sqlQuery("SELECT LAST_INSERT_ID();")); +} + // Returns an array(limit, order) to use in your query. function dbGraffitiQueryOptions($sortKey, $maxToShow, $index) { @@ -90,6 +161,41 @@ return SpatialDB::queryCached($table, $query, new Area(new Point($x, $y, $z), new Circle($radius)), "location_x", "location_y", "location_z"); } +function dbGetLayeredGraffitiInSphereByIdXYZRadius($id, $x, $y, $z, $layer, $radius, $sortKey = null, $maxToShow = null, $index = null, $count = false) { + + // Get what to select for. + if($count) $fields = "count(*)"; + else $fields = "id, thumbnail"; + + // Build the query describing the information we want from the table. The + // %PREDICATE% token will be replaced by the SpatialDB::query function to + // include the predicate required to restrict the data returned to the given + // spatial area. + $table = "graffiti"; + $query = "SELECT $fields FROM %TABLE% WHERE targetType='" . TARGET_TYPE_LOCATION . "' and location_layer_id='$layer' and %PREDICATE%" . " "; + + // Get the query results. Use the cache if possible. + return SpatialDB::queryCached($table, $query, new Area(new Point($x, $y, $z), new Circle($radius)), "location_x", "location_y", "location_z"); +} + +function dbRetrieveLayeredGraffitiAtUser($id, $userId, $sortKey = null, $maxToShow = null, $index = null, $count = false) { + + // Get what to select for. + if($count) $fields = "count(*)"; + else $fields = "id, thumbnail"; + + return resultsetToArray(sqlQuery("select $fields from graffiti where targetType='" . TARGET_TYPE_USER . "' and user_Id='$userId';")); +} + +function dbRetrieveLayeredGraffitiAtSite($id, $siteId, $sortKey = null, $maxToShow = null, $index = null, $count = false) { + + // Get what to select for. + if($count) $fields = "count(*)"; + else $fields = "id, thumbnail"; + + return resultsetToArray(sqlQuery("select $fields from graffiti where targetType='" . TARGET_TYPE_SITE . "' and site_Id='$siteId';")); +} + function dbRetrieveGraffitiAtSite($id, $siteId, $sortKey = null, $maxToShow = null, $index = null, $count = false) { // Get the query options. @@ -518,5 +624,16 @@ SpatialDB::updateWithoutLocation($table, $query, $predicate); } +function dbInsertElementData($element_id, $mime_type, &$data) { + sqlQuery("INSERT INTO element_data (element_id, mime_type, element_data) VALUES ('" . addSlashes($element_id) . "', '" . addSlashes($mime_type) . "', '" . addSlashes($data) . "');"); + return sqlFetchArray(sqlQuery("SELECT LAST_INSERT_ID();")); +} + +function dbInsertElement($name, $description) { + sqlQuery("INSERT INTO elements (name, description) VALUES ('" . addSlashes($name) . "', '" . addSlashes($description) . "');"); + + return sqlFetchArray(sqlQuery("SELECT LAST_INSERT_ID();")); +} + ?> Index: active_campus_explorer/functions/data_access/db/elements_sql_fn.php =================================================================== --- active_campus_explorer/functions/data_access/db/elements_sql_fn.php (revision 0) +++ active_campus_explorer/functions/data_access/db/elements_sql_fn.php (revision 4663) @@ -0,0 +1,58 @@ + Index: active_campus_explorer/functions/data_access/db/Makefile.am =================================================================== --- active_campus_explorer/functions/data_access/db/Makefile.am (revision 4449) +++ active_campus_explorer/functions/data_access/db/Makefile.am (revision 4663) @@ -2,6 +2,6 @@ htmldir = $(prefix)/active_campus_explorer/functions/data_access/db -html_DATA = buddies_sql_fn.php ids_sql_fn.php profiles_sql_fn.php sites_sql_fn.php location_sql_fn.php graffiti_sql_fn.php notes_sql_fn.php users_sql_fn.php maps_sql_fn.php main_sql_fn.php index.html authenticate_sql_fn.php ap_sql_fn.php geolocation_history_sql_fn.php manual_location_history_sql_fn.php jabber.php messages_sql_fn.php reminders_sql_fn.php +html_DATA = buddies_sql_fn.php ids_sql_fn.php profiles_sql_fn.php sites_sql_fn.php location_sql_fn.php graffiti_sql_fn.php notes_sql_fn.php users_sql_fn.php maps_sql_fn.php main_sql_fn.php index.html authenticate_sql_fn.php ap_sql_fn.php geolocation_history_sql_fn.php manual_location_history_sql_fn.php jabber.php messages_sql_fn.php reminders_sql_fn.php elements_sql_fn.php EXTRA_DIST = $(html_DATA) Index: active_campus_explorer/functions/data_access/graffiti_data_access_fn.php =================================================================== --- active_campus_explorer/functions/data_access/graffiti_data_access_fn.php (revision 4449) +++ active_campus_explorer/functions/data_access/graffiti_data_access_fn.php (revision 4663) @@ -92,6 +92,80 @@ return($graffitiDescriptor); } +function daInsertElementData($element_id, $mimeType, &$data){ + return dbInsertElementData($element_id, $mimeType, &$data); +} + +function daInsertElement($name, $description){ + return dbInsertElement($name, $description); +} + +function daGetLayeredGraffitiById($id) { + $graffiti = dbGetLayeredGraffitiById($id); + if($graffiti === false) return false; + return($graffiti); +} + + +function daGetGraffitiOriginalThumbnail($id) { + $graffiti = dbGetGraffitiOriginalThumbnail($id); + if($graffiti === false) return false; + return($graffiti); +} + +function daGetGraffitiThumbnail($id) { + $graffiti = dbGetGraffitiThumbnail($id); + if($graffiti === false) return false; + return($graffiti); +} + +function daGetDefaultGraffitiBackground() { + $graffiti = dbGetDefaultGraffitiBackground(); + if($graffiti === false) return false; + return($graffiti); +} + +function daGetGraffitiBackground($id) { + $graffiti = dbGetGraffitiBackground($id); + if($graffiti === false) return false; + return($graffiti); +} + +function daSetGraffitiBackground($id, $image){ + return dbSetGraffitiBackground($id, $image); +} + +function daUpdateLayeredGraffiti($id, &$data) { + dbUpdateLayeredGraffitiById($id, &$data); +} + + + +function daInsertLayeredGraffitiNearby(&$thumbnail, $element_id, $id=null) { + if(!isset($id)) $id=daGetId(); + + $operator = daGetOperatorInfoCached($id); + $mapContext = new MapContext(new Point($operator["x"], $operator["y"], $operator["z"])); + return dbInsertLayeredGraffitiByLocation(&$thumbnail, $operator["x"], $operator["y"], $operator["z"], $mapContext->layer(), $element_id); +} + + +function daInsertLayer(&$thumbnail, $graffiti_id, $root_id, $element_id){ + return dbInsertLayer(&$thumbnail, $graffiti_id, $root_id, $element_id); +} + +function daInsertLayeredGraffitiByUser(&$thumbnail, $user_id, $element_id){ + return dbInsertLayeredGraffitiByUser(&$thumbnail, $user_id, $element_id); +} + +function daInsertLayeredGraffitiBySite(&$thumbnail, $site_id, $element_id){ + return dbInsertLayeredGraffitiBySite(&$thumbnail, $site_id, $element_id); +} + +function daInsertLayeredGraffitiByLocation(&$thumbnail, $x, $y, $z, $l, $element_id){ + return dbInsertLayeredGraffitiByLocation(&$thumbnail, $x, $y, $z, $l, $element_id); +} + // Returns 0 if ok, non-zero otherwise. function daInsertGraffitiAtLocation($subject, $type, &$data, $x, $y, $z, $layer, $anonymous = false, $id = null) { if(!isset($id)) $id = daGetId(); @@ -206,6 +280,107 @@ * @param count Set to true if only a count of the graffiti is desired. * Defaults to false. */ +function daRetrieveLayeredGraffitiAtTarget($target, $maxToShow = null, $index = null, $sortKey=null, $count = false) { + + // Translate the target to the representitive class. + $target = annotatableTargetDecode($target); + + // Retrieve it from whatever target it specified. + if($target->type == TARGET_TYPE_LOCATION || $target->type == TARGET_TYPE_CURRENT_LOCATION || $target->type == TARGET_TYPE_CURRENT_VIEW_LOCATION || $target->type == TARGET_TYPE_CURRENT_MAP_LOCATION) { + $circle = $target->layerArea->circle(); + return daRetrieveLayeredGraffitiAtLocation($target->actionPoint->x, $target->actionPoint->y, $target->actionPoint->z, $target->layerArea->layer, $circle->radius, $sortKey, $maxToShow, $index, $count); + } + if($target->type == TARGET_TYPE_SITE) { + return daRetrieveLayeredGraffitiAtSite($target->siteId, $sortKey, $maxToShow, $index, $count); + } + if($target->type == TARGET_TYPE_USER) { + return daRetrieveLayeredGraffitiAtUser($target->userId, $sortKey, $maxToShow, $index, $count); + } + if($target->type == TARGET_TYPE_GRAFFITI) { + return daRetrieveLayeredGraffitiAtGraffiti($target->graffitiId, $sortKey, $maxToShow, $index, $count); + } + + // Unknown target type. + return array(); +} + +// Returns an array of GraffitiDescriptor classes. +function daRetrieveLayeredGraffitiAtLocation($x, $y, $z, $layer, $radius, $sortKey = null, $maxToShow = null, $index = null, $count = false) { + $id=$GLOBALS["id"]; + + // Get the info from the db. + $graffiti = dbGetLayeredGraffitiInSphereByIdXYZRadius($id, $x, $y, $z, $layer, $radius, $sortKey, $maxToShow, $index, $count); + + // If we just want the count, return that. + if($count) return $graffiti[0][0]; + + // Return them. + return($graffiti); +} + +// Returns an array of GraffitiDescriptor classes. Note that current location +// is your current map view location which might differ from your current +// physical location. If radius is null, the view radius is used. +function daRetrieveLayeredGraffitiAtCurrentMapLocation($radius=null, $sortKey = null, $maxToShow = null, $index = null, $count = false) { +exit; + + // Get info that wasn't specified. + $layer = mapGetLayer(); + if($radius == null) { + $radius = mapGetViewRadius($layer); + } + $mapLocation = mapGetMapLocation(); + $x = $mapLocation['x']; + $y = $mapLocation['y']; + $z = $mapLocation['z']; + + return daRetrieveLayeredGraffitiAtLocation($x, $y, $z, $layer, $radius, $sortKey, $maxToShow, $index, $count); +} + +// Returns an array of GraffitiDescriptor classes. +function daRetrieveLayeredGraffitiAtSite($siteId, $sortKey = null, $maxToShow = null, $index = null, $count = false) { + $id=$GLOBALS["id"]; + + // Get the info from the db. + $graffiti = dbRetrieveLayeredGraffitiAtSite($id, $siteId, $sortKey, $maxToShow, $index, $count); + + // If we just want the count, return that. + if($count) return $graffiti[0][0]; + + return($graffiti); +} + +// Returns an array of GraffitiDescriptor classes. +function daRetrieveLayeredGraffitiAtUser($userId, $sortKey = null, $maxToShow = null, $index = null, $count = false) { + $id=$GLOBALS["id"]; + + // Get the info from the db. + $graffiti = dbRetrieveLayeredGraffitiAtUser($id, $userId, $sortKey, $maxToShow, $index, $count); + + // If we just want the count, return that. + if($count) return $graffiti[0][0]; + + // Return them. + return($graffiti); +} + + +/** + * Returns an array of matching GraffitiDescriptor classes or a count of the + * graffiti that would have been returned had 'count' not been set. + * + * @param target The target to retrieve from. + * + * @param maxToShow Maximum number of graffiti to return, or null if you want + * them all. + * + * @param index The number of graffiti to skip in the ordered result. + * + * @param sortKey Null for random, or "activity". + * + * @param count Set to true if only a count of the graffiti is desired. + * Defaults to false. + */ function daRetrieveGraffitiAtTarget($target, $maxToShow = null, $index = null, $sortKey = null, $count = false) { // Translate the target to the representitive class. @@ -329,6 +504,10 @@ return($retval); } +function daGetNearbyLayeredGraffiti($areaLayer) { + return SpatialDB::queryCached("graffiti", "select id, location_x as x, location_y as y, location_z as z from %TABLE% where %PREDICATE%", $areaLayer, "location_x", "location_y", "location_z"); +} + // Returns an array of arrays, each // element represents the fields from one graffiti // record. Index: ace_install/schema.dump =================================================================== --- ace_install/schema.dump (revision 4449) +++ ace_install/schema.dump (revision 4663) @@ -961,3 +961,65 @@ PRIMARY KEY (id), KEY viewer_id (viewer_id,graffiti_id) ) TYPE=MyISAM; +# -------------------------------------------------------- + +# +# Table structure for table `elements` +# + +CREATE TABLE `elements` ( + `id` int(11) NOT NULL auto_increment, + `name` text, + `description` text, + PRIMARY KEY (`id`) +) TYPE=MyISAM; + +# -------------------------------------------------------- + +# +# Table structure for table `element_data` +# +CREATE TABLE `element_data` ( + `id` int(11) NOT NULL auto_increment, + `element_id` int(11) NOT NULL default '0', + `mime_type` text NOT NULL, + `element_data` longblob NOT NULL, + PRIMARY KEY (`id`) +) TYPE=MyISAM; + +# -------------------------------------------------------- + +# +# Table structure for table `graffiti` +# +CREATE TABLE `graffiti` ( + `location_x` int(11) default NULL, + `location_y` int(11) default NULL, + `location_z` int(11) default NULL, + `location_layer_id` int(11) default NULL, + `site_id` int(11) default NULL, + `user_id` int(11) default NULL, + `graffiti_id` int(11) default NULL, + `targetType` varchar(20) NOT NULL default '', + `poster_id` int(20) NOT NULL default '0', + `date` int(11) NOT NULL default '0', + `element_id` int(11) NOT NULL default '0', + `id` int(11) NOT NULL auto_increment, + `root_id` int(11) NOT NULL default '0', + `thumbnail` longblob NOT NULL, + `background_id` int(11) NOT NULL default '1', + `first_thumbnail` longblob NOT NULL, + PRIMARY KEY (`id`) +) TYPE=MyISAM; + +# -------------------------------------------------------- + +# +# Table structure for table `backgrounds` +# +CREATE TABLE `backgrounds` ( + `id` int(11) NOT NULL auto_increment, + `image` longblob NOT NULL, + PRIMARY KEY (`id`) +) TYPE=MyISAM; +