[MKDoc-commit] Patch from Sam - implementing the enhanced component move control.

chris at mkdoc.demon.co.uk chris at mkdoc.demon.co.uk
Mon Jul 18 16:10:14 BST 2005


Log Message:
-----------
Patch from Sam - implementing the enhanced component move control.

Tags:
----
mkdoc-1-6

Modified Files:
--------------
    mkd/flo:
        Component.pm
        Editor.pm
    mkd/templates/editor/discussion:
        en.html
    mkd/templates/editor/file:
        en.html
    mkd/templates/editor/headlines:
        en.html
    mkd/templates/editor/html:
        en.html
    mkd/templates/editor/image:
        en.html
    mkd/templates/editor/link:
        en.html
    mkd/templates/editor/photo:
        en.html
    mkd/templates/editor/poll:
        en.html
    mkd/templates/editor/rss:
        en.html
    mkd/templates/editor/text:
        en.html
    mkd/templates/editor/timerange:
        en.html

-------------- next part --------------
Index: en.html
===================================================================
RCS file: /var/spool/cvs/mkd/templates/editor/image/Attic/en.html,v
retrieving revision 1.1.2.10
retrieving revision 1.1.2.11
diff -Ltemplates/editor/image/en.html -Ltemplates/editor/image/en.html -u -r1.1.2.10 -r1.1.2.11
--- templates/editor/image/en.html
+++ templates/editor/image/en.html
@@ -9,8 +9,6 @@
   class="image-component"
   xmlns:petal="http://purl.org/petal/1.0/"
   petal:define="image_img        string:${self/block_name}_img;
-                name_move_up     string:${self/block_name}_up;
-                name_move_down   string:${self/block_name}_down;
                 name_delete      string:${self/block_name}_delete;
                 name_alt         string:${self/block_name}_alt;
                 name_description string:${self/block_name}_description;
@@ -49,30 +47,7 @@
     >The title field is empty.</p>
   </div>
 
-    <p
-      class="up"
-    >
-      <label
-        for="image_up"
-        xml:lang="en"
-        lang="en"
-        dir="ltr"
-        petal:attributes="for name_move_up"
-      >
-        Move component
-      </label>
-      <input
-        type="submit"
-        name="image_up"
-        id="image_up"
-        value="Up"
-        xml:lang="en"
-        lang="en"
-        dir="ltr"
-        title="Move this component up."
-        petal:attributes="name name_move_up; id name_move_up"
-      />
-    </p>
+  <?include file="/fragments/move_control/"?>
 
     <p>
       <img
@@ -234,29 +209,5 @@
       >Move to another document</a>
     </p>
 
-    <p
-      class="down"
-    >
-      <label
-        for="image_down"
-        xml:lang="en"
-        lang="en"
-        dir="ltr"
-        petal:attributes="for name_move_down"
-      >
-        Move component
-      </label>
-      <input
-        type="submit"
-        name="image_down"
-        id="image_down"
-        value="Down"
-        xml:lang="en"
-        lang="en"
-        dir="ltr"
-        title="Move this component down."
-        petal:attributes="name name_move_down; id name_move_down"
-      />
-    </p>
 </fieldset>
 
Index: en.html
===================================================================
RCS file: /var/spool/cvs/mkd/templates/editor/link/Attic/en.html,v
retrieving revision 1.1.2.10
retrieving revision 1.1.2.11
diff -Ltemplates/editor/link/en.html -Ltemplates/editor/link/en.html -u -r1.1.2.10 -r1.1.2.11
--- templates/editor/link/en.html
+++ templates/editor/link/en.html
@@ -11,8 +11,6 @@
   xmlns:petal="http://purl.org/petal/1.0/"
   petal:define="align            self/align;
                 dir              self/direction;
-                name_move_up     string:${self/block_name}_up;
-                name_move_down   string:${self/block_name}_down;
                 name_delete      string:${self/block_name}_delete;
                 name_url         string:${self/block_name}_url;
                 name_title       string:${self/block_name}_title;
@@ -58,35 +56,7 @@
     >The 'Description' field is empty.</p>
   </div>
 
-
-    <p
-      class="up"
-    >
-
-      <label
-        for="link_up"
-        xml:lang="en"
-        lang="en"
-        dir="ltr"
-        petal:attributes="for name_move_up"
-      >
-        Move component
-      </label>
-
-      <input
-        type="submit"
-        name="link_up"
-        id="link_up"
-        value="Up"
-        xml:lang="en"
-        lang="en"
-        dir="ltr"
-        title="Move this component up."
-        petal:attributes="name name_move_up; id name_move_up"
-      />
-
-    </p>
-
+  <?include file="/fragments/move_control/"?>
 
     <p>
       <em
