Fossil

Check-in [6535398e87]
Login

Check-in [6535398e87]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Add infrastructure for making some hyperlinks have class='inlinebutton'. But there does not appear to be a good way to style this, so the change is abandoned.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | inline-button
Files: files | file ages | folders
SHA1: 6535398e879420cedcbca5a22d4c600d02d3dab6
User & Date: drh 2015-02-05 12:42:56.022
Context
2015-02-05
12:42
Add infrastructure for making some hyperlinks have class='inlinebutton'. But there does not appear to be a good way to style this, so the change is abandoned. ... (Closed-Leaf check-in: 6535398e87 user: drh tags: inline-button)
11:58
Merge trunk fixes into the form-submenu branch. ... (check-in: d539f65cc2 user: drh tags: form-submenu)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/style.c.
113
114
115
116
117
118
119
120
121

122
123
124
125
126
127
128
129

130
131



132
133
134
135
136
137
138
139
140
141
142
143
144
145











146
147
148
149
150








151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
**
**      @ %z(href("%R/artifact/%s",zUuid))%h(zFN)</a>
**
** Note %z format.  The string returned by this function is always
** obtained from fossil_malloc() so rendering it with %z will reclaim
** that memory space.
**
** There are two versions of this routine: href() does a plain hyperlink
** and xhref() adds extra attribute text.

**
** g.perm.Hyperlink is true if the user has the Hyperlink (h) property.
** Most logged in users should have this property, since we can assume
** that a logged in user is not a bot.  Only "nobody" lacks g.perm.Hyperlink,
** typically.
*/
char *xhref(const char *zExtra, const char *zFormat, ...){
  char *zUrl;

  va_list ap;
  va_start(ap, zFormat);



  zUrl = vmprintf(zFormat, ap);
  va_end(ap);
  if( g.perm.Hyperlink && !g.javascriptHyperlink ){
    char *zHUrl = mprintf("<a %s href=\"%h\">", zExtra, zUrl);
    fossil_free(zUrl);
    return zHUrl;
  }
  if( nHref>=nHrefAlloc ){
    nHrefAlloc = nHrefAlloc*2 + 10;
    aHref = fossil_realloc(aHref, nHrefAlloc*sizeof(aHref[0]));
  }
  aHref[nHref++] = zUrl;
  return mprintf("<a %s id='a%d' href='%R/honeypot'>", zExtra, nHref);
}











char *href(const char *zFormat, ...){
  char *zUrl;
  va_list ap;
  va_start(ap, zFormat);
  zUrl = vmprintf(zFormat, ap);








  va_end(ap);
  if( g.perm.Hyperlink && !g.javascriptHyperlink ){
    char *zHUrl = mprintf("<a href=\"%h\">", zUrl);
    fossil_free(zUrl);
    return zHUrl;
  }
  if( nHref>=nHrefAlloc ){
    nHrefAlloc = nHrefAlloc*2 + 10;
    aHref = fossil_realloc(aHref, nHrefAlloc*sizeof(aHref[0]));
  }
  aHref[nHref++] = zUrl;
  return mprintf("<a id='a%d' href='%R/honeypot'>", nHref);
}

/*
** Generate <form method="post" action=ARG>.  The ARG value is inserted
** by javascript.
*/
void form_begin(const char *zOtherArgs, const char *zAction, ...){







|
|
>






|

>
|
|
>
>
>

<

|

<
|
|
|
|
|
|
|
|
>
>
>
>
>
>
>
>
>
>
>

|


|
>
>
>
>
>
>
>
>

<
<
<
|
<
<
<
<
<
<
<







113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137

138
139
140

141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173



174







175
176
177
178
179
180
181
**
**      @ %z(href("%R/artifact/%s",zUuid))%h(zFN)</a>
**
** Note %z format.  The string returned by this function is always
** obtained from fossil_malloc() so rendering it with %z will reclaim
** that memory space.
**
** There are three versions of this routine: href() does a plain hyperlink
** and xhref() adds extra attribute text.  The btn() version adds a
** single "class='inlinebutton'" class to the anchor.
**
** g.perm.Hyperlink is true if the user has the Hyperlink (h) property.
** Most logged in users should have this property, since we can assume
** that a logged in user is not a bot.  Only "nobody" lacks g.perm.Hyperlink,
** typically.
*/
char *vxhref(const char *zExtra, const char *zFormat, va_list ap){
  char *zUrl;
  Blob ref = empty_blob;
  blob_append(&ref, "<a ", 3);
  if( zExtra ){
    blob_append(&ref, zExtra, -1);
    blob_append(&ref, " ", 1);
  }
  zUrl = vmprintf(zFormat, ap);

  if( g.perm.Hyperlink && !g.javascriptHyperlink ){
    blob_appendf(&ref,"href='%h'>", zUrl);
    fossil_free(zUrl);

  }else{
    if( nHref>=nHrefAlloc ){
      nHrefAlloc = nHrefAlloc*2 + 10;
      aHref = fossil_realloc(aHref, nHrefAlloc*sizeof(aHref[0]));
    }
    aHref[nHref++] = zUrl;
    blob_appendf(&ref, "id='a%d' href='%R/honeypot'>", nHref);
  }
  blob_materialize(&ref);
  return ref.aData;
}  
char *xhref(const char *zExtra, const char *zFormat, ...){
  char *zResult;
  va_list ap;
  va_start(ap, zFormat);
  zResult = vxhref(zExtra, zFormat, ap);
  va_end(ap);
  return zResult;
}
char *href(const char *zFormat, ...){
  char *zResult;
  va_list ap;
  va_start(ap, zFormat);
  zResult = vxhref(0, zFormat, ap);
  va_end(ap);
  return zResult;
}
char *btn(const char *zFormat, ...){
  char *zResult;
  va_list ap;
  va_start(ap, zFormat);
  zResult = vxhref("class='inlinebutton'", zFormat, ap);
  va_end(ap);



  return zResult;







}

/*
** Generate <form method="post" action=ARG>.  The ARG value is inserted
** by javascript.
*/
void form_begin(const char *zOtherArgs, const char *zAction, ...){
Changes to src/timeline.c.
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
          @ %z(href("%R/artifact/%s",zNew))[view]</a></li>
        }else{
          if( zOldName!=0 ){
            @ <li> %h(zOldName) &rarr; %h(zFilename) %s(zUnpubTag)
          }else{
            @ <li> %h(zFilename) &nbsp; %s(zUnpubTag)
          }
          @ %z(href("%R/fdiff?sbs=1&v1=%s&v2=%s",zOld,zNew))[diff]</a></li>
        }
      }
      db_reset(&fchngQuery);
      if( inUl ){
        @ </ul>
      }
    }







|







533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
          @ %z(href("%R/artifact/%s",zNew))[view]</a></li>
        }else{
          if( zOldName!=0 ){
            @ <li> %h(zOldName) &rarr; %h(zFilename) %s(zUnpubTag)
          }else{
            @ <li> %h(zFilename) &nbsp; %s(zUnpubTag)
          }
          @ %z(btn("%R/fdiff?sbs=1&v1=%s&v2=%s",zOld,zNew))diff</a></li>
        }
      }
      db_reset(&fchngQuery);
      if( inUl ){
        @ </ul>
      }
    }