.related_media {
border-top: 1px dotted #6a0307;
}
-}
+
+
+ #chatwindow {
+ min-height: 10em;
+ max-height: 42em;
+ border-bottom: 1px solid;
+ padding: 0.8em;
+ overflow: auto;
+ background-color: white;
+ font-size: 0.8125em;
+ -moz-border-radius: 8px 0px 8px 8px;
+ -webkit-border-radius: 8px 0px 8px 8px;
+ border-radius: 8px 0px 8px 8px;
+ }
+
+ .msg {
+ font-size: 0.9em;
+ }
+
+ .msg input {
+ -moz-border-radius: 8px 8px 8px 8px;
+ -webkit-border-radius: 8px 8px 8px 8px;
+ border-radius: 8px 8px 8px 8px;
+ }
+
+ .mod {
+ width: 66%;
+ float: left;
++}
media.title = title.replace('\n', '').strip()
media.save()
-def auto_code(resources, base_code):
- index = 1
- while True:
- code = base_code + '_' + str(index)
- r = resources.filter(code=code)
- if not r:
- break
- index += 1
- return code
+def auto_code(collection):
+ items = collection.items.all()
+ suffixes = []
+
+ if items:
+ for item in items:
+ if '_' in item.public_id:
+ try:
+ split = item.public_id.split('_')
+ suffix = int(split[-1])
+ prefix = split[:-1]
+ except:
+ suffix = 999
+
+ suffixes.append(suffix)
+
+ if suffixes:
+ return collection.code + '_' + str(max(suffixes)+1)
+ else:
+ return collection.code + '_'
-
+
+ def get_room(content_type=None, id=None, name=None):
+ rooms = jqchat.models.Room.objects.filter(content_type=content_type,
+ object_id=id)
+ if not rooms:
+ room = jqchat.models.Room.objects.create(content_type=content_type,
+ object_id=id,
+ name=name[:20])
+ else:
+ room = rooms[0]
+ return room
++