@@ -209,29 +179,4 @@
       >Move to another document</a>
     </p>
 
-
-    <p
-      class="down"
-    >
-      <label
-        for="text_down"
-        xml:lang="en"
-        lang="en"
-        dir="ltr"
-        petal:attributes="for name_move_down"
-      >
-        Move component
-      </label>
-      <input
-        type="submit"
-        name="link_down"
-        id="link_down"
-        value="Down"
-        xml:lang="en"
-        lang="en"
-        dir="ltr"
-        title="Move this component down."
-        petal:attributes="name name_move_down; id name_move_down"
-      />
-    </p>
 </fieldset>
Index: Component.pm
===================================================================
RCS file: /var/spool/cvs/mkd/flo/Component.pm,v
retrieving revision 1.3.2.36
retrieving revision 1.3.2.37
diff -Lflo/Component.pm -Lflo/Component.pm -u -r1.3.2.36 -r1.3.2.37
--- flo/Component.pm
+++ flo/Component.pm
@@ -634,6 +634,48 @@
     $@ and warn "== $@ ==";
 }
 
+# determine contents of the Move button target select list, correcting
+# for placement, minimum and maximum
+sub move_targets {
+    my $self   = shift;
+    my $editor = flo::Editor::_ETERNAL_(); 
+    my $count  = $editor->component_count();
+    my $pos    = $editor->component_position($self);
+    my $last   = $count - 1;
+
+    # setup available targets
+    my @targets;
+    push @targets, { label => 'to top', 
+                     value => 'top' }
+      if $pos != 0;
+    push @targets, { label => 'up 3', 
+                     value => '-3' }
+      if $pos > 2;
+    push @targets, { label => 'up 2', 
+                     value => '-2' }
+      if $pos > 1;
+    push @targets, { label       => 'up', 
+                     value       => '-1',
+                     is_selected => 1 }
+      if $pos > 0;
+    push @targets, { label => 'down', 
+                     value => '+1', 
+                     ($pos == 0 ? (is_selected => 1) : ()) }
+      if $pos < $last;
+    push @targets, { label => 'down 2', 
+                     value => '+2' }
+      if $pos < ($last - 1);
+    push @targets, { label => 'down 3', 
+                     value => '+3' }
+      if $pos < ($last - 2);
+    push @targets, { label => 'to bottom', 
+                     value => 'bottom' }
+      if $pos != $last;
+
+    return \@targets;
+}
+
+
 
 ##                                                               #
 #  ALL THESE DEFAULT TO THE PARENT DOCUMENT METHODS, BUT SHOULD  #
Index: Editor.pm
===================================================================
RCS file: /var/spool/cvs/mkd/flo/Editor.pm,v
retrieving revision 1.12.2.43
retrieving revision 1.12.2.44
diff -Lflo/Editor.pm -Lflo/Editor.pm -u -r1.12.2.43 -r1.12.2.44
--- flo/Editor.pm
+++ flo/Editor.pm
@@ -36,6 +36,7 @@
 our $EXTERNAL_LINKS_OPEN_IN_NEW_WINDOW = 0;
 
 use constant BLOCK => 'edit_block';
+our $QBLOCK = quotemeta (BLOCK) . "_";   
 
 
 our $IMP = {};
@@ -365,8 +366,7 @@
     
     $self->_initialize_initialize ($cgi);
     $self->_initialize_delete ($cgi);
-    $self->_initialize_up ($cgi);
-    $self->_initialize_down ($cgi);
+    $self->_initialize_move ($cgi);
     $self->_initialize_add ($cgi);
     $self->_initialize_uri_names ($cgi);
 }
@@ -436,12 +436,10 @@
     # This loop sets all the components by scanning the CGI parameters
     foreach my $cgi_param_name ($cgi->param)
     {
-	my $qBLOCK = quotemeta (BLOCK) . "_";
-
 	# if this CGI param is appropriate because it starts by BLOCK
-	if ($cgi_param_name =~ /^$qBLOCK([0-9]+)_([a-zA-Z]+)(?:_.*)?$/)
+	if ($cgi_param_name =~ /^$QBLOCK([0-9]+)_([a-zA-Z]+)(?:_.*)?$/)
 	{
-	    my ($id, $type) = $cgi_param_name =~ /^$qBLOCK([0-9]+)_([a-zA-Z]+)(?:_.*)?$/;
+	    my ($id, $type) = $cgi_param_name =~ /^$QBLOCK([0-9]+)_([a-zA-Z]+)(?:_.*)?$/;
 	    
 	    # if $self->{block}->{$id} is already defined, then this component
 	    # has been instanciated already and we can safely move on the next
@@ -457,7 +455,7 @@
 	    require $file;
 	    import  $file;
 	    
-	    my $param_name = $qBLOCK . $id . '_' . $type;
+	    my $param_name = $QBLOCK . $id . '_' . $type;
 	    $self->{block}->{$id} = $class->new ( cgi => $cgi, param_name => $param_name );
 	}
     }
