forked from indymedia/epicyon
Formatting of '
parent
ed46de3709
commit
8fdcb93546
21
daemon.py
21
daemon.py
|
@ -1807,6 +1807,27 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
with open(actorFilename, 'r') as fp:
|
with open(actorFilename, 'r') as fp:
|
||||||
actorJson=commentjson.load(fp)
|
actorJson=commentjson.load(fp)
|
||||||
actorChanged=False
|
actorChanged=False
|
||||||
|
skillCtr=1
|
||||||
|
newSkills={}
|
||||||
|
while skillCtr<10:
|
||||||
|
skillName=fields.get('skillName'+str(skillCtr))
|
||||||
|
if not skillName:
|
||||||
|
skillCtr+=1
|
||||||
|
continue
|
||||||
|
skillValue=fields.get('skillValue'+str(skillCtr))
|
||||||
|
if not skillValue:
|
||||||
|
skillCtr+=1
|
||||||
|
continue
|
||||||
|
if not actorJson['skills'].get(skillName):
|
||||||
|
actorChanged=True
|
||||||
|
else:
|
||||||
|
if actorJson['skills'][skillName]!=int(skillValue):
|
||||||
|
actorChanged=True
|
||||||
|
newSkills[skillName]=int(skillValue)
|
||||||
|
skillCtr+=1
|
||||||
|
if len(actorJson['skills'].items())!=len(newSkills.items()):
|
||||||
|
actorChanged=True
|
||||||
|
actorJson['skills']=newSkills
|
||||||
if fields.get('preferredNickname'):
|
if fields.get('preferredNickname'):
|
||||||
if fields['preferredNickname']!=actorJson['preferredUsername']:
|
if fields['preferredNickname']!=actorJson['preferredUsername']:
|
||||||
actorJson['preferredUsername']=fields['preferredNickname']
|
actorJson['preferredUsername']=fields['preferredNickname']
|
||||||
|
|
|
@ -564,3 +564,37 @@ input[type=checkbox]
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
margin: 10px 5px;
|
margin: 10px 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.slider {
|
||||||
|
-webkit-appearance: none;
|
||||||
|
width: 57%;
|
||||||
|
height: 25px;
|
||||||
|
background: #d3d3d3;
|
||||||
|
outline: none;
|
||||||
|
opacity: 0.7;
|
||||||
|
-webkit-transition: .2s;
|
||||||
|
transition: opacity .2s;
|
||||||
|
float: right;
|
||||||
|
margin: 5px 0;
|
||||||
|
padding: 12px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.slider:hover {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.slider::-webkit-slider-thumb {
|
||||||
|
-webkit-appearance: none;
|
||||||
|
appearance: none;
|
||||||
|
width: 25px;
|
||||||
|
height: 25px;
|
||||||
|
background: #4CAF50;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.slider::-moz-range-thumb {
|
||||||
|
width: 25px;
|
||||||
|
height: 25px;
|
||||||
|
background: #4CAF50;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
2
posts.py
2
posts.py
|
@ -232,7 +232,7 @@ def getPosts(session,outboxUrl: str,maxPosts: int, \
|
||||||
if not isPublic:
|
if not isPublic:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
content = item['object']['content']
|
content = item['object']['content'].replace(''',"'")
|
||||||
|
|
||||||
mentions=[]
|
mentions=[]
|
||||||
emoji={}
|
emoji={}
|
||||||
|
|
10
skills.py
10
skills.py
|
@ -38,6 +38,16 @@ def setSkillLevel(baseDir: str,nickname: str,domain: str, \
|
||||||
commentjson.dump(actorJson, fp, indent=4, sort_keys=False)
|
commentjson.dump(actorJson, fp, indent=4, sort_keys=False)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
def setSkills(baseDir: str,nickname: str,domain: str,skills: {}) -> None:
|
||||||
|
actorFilename=baseDir+'/accounts/'+nickname+'@'+domain+'.json'
|
||||||
|
if not os.path.isfile(actorFilename):
|
||||||
|
return False
|
||||||
|
with open(actorFilename, 'r') as fp:
|
||||||
|
actorJson=commentjson.load(fp)
|
||||||
|
actorJson['skills']=skills
|
||||||
|
with open(actorFilename, 'w') as fp:
|
||||||
|
commentjson.dump(actorJson, fp, indent=4, sort_keys=False)
|
||||||
|
|
||||||
def getSkills(baseDir: str,nickname: str,domain: str) -> []:
|
def getSkills(baseDir: str,nickname: str,domain: str) -> []:
|
||||||
"""Returns the skills for a given person
|
"""Returns the skills for a given person
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -31,6 +31,7 @@ from announce import announcedByPerson
|
||||||
from blocking import isBlocked
|
from blocking import isBlocked
|
||||||
from content import getMentionsFromHtml
|
from content import getMentionsFromHtml
|
||||||
from config import getConfigParam
|
from config import getConfigParam
|
||||||
|
from skills import getSkills
|
||||||
|
|
||||||
def htmlEditProfile(baseDir: str,path: str,domain: str,port: int) -> str:
|
def htmlEditProfile(baseDir: str,path: str,domain: str,port: int) -> str:
|
||||||
"""Shows the edit profile screen
|
"""Shows the edit profile screen
|
||||||
|
@ -84,6 +85,18 @@ def htmlEditProfile(baseDir: str,path: str,domain: str,port: int) -> str:
|
||||||
with open(allowedInstancesFilename, 'r') as allowedInstancesFile:
|
with open(allowedInstancesFilename, 'r') as allowedInstancesFile:
|
||||||
allowedInstancesStr=allowedInstancesFile.read()
|
allowedInstancesStr=allowedInstancesFile.read()
|
||||||
|
|
||||||
|
skills=getSkills(baseDir,nickname,domain)
|
||||||
|
skillsStr=''
|
||||||
|
skillCtr=1
|
||||||
|
if skills:
|
||||||
|
for skillDesc,skillValue in skills.items():
|
||||||
|
skillsStr+='<p><input type="text" placeholder="Skill '+str(skillCtr)+'" name="skillName'+str(skillCtr)+'" value="'+skillDesc+'" style="width:40%">'
|
||||||
|
skillsStr+='<input type="range" min="1" max="100" class="slider" name="skillValue'+str(skillCtr)+'" value="'+str(skillValue)+'"></p>'
|
||||||
|
skillCtr+=1
|
||||||
|
|
||||||
|
skillsStr+='<p><input type="text" placeholder="Skill '+str(skillCtr)+'" name="skillName'+str(skillCtr)+'" value="" style="width:40%">'
|
||||||
|
skillsStr+='<input type="range" min="1" max="100" class="slider" name="skillValue'+str(skillCtr)+'" value="50"></p>' \
|
||||||
|
|
||||||
with open(baseDir+'/epicyon-profile.css', 'r') as cssFile:
|
with open(baseDir+'/epicyon-profile.css', 'r') as cssFile:
|
||||||
newPostCSS = cssFile.read()
|
newPostCSS = cssFile.read()
|
||||||
|
|
||||||
|
@ -124,6 +137,11 @@ def htmlEditProfile(baseDir: str,path: str,domain: str,port: int) -> str:
|
||||||
' <br>Federate only with a defined set of instances. One domain name per line.' \
|
' <br>Federate only with a defined set of instances. One domain name per line.' \
|
||||||
' <textarea id="message" name="allowedInstances" placeholder="" style="height:200px">'+allowedInstancesStr+'</textarea>' \
|
' <textarea id="message" name="allowedInstances" placeholder="" style="height:200px">'+allowedInstancesStr+'</textarea>' \
|
||||||
' </div>' \
|
' </div>' \
|
||||||
|
' <div class="container">' \
|
||||||
|
' <b>Skills</b><br>' \
|
||||||
|
' If you want to participate within organizations then you can indicate some skills that you have and approximate proficiency levels. This helps organizers to construct teams with an appropriate combination of skills.'+ \
|
||||||
|
skillsStr+ \
|
||||||
|
' </div>' \
|
||||||
' </div>' \
|
' </div>' \
|
||||||
'</form>'
|
'</form>'
|
||||||
editProfileForm+=htmlFooter()
|
editProfileForm+=htmlFooter()
|
||||||
|
|
Loading…
Reference in New Issue