Reformat dates. Surprisingly limited options for parsing and displaying dates.
[potlatch2.git] / net / systemeD / potlatch2 / RelationSelectPanel.mxml
index 66b78b63e165df2cec84c12bdebb1dce9191705d..6e95fceba1441f08aba08eeb37881209e144b529 100644 (file)
         private var conn:Connection;
         private var relationList:Array;
         private var entity:Entity;
+               private var tags:Object;
 
-        public function init(e:Entity):void {
+        public function init(e:Entity, t:Object):void {
           entity = e;
+          tags = {}; for (var k:String in t) { tags[k]=t[k]; } // deep copy tags
           PopUpManager.addPopUp(this, Application(Application.application), true);
           PopUpManager.centerPopUp(this);
     
           var titles:Array = [];
           conn = Connection.getConnectionInstance();
-          relationList = conn.getAllRelationIDs();
+          relationList = conn.getMatchingRelationIDs(tags);
           if (relationList.length == 0) {
-            warning.text = "No relations loaded";
+            warning.text = "No relations available";
           } else {
             warning.text = "These relations are available:";
           }
         }
         
         public function closeAndNewRelation():void {
-          var relation:Relation = conn.createRelation({}, [new RelationMember(entity, '')],
+          var relation:Relation = conn.createRelation(tags, [new RelationMember(entity, '')],
               MainUndoStack.getGlobalStack().addAction)
           PopUpManager.removePopUp(this);
-          trace("edit relation "+id);
           var panel:RelationEditorPanel = RelationEditorPanel(
               PopUpManager.createPopUp(Application(Application.application), RelationEditorPanel, true));
           panel.setRelation(relation);