@@ -479,11 +477,9 @@
     # a component is requested
     foreach my $cgi_param_name ($cgi->param)
     {
-	my $qBLOCK = quotemeta (BLOCK) . "_";
-
-	if ($cgi_param_name =~ /^$qBLOCK([0-9]+)_([a-zA-Z]+)_delete$/)
+	if ($cgi_param_name =~ /^$QBLOCK([0-9]+)_([a-zA-Z]+)_delete$/)
 	{
-	    my ($id, $type) = $cgi_param_name =~ /^$qBLOCK([0-9]+)_([a-zA-Z]+)_delete$/;
+	    my ($id, $type) = $cgi_param_name =~ /^$QBLOCK([0-9]+)_([a-zA-Z]+)_delete$/;
 	    delete $self->{block}->{$id};
 	}
     }
@@ -504,90 +500,95 @@
     }
 }
 
-
 ##
-# $self->_initialize_up;
+# $self->_initialize_move;
 # ----------------------
 #   Scans the CGI parameters to check if a component has
-#   to be moved up
+#   to be moved
 ##
-sub _initialize_up
-{
-    my $self = shift;
-    my $cgi  = shift;
-   
-    # Then we need to re-scan the cgi parameters to check if a component
-    # has to move up.
-    foreach my $cgi_param_name ($cgi->param)
-    {
-	my $qBLOCK = quotemeta (BLOCK) . "_";
-	
-	if ($cgi_param_name =~ /^$qBLOCK([0-9]+)_([a-zA-Z]+)_up$/)
-	{
-	    my ($id, $type) = $cgi_param_name =~ /^$qBLOCK([0-9]+)_([a-zA-Z]+)_up$/;
-	    if ($id > 1)
-	    {
-		my $id_1 = $id;
-		my $id_2 = $id - 1,
-		
-		my $component_1 = $self->{block}->{$id_1};
-		my $component_2 = $self->{block}->{$id_2};
-		
-		my $type_1 = _PAM_()->{ref $component_1};
-		my $type_2 = _PAM_()->{ref $component_2};
+sub _initialize_move {
+    my ($self, $cgi) = @_;
 
-		$self->{block}->{$id_1} = $component_2;
-		$self->{block}->{$id_2} = $component_1;
+    # look for an indicator that a move button was clicked
+    foreach my $name ($cgi->param()) {
+	next unless $name =~ /^$QBLOCK([0-9]+)_([a-zA-Z]+)_move_button$/;
+        my ($id, $type) = ($1, $2);
+        
+        # collect target for this move
+        my $target = $cgi->param(BLOCK . "_" . $id . "_" . $type . "_move_target");
+
+        # move the component up or down as requested
+        if ($target =~ /^\+(\d+)$/) {
+            my $distance = $1;
+            $id = $self->_move_component_down($id)
+              for (1 .. $distance);
+
+        } elsif ($target =~ /^-(\d+)$/) {
+            my $distance = $1;
+            $id = $self->_move_component_up($id)
+              for (1 .. $distance);
+
+        } elsif ($target eq 'top') {
+            $id = $self->_move_component_up($id)
+              while ($id != 1);
+
+        } elsif ($target eq 'bottom') {
+            my $last = scalar keys %{$self->{block}};
+            $id = $self->_move_component_down($id)
+              while ($id != $last);
+
+        } else {
+            die "Unable to parse move target: $target.";
+        }
 
-		$component_1->{param_name} = BLOCK . "_" . $id_2 . "_" . $type_1;
-		$component_2->{param_name} = BLOCK . "_" . $id_1 . "_" . $type_2;
-	    }
-	}
     }
 }
 
+# move a component down one
+sub _move_component_down {
+    my ($self, $id) = @_;
+    return $id unless $id < scalar keys %{$self->{block}};
 
-##
-# $self->_initialize_up;
-# ----------------------
-#   Scans the CGI parameters to check if a component has
-#   to be moved down
-##
-sub _initialize_down
-{
-    my $self = shift;
-    my $cgi  = shift;
+    my $id_1 = $id;
+    my $id_2 = $id + 1;
     
-    # Then we need to re-scan the cgi parameters to check if a component
-    # has to move down
-    foreach my $cgi_param_name ($cgi->param)
-    {
-	my $qBLOCK = quotemeta (BLOCK) . "_";
-	
-	if ($cgi_param_name =~ /^$qBLOCK([0-9]+)_([a-zA-Z]+)_down$/)
-	{
-	    my ($id, $type) = $cgi_param_name =~ /^$qBLOCK([0-9]+)_([a-zA-Z]+)_down$/;
-	    if ($id < scalar keys %{$self->{block}})
-	    {
-		my $id_1 = $id;
-		my $id_2 = $id + 1,
-		
-		my $component_1 = $self->{block}->{$id_1};
-		my $component_2 = $self->{block}->{$id_2};
-		
-		my $type_1 = _PAM_()->{ref $component_1};
-		my $type_2 = _PAM_()->{ref $component_2};
-		
-		$self->{block}->{$id_1} = $component_2;
-		$self->{block}->{$id_2} = $component_1;
-		
-		$component_1->{param_name} = BLOCK . "_" . $id_2 . "_" . $type_1;
-		$component_2->{param_name} = BLOCK . "_" . $id_1 . "_" . $type_2;
-	    }
-	}
-    }
+    my $component_1 = $self->{block}->{$id_1};
+    my $component_2 = $self->{block}->{$id_2};
+    
+    my $type_1 = _PAM_()->{ref $component_1};
+    my $type_2 = _PAM_()->{ref $component_2};
+    
+    $self->{block}->{$id_1} = $component_2;
+    $self->{block}->{$id_2} = $component_1;
+    
+    $component_1->{param_name} = BLOCK . "_" . $id_2 . "_" . $type_1;
+    $component_2->{param_name} = BLOCK . "_" . $id_1 . "_" . $type_2;
+    
+    return $id_2;
 }
 
+# move a component up one
+sub _move_component_up {
+    my ($self, $id) = @_;
+    return $id unless $id > 1;
+
+    my $id_1 = $id;
+    my $id_2 = $id - 1;
+    
+    my $component_1 = $self->{block}->{$id_1};
+    my $component_2 = $self->{block}->{$id_2};
+    
+    my $type_1 = _PAM_()->{ref $component_1};
+    my $type_2 = _PAM_()->{ref $component_2};
+    
+    $self->{block}->{$id_1} = $component_2;
+    $self->{block}->{$id_2} = $component_1;
+    
+    $component_1->{param_name} = BLOCK . "_" . $id_2 . "_" . $type_1;
+    $component_2->{param_name} = BLOCK . "_" . $id_1 . "_" . $type_2;
+    
+    return $id_2;
+}
 
 ##
 # $self->_initialize_add;
@@ -605,8 +606,7 @@
     if (defined $cgi->param ('_new_component_add'))
     {
 	my $cgi_param_name = $cgi->param ('_new_component');
-	my $qBLOCK = quotemeta (BLOCK) . '_';
-	my ($id, $type) = $cgi_param_name =~ /^$qBLOCK([0-9]+)_([a-zA-Z]+)$/;
+	my ($id, $type) = $cgi_param_name =~ /^$QBLOCK([0-9]+)_([a-zA-Z]+)$/;
 	my $nb = $cgi->param ('_new_component_amount');
 	my $map = _MAP_();
 	my $class = $map->{$type};
@@ -682,6 +682,25 @@
     return $self->{block}->{$id};
 }
 
+# returns the current count of live components
+sub component_count {
+    my $self = shift;
+    return scalar keys %{$self->{block}};
+}
+
+# working replacement for $component->position which is unreliable for
+# some reason
+sub component_position {
+    my $self      = shift;
+    my $component = shift;
+    my $block     = $self->{block};
+    my @keys = sort { $a <=> $b } keys %$block;
+    for (my $i = 0; $i < @keys; $i++) {
+        return $i 
+          if $component->{param_name} eq $block->{$keys[$i]}->{param_name};
+    }
+    return undef;
+}
 
 ##
 # $self->edit;
Index: en.html
===================================================================
RCS file: /var/spool/cvs/mkd/templates/editor/photo/Attic/en.html,v
retrieving revision 1.1.2.13
retrieving revision 1.1.2.14
diff -Ltemplates/editor/photo/en.html -Ltemplates/editor/photo/en.html -u -r1.1.2.13 -r1.1.2.14
--- templates/editor/photo/en.html
+++ templates/editor/photo/en.html
@@ -9,8 +9,6 @@
   class="photo-component"
   xmlns:petal="http://purl.org/petal/1.0/"
   petal:define="name_img          string:${self/block_name}_img;
-                name_move_up      string:${self/block_name}_up;
-                name_move_down    string:${self/block_name}_down;
                 name_delete       string:${self/block_name}_delete;
                 name_alt          string:${self/block_name}_alt;
                 name_description  string:${self/block_name}_description;
@@ -76,32 +74,7 @@
       >This date is not valid.</p>
     </div>
 
-
-
-    <p
-      class="up"
-    >
-      <label
-        for="photo_up"
-        xml:lang="en"
-        lang="en"
-        dir="ltr"
-        petal:attributes="for name_move_up"
-      >
-        Move component
-      </label>
-      <input
-        type="submit"
-        name="photo_up"
-        id="photo_up"
-        value="Up"
-        xml:lang="en"
-        lang="en"
-        dir="ltr"
-        title="Move this component up."
-        petal:attributes="name name_move_up; id name_move_up"
-      />
-    </p>
+    <?include file="/fragments/move_control/"?>
 
     <p>
       <img
@@ -380,29 +353,4 @@
       >Move to another document</a>
     </p>
 
-    <p
-      class="down"
-    >
-      <label
-        for="photo_down"
-        xml:lang="en"
-        lang="en"
-        dir="ltr"
-        petal:attributes="for name_move_down"
-      >
-        Move component
-      </label>
-      <input
-        type="submit"
-        name="photo_down"
-        id="photo_down"
-        value="Down"
-        xml:lang="en"
-        lang="en"
-        dir="ltr"
-        title="Move this component down."
-        petal:attributes="name name_move_down; id name_move_down"
-      />
-    </p>
-
 </fieldset>
Index: en.html
===================================================================
RCS file: /var/spool/cvs/mkd/templates/editor/poll/Attic/en.html,v
retrieving revision 1.1.2.10
retrieving revision 1.1.2.11
diff -Ltemplates/editor/poll/en.html -Ltemplates/editor/poll/en.html -u -r1.1.2.10 -r1.1.2.11
--- templates/editor/poll/en.html
+++ templates/editor/poll/en.html
@@ -26,8 +26,6 @@
                 name_hour_start       string:${self/block_name}_hour_start;
                 name_date_stop        string:${self/block_name}_date_stop;
                 name_hour_stop        string:${self/block_name}_hour_stop;
-                name_move_up          string:${self/block_name}_up;
-                name_move_down        string:${self/block_name}_down;
                 name_delete           string:${self/block_name}_delete"
 >
   <input
@@ -126,30 +124,7 @@
     >The stopping date must be further in time than the starting date...</p>
   </div>
 
-    <p
-      class="up"
-    >
-      <label
-        for="poll_up"
-        xml:lang="en"
-        lang="en"
-        dir="ltr"
-        petal:attributes="for name_move_up"
-      >
-        Move component
-      </label>
-      <input
-        type="submit"
-        name="poll_up"
-        id="poll_up"
-        value="Up"
-        xml:lang="en"
-        lang="en"
-        dir="ltr"
-        title="Move this component up."
-        petal:attributes="name name_move_up; id name_move_up"
-      />
-    </p>
+  <?include file="/fragments/move_control/"?>
 
     <p> 
       <em
@@ -586,30 +561,4 @@
     >Move to another document</a>
   </p>
 
-  <p
-    class="down"
-  >
-    <label
-      for="poll_down"
-      xml:lang="en"
-      lang="en"
-      dir="ltr"
-      petal:attributes="for name_move_down"
-    >
-      Move component
-    </label>
-
-    <input
-      type="submit"
-      name="poll_down"
-      id="poll_down"
-      value="Down"
-      xml:lang="en"
-      lang="en"
-      dir="ltr"
-      title="Move this component down."
-      petal:attributes="name name_move_down; id name_move_down"
-    />
-  </p>
-
 </fieldset>
Index: en.html
===================================================================
RCS file: /var/spool/cvs/mkd/templates/editor/rss/Attic/en.html,v
retrieving revision 1.1.2.10
retrieving revision 1.1.2.11
diff -Ltemplates/editor/rss/en.html -Ltemplates/editor/rss/en.html -u -r1.1.2.10 -r1.1.2.11
--- templates/editor/rss/en.html
+++ templates/editor/rss/en.html
@@ -13,8 +13,6 @@
 		name_max         string:${self/block_name}_max;
 		name_sort        string:${self/block_name}_sort;
 		name_template    string:${self/block_name}_template;
-                name_move_up     string:${self/block_name}_up;
-                name_move_down   string:${self/block_name}_down;
                 name_delete      string:${self/block_name}_delete;
                 align            self/align;
                 align_opposite   self/align_opposite;
@@ -58,30 +56,7 @@
     >The template you specified could not be found.</p>
   </div>
 
-    <p
-      class="up"
-    >
-      <label
-        for="file_up"
-        xml:lang="en"
-        lang="en"
-        dir="ltr"
-        petal:attributes="for name_move_up"
-      >
-        Move component 
-      </label>
-      <input
-        type="submit"
-        name="file_up"
-        id="file_up"
-        value="Up"
-        xml:lang="en"
-        lang="en"
-        dir="ltr"
-        title="Move this component up."
-        petal:attributes="name name_move_up; id name_move_up"
-      />
-    </p>
+  <?include file="/fragments/move_control/"?>
 
     <p>
       <em
@@ -306,29 +281,4 @@
       >Move to another document</a>
     </p>
 
-    <p
-      class="down"
-    >
-      <label
-        for="file_down"
-        xml:lang="en"
-        lang="en"
-        dir="ltr"
-        petal:attributes="for name_move_down"
-      >
-        Move component
-      </label>
-      <input
-        type="submit"
-        name="file_down"
-        id="file_down"
-        value="Down"
-        xml:lang="en"
-        lang="en"
-        dir="ltr"
-        title="Move this component down."
-        petal:attributes="name name_move_down; id name_move_down"
-      />
-    </p>
-
 </fieldset>
Index: en.html
===================================================================
RCS file: /var/spool/cvs/mkd/templates/editor/discussion/Attic/en.html,v
retrieving revision 1.1.2.9
retrieving revision 1.1.2.10
diff -Ltemplates/editor/discussion/en.html -Ltemplates/editor/discussion/en.html -u -r1.1.2.9 -r1.1.2.10
--- templates/editor/discussion/en.html
+++ templates/editor/discussion/en.html
@@ -14,8 +14,6 @@
                 name_mbox        string:${self/block_name}_mbox;
                 name_title       string:${self/block_name}_title;
                 name_description string:${self/block_name}_description;
-                name_move_up     string:${self/block_name}_up;
-                name_move_down   string:${self/block_name}_down;
                 name_delete      string:${self/block_name}_delete"
 >
 
@@ -54,31 +52,7 @@
     >The 'Description' field is empty.</p>
   </div>
 
-    <p
-      class="up"
-    >
-      <label
-        for="discussion_up"
-        xml:lang="en"
-        lang="en"
-        dir="ltr"
-        petal:attributes="for name_move_up"
-      >
-        Move component 
-      </label>
-      <input
-        type="submit"
-        name="discussion_up"
-        id="discussion_up"
-        value="Up"
-        xml:lang="en"
-        lang="en"
-        dir="ltr"
-        title="Move this component up."
-        petal:attributes="name name_move_up;
-                          id   name_move_up"
-      />
-    </p>
+  <?include file="/fragments/move_control/"?>
 
     <p>
       <em
@@ -198,29 +172,4 @@
       >Move to another document</a>
     </p>
 
-    <p
-      class="down"
-    >
-      <label
-        for="discussion_down"
-        xml:lang="en"
-        lang="en"
-        dir="ltr"
-        petal:attributes="for name_move_down"
-      >
-        Move component 
-      </label>
-      <input
-        type="submit"
-        name="discussion_down"
-        id="discussion_down"
-        value="Down"
-        xml:lang="en"
-        lang="en"
-        dir="ltr"
-        title="Move this component down."
-        petal:attributes="name name_move_down; id name_move_down"
-      />
-  </p>
-
 </fieldset>
Index: en.html
===================================================================
RCS file: /var/spool/cvs/mkd/templates/editor/text/Attic/en.html,v
retrieving revision 1.1.2.10
retrieving revision 1.1.2.11
diff -Ltemplates/editor/text/en.html -Ltemplates/editor/text/en.html -u -r1.1.2.10 -r1.1.2.11
--- templates/editor/text/en.html
+++ templates/editor/text/en.html
@@ -11,8 +11,6 @@
   petal:define="align          self/align;
                 align_opposite self/align_opposite;
                 dir            self/direction;
-                name_move_up   string:${self/block_name}_up;
-                name_move_down string:${self/block_name}_down;
                 name_delete    string:${self/block_name}_delete"
 >
 
@@ -22,33 +20,7 @@
     dir="ltr"
   >Text component</legend>
 
-    <p
-      class="up"
-    >
-
-      <label
-        for="text_up"
-        xml:lang="en"
-        lang="en"
-        dir="ltr"
-        petal:attributes="for name_move_up"
-      >
-        Move component
-      </label>
-
-      <input
-        type="submit"
-        name="text_up"
-        id="text_up"
-        value="Up"
-        xml:lang="en"
-        lang="en"
-        dir="ltr"
-        title="Move this component up."
-        petal:attributes="name name_move_up; id name_move_up"
-      />
-
-    </p>
+  <?include file="/fragments/move_control/"?>
 
     <p>
       <em
@@ -113,30 +85,5 @@
       >Move to another document</a>
     </p>
 
-    <p
-      class="down"
-    >
-      <label
-        for="text_down"
-        xml:lang="en"
-        lang="en"
-        dir="ltr"
-        petal:attributes="for name_move_down"
-      >
-        Move component
-      </label>
-      <input
-        type="submit"
-        name="text_down"
-        id="text_down"
-        value="Down"
-        xml:lang="en"
-        lang="en"
-        dir="ltr"
-        title="Move this component down."
-        petal:attributes="name name_move_down; id name_move_down"
-      />
-    </p>
-
 </fieldset>
 
Index: en.html
===================================================================
RCS file: /var/spool/cvs/mkd/templates/editor/file/Attic/en.html,v
retrieving revision 1.1.2.10
retrieving revision 1.1.2.11
diff -Ltemplates/editor/file/en.html -Ltemplates/editor/file/en.html -u -r1.1.2.10 -r1.1.2.11
--- templates/editor/file/en.html
+++ templates/editor/file/en.html
@@ -9,8 +9,6 @@
   class="file-component"
   xmlns:petal="http://purl.org/petal/1.0/"
   petal:define="name_title       string:${self/block_name}_title;
-                name_move_up     string:${self/block_name}_up;
-                name_move_down   string:${self/block_name}_down;
                 name_delete      string:${self/block_name}_delete;
                 name_upload      string:${self/block_name}_upload;
                 name_file        string:${self/block_name}_file;
@@ -40,32 +38,7 @@
     >The title field is empty.</p>
   </div>
 
-    <p
-      class="up"
-    >
-      <label
-        for="file_up"
-        xml:lang="en"
-        lang="en"
-        dir="ltr"
-        petal:attributes="for name_move_up"
-      >
-        Move component 
-      </label>
-
-      <input
-        type="submit"
-        name="file_up"
-        id="file_up"
-        value="Up"
-        xml:lang="en"
-        lang="en"
-        dir="ltr"
-        title="Move this component up."
-        petal:attributes="name name_move_up; id name_move_up"
-      />
-
-    </p>
+  <?include file="/fragments/move_control/"?>
 
     <p>
       <a
@@ -204,30 +177,5 @@
       >Move to another document</a>
     </p>
 
-    <p
-      class="down"
-    >
-      <label
-        for="file_down"
-        xml:lang="en"
-        lang="en"
-        dir="ltr"
-        petal:attributes="for name_move_down"
-      >
-        Move component
-      </label>
-      <input
-        type="submit"
-        name="file_down"
-        id="file_down"
-        value="Down"
-        xml:lang="en"
-        lang="en"
-        dir="ltr"
-        title="Move this component down."
-        petal:attributes="name name_move_down; id name_move_down"
-      />
-    </p>
-
 </fieldset>
 
Index: en.html
===================================================================
RCS file: /var/spool/cvs/mkd/templates/editor/headlines/Attic/en.html,v
retrieving revision 1.1.2.17
retrieving revision 1.1.2.18
diff -Ltemplates/editor/headlines/en.html -Ltemplates/editor/headlines/en.html -u -r1.1.2.17 -r1.1.2.18
--- templates/editor/headlines/en.html
+++ templates/editor/headlines/en.html
@@ -8,9 +8,7 @@
 <fieldset
   class="headlines-component"
   xmlns:petal="http://purl.org/petal/1.0/"
-  petal:define="name_move_up       string:${self/block_name}_up;
-                name_move_down     string:${self/block_name}_down;
-                name_delete        string:${self/block_name}_delete;
+  petal:define="name_delete        string:${self/block_name}_delete;
                 name_max_headlines string:${self/block_name}_max_headlines;
                 name_title         string:${self/block_name}_title;
                 name_from_path     string:${self/block_name}_from_path;
@@ -74,30 +72,7 @@
     >You must select at least one audience when audience matching is turned on.</p>
   </div>
 
-    <p
-      class="up"
-    >
-      <label
-        for="headlines_up"
-        xml:lang="en"
-        lang="en"
-        dir="ltr"
-        petal:attributes="for name_move_up"
-      >
-        Move component
-      </label>
-      <input
-        type="submit"
-        name="headlines_up"
-        id="headlines_up"
-        value="Up"
-        xml:lang="en"
-        lang="en"
-        dir="ltr"
-        title="Move this component up."
-        petal:attributes="name name_move_up; id name_move_up"
-      />
-    </p>
+  <?include file="/fragments/move_control/"?>
 
     <p>
       <em
@@ -378,30 +353,5 @@
       >Move to another document</a>
     </p>
 
-    <p
-      class="down"
-    >
-        <label
-          for="headlines_down"
-          xml:lang="en"
-          lang="en"
-          dir="ltr"
-          petal:attributes="for name_move_down"
-        >
-          Move component
-        </label>
-        <input
-          type="submit"
-          name="headlines_down"
-          id="headlines_down"
-          value="Down"
-          xml:lang="en"
-          lang="en"
-          dir="ltr"
-          title="Move this component down."
-          petal:attributes="name name_move_down; id name_move_down"
-        />
-      </p>
-
 </fieldset>
 
Index: en.html
===================================================================
RCS file: /var/spool/cvs/mkd/templates/editor/html/Attic/en.html,v
retrieving revision 1.1.2.10
retrieving revision 1.1.2.11
diff -Ltemplates/editor/html/en.html -Ltemplates/editor/html/en.html -u -r1.1.2.10 -r1.1.2.11
--- templates/editor/html/en.html
+++ templates/editor/html/en.html
@@ -11,8 +11,6 @@
   petal:define="dir              self/direction;
                 align            self/align;
                 align_opposite   self/align_opposite;
-                name_move_up     string:${self/block_name}_up;
-                name_move_down   string:${self/block_name}_down;
                 name_delete      string:${self/block_name}_delete"
 
 >
@@ -38,31 +36,7 @@
       </p>
     </div>
 
-    <p
-      class="up"
-    >
-      <label
-        for="html_up"
-        xml:lang="en"
-        lang="en"
-        dir="ltr"
-        petal:attributes="for name_move_up"
-      >
-        Move component
-      </label>
-
-      <input
-        type="submit"
-        name="html_up" 
-        id="html_up"
-        xml:lang="en"
-        lang="en"
-        dir="ltr"
-        value="Up"
-        title="Move this component up."
-        petal:attributes="name name_move_up; id name_move_up"
-      />
-    </p>
+    <?include file="/fragments/move_control/"?>
 
     <p>
       <em
@@ -126,34 +100,5 @@
       >Move to another document</a>
     </p>
 
-
-    <p
-      class="down"
-    >
-
-      <label
-        for="html_down"
-        xml:lang="en"
-        lang="en"
-        dir="ltr"
-        petal:attributes="for name_move_down"
-      >
-        Move component
-      </label>
-
-      <input
-        type="submit"
-        name="html_down"
-        id="html_down"
-        value="Down"
-        xml:lang="en"
-        lang="en"
-        dir="ltr"
-        title="Move this component down."
-        petal:attributes="name name_move_down; id name_move_down"
-      />
-
-    </p>
-
 </fieldset>
 
Index: en.html
===================================================================
RCS file: /var/spool/cvs/mkd/templates/editor/timerange/Attic/en.html,v
retrieving revision 1.1.2.6
retrieving revision 1.1.2.7
diff -Ltemplates/editor/timerange/en.html -Ltemplates/editor/timerange/en.html -u -r1.1.2.6 -r1.1.2.7
--- templates/editor/timerange/en.html
+++ templates/editor/timerange/en.html
@@ -8,9 +8,7 @@
 <fieldset
   class="timerange-component"
   xmlns:petal="http://purl.org/petal/1.0/"
-  petal:define="name_move_up       string:${self/block_name}_up;
-                name_move_down     string:${self/block_name}_down;
-                name_delete        string:${self/block_name}_delete;
+  petal:define="name_delete        string:${self/block_name}_delete;
                 name_title         string:${self/block_name}_title;
                 name_from_month    string:${self/block_name}_from_month;
                 name_from_day      string:${self/block_name}_from_day;
@@ -118,30 +116,7 @@
     >The Start Date occurs after the End Date.</p>
   </div>
 
-    <p
-      class="up"
-    >
-      <label
-        for="timerange_up"
-        xml:lang="en"
-        lang="en"
-        dir="ltr"
-        petal:attributes="for name_move_up"
-      >
-        Move component
-      </label>
-      <input
-        type="submit"
-        name="timerange_up"
-        id="timerange_up"
-        value="Up"
-        xml:lang="en"
-        lang="en"
-        dir="ltr"
-        title="Move this component up."
-        petal:attributes="name name_move_up; id name_move_up"
-      />
-    </p>
+  <?include file="/fragments/move_control/"?>
 
     <p>
 
@@ -688,31 +663,5 @@
       >Move to another document</a>
     </p>
 
-    <p
-      class="down"
-    >
-        <label
-          for="timerange_down"
-          xml:lang="en"
-          lang="en"
-          dir="ltr"
-          petal:attributes="for name_move_down"
-        >
-          Move component
-        </label>
-        <input
-          type="submit"
-          name="timerange_down"
-          id="timerange_down"
-          value="Down"
-          xml:lang="en"
-          lang="en"
-          dir="ltr"
-          title="Move this component down."
-          petal:attributes="name name_move_down; 
-                            id   name_move_down;"
-        />
-      </p>
-
 </fieldset>
 


More information about the MKDoc-commit mailing list