docs: protected void buildJsonItemCommonPart(JSONObject jsonObj, CmsResource res, String sitePath) {
  
          try {
              // 1: file item site path
              jsonObj.put("sitepath", sitePath);
              // 2: substituted file item url
              jsonObj.put("linkpath", getJsp().link(sitePath));
              // 3: file item title
              jsonObj.put(
                  "title",
                  CmsStringUtil.escapeJavaScript(
                      getJsp().property(CmsPropertyDefinition.PROPERTY_TITLE, sitePath, res.getName())));
              // 4: file size (in kb)
              jsonObj.put(
                  "size",
                  (res.getLength() / 1024) + " " + key(org.opencms.workplace.galleries.Messages.GUI_LABEL_KILOBYTES_0));
              // 5: file creation date (formatted)
              jsonObj.put("datecreated", getMessages().getDateTime(res.getDateCreated()));
              // 6: file modification date (formatted)
              jsonObj.put("datelastmodified", getMessages().getDateTime(res.getDateLastModified()));
              // 7: file state, if the item is new or changed
              CmsResourceState state = res.getState();
              CmsLock lock = CmsLock.getNullLock();
              try {
                  // obtain current lock state to determine correct resource state and editable flag
                  lock = getCms().getLock(res);
              } catch (CmsException e) {
                  // ignore, lock state could not be determined
              }
              if (!lock.isNullLock() && lock.getType().isPublish()) {
                  state = CmsResourceState.STATE_UNCHANGED;
              }
              jsonObj.put("state", state);
              // 8: determine if the item is locked by another user
              String locked = "";
              if (!lock.isNullLock()
                  && !lock.getType().isPublish()
                  && !lock.getUserId().equals(getCms().getRequestContext().getCurrentUser().getId())) {
                  try {
                      locked = getCms().readUser(lock.getUserId()).getName();
                  } catch (CmsException e) {
                      // failed to read user, use ID as user name
                      locked = lock.getUserId().toString();
                  }
              }
              jsonObj.put("lockedby", locked);
              // 9: item editable flag to determine if item is editable (offline project and can be locked by the current user)
              boolean editable = false;
              // 10: item write permissions to determine if the user has write permission
              boolean writePermission = false;
              // 10: item direct publish flag to determine if the user has direct publish permission
              boolean directPublishPermission = false;
              try {
                  // test if the resource is in the offline project and it can be locked by the user
                  if (!getCms().getRequestContext().getCurrentProject().isOnlineProject()
                      && lock.isLockableBy(getCms().getRequestContext().getCurrentUser())) {
                      editable = true;
                      // test if the user has the write permission
                      if (getCms().hasPermissions(res, CmsPermissionSet.ACCESS_WRITE, false, CmsResourceFilter.ALL)) {
                          writePermission = true;
                      }
                      // test if the user has direct publish permission
                      if (getCms().hasPermissions(
                          res,
                          CmsPermissionSet.ACCESS_DIRECT_PUBLISH,
                          false,
                          CmsResourceFilter.ALL)) {
                          directPublishPermission = true;
                      }
  
                  }
              } catch (CmsException e) {
                  if (LOG.isErrorEnabled()) {
                      LOG.error(e.getLocalizedMessage(), e);
                  }
              }
              jsonObj.put("editable", editable);
              jsonObj.put("writepermission", writePermission);
              jsonObj.put("directpublish", directPublishPermission);
              // 11: item description
              String desc = getJsp().property(CmsPropertyDefinition.PROPERTY_DESCRIPTION, sitePath, "");
              jsonObj.put("description", CmsStringUtil.escapeJavaScript(desc));
          } catch (JSONException e) {
              if (LOG.isErrorEnabled()) {
                  LOG.error(e.getLocalizedMessage(), e);
              }
          }
      }